How to determine that 2.0 == (float) 2 in a front-end.
Paul Koning
pkoning@equallogic.com
Thu Jun 27 19:20:00 GMT 2002
>>>>> "Tim" == Tim Josling <tej@melbpc.org.au> writes:
Tim> I have come across situations where for example 2.0 ** N where N
Tim> > 240 was calculated by successive multiplications. This sort of
Tim> calculation is common in net present value calculations, where
Tim> you use binary search of Newton's method to zero in on the
Tim> correct interest rate given a set of payments. This is terribly
Tim> slow.
It shouldn't be all that slow if you remember that x**i can be done in
O(log2(i)) operations -- not O(i) operations.
paul
More information about the Gcc
mailing list