Rationals Lib?
language_fan
foo at bar.com.invalid
Sat Oct 10 14:10:13 PDT 2009
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.
More information about the Digitalmars-d
mailing list