www.digitalmars.com         C & C++   DMDScript  

digitalmars.D - more bugs with bigint

reply hellcatv hotmail.com writes:
Hey I found some more bugs

opNeg doesn't work right for certain powers of two...
ones I've discovered include:
-2**32 = -4294967296L

-2**64 = -18446744073709551616

run 'em through opNeg twice and you get an assert somewhere... and if ignored
division by the number would result in zero!

luckily (since my project was due this afternoon) I was able to special case
these two and punt on test cases that used bigger numbers--but I couldn't figure
out the logic for how to fix it

I had some breakage with the Karasuba multiplication but haven't been able to
track it down yet.

Anyhow while these are niggles, overall I've been very pleased with the bigint
and it has brought me success in my project.
I'll a webpage about it on the ninth:-)
Jun 08 2004
next sibling parent Arcane Jill <Arcane_member pathlink.com> writes:
In article <ca3pvc$3mq$1 digitaldaemon.com>, hellcatv hotmail.com says...
Hey I found some more bugs

opNeg doesn't work right for certain powers of two...
ones I've discovered include:
-2**32 = -4294967296L

-2**64 = -18446744073709551616

run 'em through opNeg twice and you get an assert somewhere... and if ignored
division by the number would result in zero!
Thanks. Will fix tonight. Jill
Jun 08 2004
prev sibling parent reply Arcane Jill <Arcane_member pathlink.com> writes:
In article <ca3pvc$3mq$1 digitaldaemon.com>, hellcatv hotmail.com says...

opNeg doesn't work right for certain powers of two...
ones I've discovered include:
-2**32 = -4294967296L
-2**64 = -18446744073709551616
Now fixed. The latest version of the lib is now on dsource. Also fixed is small problem whereby the lib didn't compile under dmd 0.92 (though it did compile under 0.91). A nice little unannounced fix there, on Walter's part. Basically, it seems I had provided a function Int.opNeg_r(Int) - so the (new) compiler couldn't decide whether to use opNeg() or opNeg_r(). Ambiguity! The superfluous functions are now removed, and the lib compiles once more.
Anyhow while these are niggles, overall I've been very pleased with the bigint
and it has brought me success in my project.
I'm really pleased to hear that. Thanks for the feedback.
I'll a webpage about it on the ninth:-)
Cool
Jun 08 2004
parent reply "Walter" <newshound digitalmars.com> writes:
"Arcane Jill" <Arcane_member pathlink.com> wrote in message
news:ca5ag2$2qc6$1 digitaldaemon.com...
 Also fixed is small problem whereby the lib didn't compile under dmd 0.92
 (though it did compile under 0.91). A nice little unannounced fix there,
on
 Walter's part. Basically, it seems I had provided a function
Int.opNeg_r(Int) -
 so the (new) compiler couldn't decide whether to use opNeg() or opNeg_r().
 Ambiguity!
The changelog says overloading rules were changed for operator overloads, though one would have to carefully read it to see it. BTW, opNeg_r is not recognized as an operator overload, perhaps you meant opSub_r?
Jun 08 2004
parent Arcane Jill <Arcane_member pathlink.com> writes:
In article <ca5kvv$b13$1 digitaldaemon.com>, Walter says...
 perhaps you meant opSub_r?
I did indeed. And also opDiv_r, opMod_r, opShl_r, opShr_r and opUShr_r. Like I said. The new compiler is great. I did wonder about those functions at the time. Now the compiler makes it clear what's right and what's wrong. It's brilliant. Thanks very much. Jill
Jun 08 2004