Re: Datatype checking in DotNET



Daniel Hobson wrote:

But what I am trying to achieve here is to ensure the data integrity, does the data meet the float bounds?????

For integers you could do a test like this:-

tempVal := StrToInt (fieldStr);
if (tempVal < low (IntImSavingToo )) or (tempVal > high (IntImSavingToo )) then
exit;

In contrast to integral types, floating point types have different bounds, or better: limitations. The only hard limit is the upper bound of the exponent, which can result in an infinity value, whereas a loss of significant digits or vanishing too-small values are "normal" events in dealing with floats.

Is there something I can use for floats, doubles and singles also???

You better use the native floating point type of .NET, and don't bother with the other types.

DoDi
.



Relevant Pages

  • Re: Drawing floating-point lines with Bresenham
    ... of native floating point stepping. ... vertical pixels), and the linear distance traveled in each step (a ... The generic float algorithm is easily programmed (speed ... and of course NOT a Bresenham algo). ...
    (comp.graphics.algorithms)
  • Re: Source code for native methods in java
    ... What if the native representation of floats isn't IEEE ... implementations on non-IEEE machines and if so how they handle ... since it couldn't use the native floating point anyway. ...
    (comp.lang.java.programmer)
  • libctiny.lib
    ... #define PROMPT ':' ... #define exit return /* UNIX Fix */ ... float result; ... SimpleCalculator.obj: error LNK2001: unresolved external symbol _putchar ...
    (microsoft.public.vc.language)
  • Re: double vs float
    ... working correctly after first loop" that appears in today's list in ... Can someone explain why double should be preferred to float? ... Usually it's because double corresponds more closely with the system's ... What system is it that has "a" native floating point type, ...
    (comp.lang.c)