std.rational?

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


On 28/09/13 15:56, MrSmith wrote:
> It seems to me like gcf is not properly implemented. Also why its name is gcf
> (greatest common factor) and not gcd (greatest common divisor)?

Greatest common factor is just another term for greatest common divisor.  I 
don't know why David chose it, maybe because he's a scientist and liked the more 
traditionally formal term, maybe because gcd is typical and he wanted to avoid a 
clash with other implementations in other modules.

Anyway, you're right, it's not properly implemented -- it can't handle the case 
of one of its inputs being 0.  In fact we should have gcf(0, n) == n.



More information about the Digitalmars-d mailing list