www.delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp/1995/12/03/12:55:51

Xref: news-dnh.mv.net comp.os.msdos.djgpp:3575
Path: news-dnh.mv.net!mv!news.sprintlink.net!datalytics!news.ahc.ameritech.com!ddsw1!news.mcs.net!van-bc!news.mindlink.net!agate!howland.reston.ans.net!newsfeed.internetmci.com!in1.uu.net!news-m01.ny.us.ibm.net!usenet
From: rrt0136 AT ibm DOT net (Ronald Van Iwaarden)
Newsgroups: comp.os.msdos.djgpp
Subject: Re: Bug in floor/ceil
Date: Sat, 02 Dec 1995 20:15:55 -0500
Organization: Who me organized?
Lines: 20
References: <1995Dec2 DOT 084304 DOT 15106 AT frontier DOT tno DOT nl>
Reply-To: rrt0136 AT ibm DOT net
Nntp-Posting-Host: slip166-72-219-75.ny.us.ibm.net
To: djgpp AT sun DOT soe DOT clarkson DOT edu
Dj-Gateway: from newsgroup comp.os.msdos.djgpp

In article <1995Dec2 DOT 084304 DOT 15106 AT frontier DOT tno DOT nl>,
antwerp AT tpd DOT tno DOT nl (Gert van Antwerpen) wrote:
>Hai folks,
>
>I found a problem in the floor/ceil of the emu386.dxe and libemu.a.
>The following program gives 3 times zero (0)!
>
>#include <math.h>
>
>main()
>{
>   printf("%g\n",floor(.1));
>   printf("%g\n",floor(.5));
>   printf("%g\n",floor(.9));
>}

That is not a bug, floor(x) returns the greatest integer that is less than
or equal to x. It does not round as you appear to believe that it should.

--Ron

- Raw text -


  webmaster     delorie software   privacy  
  Copyright © 2019   by DJ Delorie     Updated Jul 2019