🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: comp.os.os2.programmer
Article #1212

Re: Whats wrong with floor()?

#1212
From: Ulf Ruthberg
Date: Sun, 23 Aug 1992 13:53
30 lines
1614 bytes
dic5340@hertz.njit.edu (David Charlap) writes:
: In article <2118@lunic.luth.se> ulf@goliat.dc.luth.se (Ulf Ruthberg) writes:
: >If I do the following:
: >
: >double tmp=33433.740234;
: >
: >printf("%f %f",tmp,floor(tmp));
: >
: >I expect the result "33433.740234 33433"
: >but what I get is "33433.740234 33433.740234
: >
: >A bug in GCC or in me?
: 
: Did you remember to #include <math.h>?
: -- 
:    |)  David Charlap           "I don't even represent myself
:   /|_  dic5340@hertz.njit.edu   sometimes so NJIT is right out!.
:  ((|,)
:   ~|~  Hi! I am a .signature virus, copy me into your .signature file.


Yes, math.h is included.
Exactly the same code (Quite a bit more than the above) compiles and give
the expected result when compiled in DOS, Borland C 2.0, and run.
I have tried some other floating manipulations with the same result.

   ===================  Boring signature follows  ==========================
       Ulf Ruthberg, ulf@dc.luth.se, {uunet,mcsun}!sunic!dc.luth.se!ulf
               Computer Service Center, Lule} University.
   ====I'd rather have a bottle in front of me, than a frontal lobotomy.====
Technical Details
Message-ID: <2125@lunic.luth.se>
Path: arc1-ca.pugleaf.net!sparky!uunet!pmafire!news.dell.com!swrinde!gatech!bloom-beacon!eru.mt.luth.se!lunic!goliat.dc.luth.se!ulf
References: <1992Aug21.200819.22295@njitgw.njit.edu>

Show Full Headers
Complete Article Headers
Path: arc1-ca.pugleaf.net!sparky!uunet!pmafire!news.dell.com!swrinde!gatech!bloom-beacon!eru.mt.luth.se!lunic!goliat.dc.luth.se!ulf
From: ulf@goliat.dc.luth.se (Ulf Ruthberg)
Newsgroups: comp.os.os2.programmer
Subject: Re: Whats wrong with floor()?
Message-ID: <2125@lunic.luth.se>
Date: 23 Aug 92 13:53:52 GMT
References: <1992Aug21.200819.22295@njitgw.njit.edu>
Sender: news@luth.se
Lines: 30
Nntp-Posting-Host: goliat.dc.luth.se
X-Newsreader: Tin 1.1 PL3