std.rational?

Joseph Rushton Wakeling joseph.wakeling at webdrake.net
Mon Sep 30 02:46:41 PDT 2013


On 30/09/13 00:21, H. S. Teoh wrote:
> https://github.com/WebDrake/Rational/pull/1

Thanks, but unfortunately this pull works around the problem rather than solving 
it :-)

As MrSmith identified, it's gcf() that is at fault because it can't handle 0 as 
an input even though it should -- gcf(0, n) == gcf(n, 0) == n.

What's odd is why David didn't go with the (apparently pre-existing) 
std.numeric.gcd.  It doesn't currently support BigInts but it could be fixed to 
do so.

IIRC the consensus is that std.numeric is broken/borked beyond repair and is 
only waiting for a valid successor before it gets deprecated.  Was this already 
clear 2 years ago when David was writing std.rational?

Anyway, any preferences?  Fix std.numeric.gcd to support BigInt and kill 
std.rational.gcf, or fix std.rational.gcf?



More information about the Digitalmars-d mailing list