[mercury-users] Fun with signed integers.
Julian Fondren
ayrnieu at gmail.com
Sun Feb 25 05:49:54 AEDT 2007
$ ./tt800
1125053530 1570041982 347012937 1735893326 2012423215 319846466
62755666 500522132
129776071 1978109378 254837880 494366529 1237696937 1468369496
370579849 664740369
51910867 819270944 476180518 190380673 1370447020 1620916304 663482756
1354889312
294674868 63617953 437848168 1890923292 1094037345 1838926140
576471910 738883039
1863561171 951503738 1592412108 123060868 1069177062 1139430021
1130207152 1401787632
1077838070 1366702413 91673256 1085759616 373770970 803181960
1588539293 1000896392
1672022332 244950561
$ ../tt800
-1124993958 -1569984386 347012937 1735893326 -2012470225 -319850430
62755666 500522132
129776071 1978109378 -254835592 -494375103 -1237663319 1468369496
370579849 -664788463
51910867 819270944 476180518 190380673 1370447020 1620916304 663482756
1354889312
-294690380 868393086 1441698743 1086138563 1899869374 -577547549
-1839933255 -1677529600
1595651084 -146681691 1860328467 928897371 263340857 -203241126
-1934979985 1669697327
1882626857 1635656338 897501559 -1061691264 373770970 -1344334456
-1588580451 -1000900728
-475428548 1902519841
The first comes from a Mercury program, using my work-in-progress random.m
replacement. The second uses the canonical tt800.c . Both have the same
seed. I've only hacked out the second's conversion to a double, to see
why the floating-point output of both is so different.
Speaking of floats, here is an important function in my module:
:- func max_int_float = float.
max_int_float = float((integer(0xfffffff) << 4) \/ integer(0xF)).
I fear that this is going to end in tears.
Cheers,
Julian
--------------------------------------------------------------------------
mercury-users mailing list
Post messages to: mercury-users at csse.unimelb.edu.au
Administrative Queries: owner-mercury-users at csse.unimelb.edu.au
Subscriptions: mercury-users-request at csse.unimelb.edu.au
--------------------------------------------------------------------------
More information about the users
mailing list