Re: Comparing rationals/floats

2005-04-16 Thread Larry Wall
On Fri, Apr 15, 2005 at 04:18:51PM -0700, gcomnz wrote: : More questions stemming from cookbook work... Decimal Comparisons: : : The most common recipe around for comparisons is to use sprintf to cut : the decimals to size and then compare strings. Seems ugly. Certainly, but I don't think the

Comparing rationals/floats

2005-04-15 Thread gcomnz
More questions stemming from cookbook work... Decimal Comparisons: The most common recipe around for comparisons is to use sprintf to cut the decimals to size and then compare strings. Seems ugly. The non-stringification way to do it is usually along the lines of: if (abs($value1 - $value2)

Re: Comparing rationals/floats

2005-04-15 Thread Doug McNutt
At 16:18 -0700 4/15/05, gcomnz wrote: More questions stemming from cookbook work... Decimal Comparisons: The most common recipe around for comparisons is to use sprintf to cut the decimals to size and then compare strings. Seems ugly. The non-stringification way to do it is usually along the