This is the mail archive of the gcc@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: How to determine that 2.0 == (float) 2 in a front-end.


>>>>> "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


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]