home *** CD-ROM | disk | FTP | other *** search
- Path: sparky!uunet!mcsun!news.funet.fi!news.cs.tut.fi!pjh
- From: pjh@cs.tut.fi (Haavisto Petri)
- Newsgroups: comp.std.c
- Subject: (long) x and (long) floor(x)
- Date: 14 Dec 1992 12:05:43 GMT
- Organization: Tampere University of Technology
- Lines: 18
- Distribution: world
- Message-ID: <1ghtanINNcf9@cs.tut.fi>
- NNTP-Posting-Host: vuoripyy.cs.tut.fi
-
-
- I just spent several hours debugging a simple program and before
- crying Compiler Bug I would like to make sure that there is one.
-
- I don't have the standard, but it seems clear to me that given an
- expression of type double with a positive value, the following
- should always be true:
-
- (long) (expression) == (long) floor(expression)
-
- Does the standard guarantee this or is there a loop hole that has to
- do with finite precision arithmetic and which allows the compiler to
- do what it chooses?
-
- Petri Haavisto
-
- PS. For those who might be interested, the compiler that caused the
- problems was Microsoft C (version 6.something) for MSDOS.
-