For Programmers: Free Programming Magazines  


Home > Archive > C > April 2004 > Re: Wrong results when comparing negative double variables in an if statement









You are viewing an archived Text-only version of the thread. To view this thread in it's original format and/or if you want to reply to this thread please [click here]

 

Author Re: Wrong results when comparing negative double variables in an if statement
John

2004-04-27, 5:45 am

Eric Sosman <Eric.Sosman@sun.com> wrote in message news:<408D2650.846D7F9A@sun.com>...
> John wrote:
>
> You have just discovered that a screwdriver is not a
> claw hammer, which is useful knowledge. You have decided
> therefore to drive screws with your hammer, which is a sub-
> optimal response ...


That's a good analogy, but it's how the desktop calculators and
checkout cash registers do it. The decimal point is never typed in
although it appears on the receipt and the display in its fixed
position. I only need two decimal places so I think the hammer will
suffice. :)
Villy Kruse

2004-04-28, 4:30 am

On 27 Apr 2004 01:44:51 -0700,
John <olongdomango@hotmail.com> wrote:


> Eric Sosman <Eric.Sosman@sun.com> wrote in message news:<408D2650.846D7F9A@sun.com>...
>
> That's a good analogy, but it's how the desktop calculators and
> checkout cash registers do it. The decimal point is never typed in
> although it appears on the receipt and the display in its fixed
> position. I only need two decimal places so I think the hammer will
> suffice. :)


The cash register works in fixed point decimal, a common data type seen
in COBOL but not normaly supported by the C language. I do beleive
that the decimal point *is* typed in when using those machines, at least
on general purpose adding machines.


Villy
Sponsored Links







Also available: Server administration forum archive | Web Design forum archive | Software forum archive | Hardware reviews archive

Copyright 2008 codecomments.com