in reply to Re^2: how to speed up program dealing with large numbers?
in thread how to speed up program dealing with large numbers?

thank you for the tips, one question though

I don't quite understand this line:

my $phiApprox = $fibNum <= 1 ? '***' : $fibValue1 / $fibValue2;

In paticular this part:

 ? '***' :

Obviously it makes $phiApprox = '***' when $fibNum is <= 1, else it performs the arithmatic. But I don't really understand why, I would never have thought of that code.

Replies are listed 'Best First'.
Re^4: how to speed up program dealing with large numbers?
by GrandFather (Saint) on Mar 23, 2010 at 09:50 UTC

    $phiApprox is not defined in that case so rather than invent an number for it to be I used *** to indicate an unknown value.


    True laziness is hard work