🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

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

Re: Whats wrong with floor()?

#857
From: Larry Salomon Jr.
Date: Sun, 16 Aug 1992 16:40
22 lines
1042 bytes
In <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?

This shouldn't have anything to do with it, but %f is for float types.  You
should be using %lf.

Cheers,
Q
-- 
"If you choose not to decide, you  | "A fool and his money are fun to go
 still have made a choice" - Rush  |  out with" - seen on a T-shirt
------------------------------------------------------------------------
Technical Details
Message-ID: <1992Aug16.164006.2345@panix.com>
Path: arc1-ca.pugleaf.net!sparky!uunet!charon.amdahl.com!pacbell.com!mips!swrinde!zaphod.mps.ohio-state.edu!cis.ohio-state.edu!rutgers!cmcl2!panix!os2man
References: <2118@lunic.luth.se>

Show Full Headers
Complete Article Headers
Path: arc1-ca.pugleaf.net!sparky!uunet!charon.amdahl.com!pacbell.com!mips!swrinde!zaphod.mps.ohio-state.edu!cis.ohio-state.edu!rutgers!cmcl2!panix!os2man
From: os2man@panix.com (Larry Salomon Jr.)
Newsgroups: comp.os.os2.programmer
Subject: Re: Whats wrong with floor()?
Message-ID: <1992Aug16.164006.2345@panix.com>
Date: 16 Aug 92 16:40:06 GMT
References: <2118@lunic.luth.se>
Organization: PANIX Public Access Unix, NYC
Lines: 22