[Aldor-l] Using GMP and extending the biging protocol
Stephen Watt
watt at scl.csd.uwo.ca
Sat Aug 16 00:02:33 EDT 2008
Thanks for looking into this stuff Pippijn.
The bigint macros are supposed to use the 2's complement overflows for
the purposes of good, not evil :).
That is, there are places where they are supposed to happen and we
count on the overflows wrapping around. This is used, for example, in
testing for carries. It allows us to use full word arithmetic from
C.
It is probably the case that you have spotted a case where this is
going wrong -- I haven't looked into it in detail.
-- Stephen
2008/8/15 <pip88nl at gmail.com>:
> On Sat, Aug 16, 2008 at 05:26:19AM +0200, wrote:
>> checked (0xfffffffffffffff4 + 0xf)
>> [1] 7235 abort tests/library/axllib/bigmand.run
>
> pippijn at osiris aldor $ tests/library/axllib/bigmand.run
> overflow while calculating 0x7fffffffffffffff - 0xffffffffffffffff
> [1] 16694 trace trap tests/library/axllib/bigmand.run
>
> This is exactly what I was talking about.
> 0x7fffffffffffffff - 0xffffffffffffffff is the invalid negation. It does
> happen.. just nobody notices. I'll look into gmp some more, but this
> still has to be fixed. I'll also look at the IS_IMMED macros (nontrivial
> stuff, not for 5AM).
>
> Pippijn
>
> -----BEGIN PGP SIGNATURE-----
> Version: GnuPG v1.4.6 (GNU/Linux)
>
> iD8DBQFIpk+cJc+zqGNdDgoRAryJAKDr30w1SgMrGtgkLQFLj6Ak9umfLACgpppr
> o+h1I1UqxhVhNAS9USdSzoI=
> =Je2q
> -----END PGP SIGNATURE-----
>
> _______________________________________________
> Aldor-l mailing list
> Aldor-l at aldor.org
> http://aldor.org/mailman/listinfo/aldor-l_aldor.org
>
>
More information about the Aldor-l
mailing list