Bug 67216 - round function does not work
Summary: round function does not work
Status: CLOSED NOTABUG
Alias: None
Product: Red Hat Linux
Classification: Retired
Component: gcc (Show other bugs)
(Show other bugs)
Version: 7.3
Hardware: i586 Linux
medium
medium
Target Milestone: ---
Assignee: Jakub Jelinek
QA Contact: Brian Brock
URL:
Whiteboard:
Keywords:
Depends On:
Blocks:
TreeView+ depends on / blocked
 
Reported: 2002-06-21 04:08 UTC by Peter Hite
Modified: 2007-04-18 16:43 UTC (History)
0 users

Fixed In Version:
Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of:
Environment:
Last Closed: 2002-06-21 04:08:49 UTC
Type: ---
Regression: ---
Mount Type: ---
Documentation: ---
CRM:
Verified Versions:
Category: ---
oVirt Team: ---
RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: ---


Attachments (Terms of Use)

Description Peter Hite 2002-06-21 04:08:41 UTC
From Bugzilla Helper:
User-Agent: Mozilla/4.0 (compatible; MSIE 6.0; Windows 98; Charter B1)

Description of problem:
The round() function (and other similar rounding functions) do not work. (I 
included math.h)

The following gives me a zero result:

double dnum=10.00;
dnum=round(dnum);
/* dnum would be 0*/


Version-Release number of selected component (if applicable):


How reproducible:
Always

Steps to Reproduce:
1.Program above with or without optimization
2.
3.
	

Actual Results:  When using round I get 0, huge numbers or NAN

Additional info:

Comment 1 Jakub Jelinek 2002-06-21 09:17:01 UTC
round(3) is only part of ISO C99, so you need to select that feature
set or language standard when compiling, like:
gcc -std=c99 round.c -lm
gcc -D_ISOC99_SOURCE round.c -lm
gcc -D_GNU_SOURCE round.c -lm

If you compiled the program with -Wall (and without one of the above options),
you'd see what's going on clearly:
warning: implicit declaration of function `round'

See info libc, "Feature Test Macros" chapter.

Comment 2 Peter Hite 2002-06-21 13:27:53 UTC
Thanks, that worked.  Without it, it was stomping all over memory.  Will use 
the -Wall feature from now on.


Note You need to log in before you can comment on or make changes to this bug.