Why isn't Python king of the hill?
Grant Edwards
grante at visi.com
Sat Jun 2 17:32:33 EDT 2001
On Sat, 2 Jun 2001 21:28:45 +0000 (UTC), E. Mark Ping <emarkp at CSUA.Berkeley.EDU> wrote:
>>>Checking the difference of the values will yield another large
>>>number, and a method like "IsCloseTo" will incorrectly fail.
>>
>>How can it fail? Either A is within X% of B or it isn't. What's the
>>problem?
>
>But your algorithm didn't specify %, rather you said:
>
> fabs((1.0 + 2.0) - 3.0) < [a small number]
>
>If it were percentage, you'd be adding a division operation too.
>That's getting to be a large amount of overhead.
I did say that choosing the value of [a small number] was left
as an exercies for the reader. In some cases it must be an
absolute value, in other cases relative to the values being
compared -- obviously it depends on the system requirements.
--
Grant Edwards grante Yow! Look into my eyes and
at try to forget that you have
visi.com a Macy's charge card!
More information about the Python-list
mailing list