Why can’t I compare reals in Standard ML?

Why doesn’t 1.0 = 2.0 work? Isn’t real an equality type? No. The type variable ”Z indicates that the operands of = must have equality types. Why won’t reals in patterns work […]? Pattern matching relies implicitly on testing for equality. The cryptic error message syntax error: inserting EQUALOP indicates that the SML/NJ parser does … Read more

What range of numbers can be represented in a 16-, 32- and 64-bit IEEE-754 systems?

For a given IEEE-754 floating point number X, if 2^E <= abs(X) < 2^(E+1) then the distance from X to the next largest representable floating point number (epsilon) is: epsilon = 2^(E-52) % For a 64-bit float (double precision) epsilon = 2^(E-23) % For a 32-bit float (single precision) epsilon = 2^(E-10) % For a … Read more