I guess I could have implemented some of these suggestions, but the idea was for this lib to be very simple (it's only about 300 lines of code so far) and agnostic to the implementation of the integers it's working on top of, with the caveat that, if you use something that's not arbitrary precision, the onus is on you to make sure nothing overflows. If anyone, for example, made a wrapper to the GNU multiprecision lib that looked like a D struct w/ operator overloading, it would be able to plug right into this library. If std.bigint improves, this library will automatically benefit.
== Quote from language_fan (f...@bar.com.invalid)'s article > Sat, 10 Oct 2009 14:25:28 -0400, bearophile thusly wrote: > > dsimcha: > > > >> auto f1 = fraction( BigInt("314159265"), BigInt("27182818")); > > > > That's a nice example where bigint literals are useful. > > > > Missing bigint literals, this looks shorter than your way to define f1: > > auto f1 = fraction("314159265 / 27182818"); Or a little better, if/when > > structs can be assigned statically: fraction f1 = q{314159265 / > > 27182818}; > FWIW, he could have just redefined the / operator in class bigint: > bigint(1) / 3 > Or > bigint f; > f = 1 > f /= 3; > Can't really remember how overloading the assignment works in D.