Hello, I am using Poly/ML 5.5.2 Release ? ?RTS version: X86_64-5.5.1 on Ubuntu 14.04
The following program (test2.sml) demonstrates a problem with Real.toLargeInt fun test1 (r:real) =?? Real.toLargeInt IEEEReal.TO_NEAREST r; fun test2 (r:real) =?? Real.toLargeInt IEEEReal.TO_ZERO r; print "test1: arg = 2.23E34 \n";print ((IntInf.toString (test1 2.23E34)) ^ "\n");print "test1:arg = 2.23E35 \n";print ((IntInf.toString (test1 2.23E35)) ^ "\n"); print "test2: arg = 2.23E34 \n";print ((IntInf.toString (test2 2.23E34)) ^ "\n");print "test2:arg = 2.23E35 \n";print ((IntInf.toString (test2 2.23E35)) ^ "\n");
The output on poly/ml is?
use "test2.sml";val test1 = fn: real -> intval test2 = fn: real -> inttest1: arg = 2.23E34?val it = (): unit22300000000000000356845941540807755val it = (): unittest1:arg = 2.23E35?val it = (): unitException- Size raisedException- Size raised
Running the same program on mlton: doug at doug-MS-7642:~/poly$ mlton test2.smldoug at doug-MS-7642:~/poly$ ./test2test1: arg = 2.23E34?22300000000000001034524584994406400test1:arg = 2.23E35?222999999999999991898501776234512384test2: arg = 2.23E34?22300000000000001034524584994406400test2:arg = 2.23E35?222999999999999991898501776234512384 The test2.sml program is attached. I enjoy using poly/ml. Regards,Doug
Thanks for sending this. I've looked at it and committed a fix so it now produces the same answers as you got from mlton.
David
On 30/12/2014 21:01, T.D. Telford wrote:
Hello, I am using Poly/ML 5.5.2 Release RTS version: X86_64-5.5.1 on Ubuntu 14.04
The following program (test2.sml) demonstrates a problem with Real.toLargeInt fun test1 (r:real) = Real.toLargeInt IEEEReal.TO_NEAREST r; fun test2 (r:real) = Real.toLargeInt IEEEReal.TO_ZERO r; print "test1: arg = 2.23E34 \n";print ((IntInf.toString (test1 2.23E34)) ^ "\n");print "test1:arg = 2.23E35 \n";print ((IntInf.toString (test1 2.23E35)) ^ "\n"); print "test2: arg = 2.23E34 \n";print ((IntInf.toString (test2 2.23E34)) ^ "\n");print "test2:arg = 2.23E35 \n";print ((IntInf.toString (test2 2.23E35)) ^ "\n");
The output on poly/ml is
use "test2.sml";val test1 = fn: real -> intval test2 = fn: real -> inttest1: arg = 2.23E34 val it = (): unit22300000000000000356845941540807755val it = (): unittest1:arg = 2.23E35 val it = (): unitException- Size raisedException- Size raised
Running the same program on mlton: doug at doug-MS-7642:~/poly$ mlton test2.smldoug at doug-MS-7642:~/poly$ ./test2test1: arg = 2.23E34 22300000000000001034524584994406400test1:arg = 2.23E35 222999999999999991898501776234512384test2: arg = 2.23E34 22300000000000001034524584994406400test2:arg = 2.23E35 222999999999999991898501776234512384 The test2.sml program is attached. I enjoy using poly/ml. Regards,Doug
polyml mailing list polyml at inf.ed.ac.uk http://lists.inf.ed.ac.uk/mailman/listinfo/polyml