[San-Diego-pm] A puzzler

Mark T. Johnson markj at matzsoft.com
Wed May 3 08:34:41 PDT 2006


>I'm afraid I'm not being much help, but I'm gonna fling some more
>questions, since there's nothing to lose. In the debugger, what's the
>output when you type:
>X ~deltas|local
>
>Are the values for each key exactly the same, or is there something
>funky going on there too? Have you tried the <=> operator for a
>comparison? Are one of those variables a tied variable? You have
>warnings turned on, right? Hope something above helps, but that's all
>I can think of. :-/ Someone else on the list might know more, or if
>you want to wait 'til the meeting Monday, a few minds (that are better
>than mine) can look at it.
>
>David

Hi David,

Thanks for your questions.  They gave me the answer.  The question 
about <=> got me thinking about == and floating point numbers.

   DB<32> x $deltas{retail} <=> $local->{retail}
0  '-1'

   DB<43> x sprintf( "%.15e", $deltas{retail} )
0  '1.999999999999999e+00'
   DB<44> x sprintf( "%.15e", $local->{retail} )
0  '2.000000000000000e+00'

So I am going to have to round the numbers before comparing or use a 
threshold style comparison.

Once again, many thanks.

-- 
--------------------------------------------------------------
Mark T. Johnson
MATZ Software & Consulting
Phone: 858-571-3125
FAX:   858-452-2871


More information about the San-Diego-pm mailing list