* One bug with the implementation of Real.fromDecimal (which also affects
  Real.scan and Real.fromString) in PolyML 5.2.  The string_buffer[30] in
  Real_convc in <src>/libpolyml/reals.cpp limits the length of the string
  seen by strtod to 29 characters.  However, the construction of the ML
  string at <src>/basis/Real.sml:359 can construct an arbitrarily large
  string.  In particular, the "E" and exponent can be pushed beyond the
  end of the string seen by strtod:

Poly/ML 5.2 Release

Real.fromString "1234567890.12345678901234";
val it = SOME 1234567890.0 : Real.real option

Real.fromString "1234567890.123456789012345";
val it = SOME 1.23456789 : Real.real option

Real.fromString "1234567890.1234567890123456";
val it = NONE : Real.real option

Real.fromString "1234567890.1234567890123456789";
val it = SOME 0.123456789 : Real.real option


* Real.~ doesn't properly flip the sign bit on zero:

Poly/ML 5.2 Release

Real.signBit 0.0;
val it = false : bool
Real.signBit (Real.~ 0.0);
val it = false : bool
Real.signBit 1.0;
val it = false : bool
Real.signBit (Real.~ 1.0);
val it = true : bool

This, in turn, makes 'Real.fromString "~0.0"' get the sign bit wrong:

Real.signBit (valOf (Real.fromString "~0.0"));
val it = false : bool


_______________________________________________
polyml mailing list
polyml@inf.ed.ac.uk
http://lists.inf.ed.ac.uk/mailman/listinfo/polyml

Reply via email to