home *** CD-ROM | disk | FTP | other *** search
/ NetNews Usenet Archive 1992 #30 / NN_1992_30.iso / spool / comp / std / c / 3205 < prev    next >
Encoding:
Text File  |  1992-12-14  |  1.3 KB  |  33 lines

  1. Newsgroups: comp.std.c
  2. 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
  3. From: pal@regent.e-technik.tu-muenchen.dbp.de (Peter Loibl)
  4. Subject: Re: (long) x and (long) floor(x)
  5. Message-ID: <pal.724347812@regent.e-technik.tu-muenchen.de>
  6. Sender: news@regent.e-technik.tu-muenchen.de (News System)
  7. Organization: Technical University of Munich, Germany
  8. References: <1ghtanINNcf9@cs.tut.fi>
  9. Date: Mon, 14 Dec 1992 15:43:32 GMT
  10. Lines: 21
  11.  
  12. pjh@cs.tut.fi (Haavisto Petri) writes:
  13.  
  14. >I just spent several hours debugging a simple program and before
  15. >crying Compiler Bug I would like to make sure that there is one.
  16.  
  17. >I don't have the standard, but it seems clear to me that given an
  18. >expression of type double with a positive value, the following
  19. >should always be true:
  20.  
  21. >        (long) (expression) == (long) floor(expression)
  22.  
  23. >Does the standard guarantee this or is there a loop hole that has to
  24. >do with finite precision arithmetic and which allows the compiler to
  25. >do what it chooses?
  26.  
  27. I don't have the standard at hand right now, but
  28.         (long) (expression) == (long) floor((double)expression)
  29. should be true.                              ^^^^^^
  30.  
  31. Peter Loibl
  32. pal@regent.e-technik.tu-muenchen.de
  33.