home *** CD-ROM | disk | FTP | other *** search
- Newsgroups: comp.std.c
- Path: sparky!uunet!zaphod.mps.ohio-state.edu!cs.utexas.edu!qt.cs.utexas.edu!yale.edu!ira.uka.de!math.fu-berlin.de!informatik.tu-muenchen.de!lrz-muenchen.de!regent!pal
- From: pal@regent.e-technik.tu-muenchen.dbp.de (Peter Loibl)
- Subject: Re: (long) x and (long) floor(x)
- Message-ID: <pal.724347812@regent.e-technik.tu-muenchen.de>
- Sender: news@regent.e-technik.tu-muenchen.de (News System)
- Organization: Technical University of Munich, Germany
- References: <1ghtanINNcf9@cs.tut.fi>
- Date: Mon, 14 Dec 1992 15:43:32 GMT
- Lines: 21
-
- pjh@cs.tut.fi (Haavisto Petri) writes:
-
- >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?
-
- I don't have the standard at hand right now, but
- (long) (expression) == (long) floor((double)expression)
- should be true. ^^^^^^
-
- Peter Loibl
- pal@regent.e-technik.tu-muenchen.de
-