find all multiplicands and multipliers for a number
no.email at nospam.invalid
Mon Apr 13 07:57:50 CEST 2015
Dave Angel <davea at davea.name> writes:
>> if x < 1e9:
> Now 10**9 is way below either limit of floating point.
The idea was just to get rid of the case where c (further down in the
code) ends up being a negative number. Floating point works fine for
numbers that small.
> And I can't figure out your code at this hour of night, but it's much
> more complicated than Newton's method would be anyway.
What I posted is just straightforward arithmetic. I'd expect Newton's
method to be more complicated if you want to bound the error carefully
and make sure it is non-negative. Maybe I'm wrong about that though.
Note my comment "d is between 10 and 11" is slightly inaccurate. d can
in some cases be slightly above 11 but that is fine.
More information about the Python-list