Bugzilla will be upgraded to version 5.0 on a still to be determined date in the near future. The original upgrade date has been delayed.
Bug 67216 - round function does not work
round function does not work
Product: Red Hat Linux
Classification: Retired
Component: gcc (Show other bugs)
i586 Linux
medium Severity medium
: ---
: ---
Assigned To: Jakub Jelinek
Brian Brock
Depends On:
  Show dependency treegraph
Reported: 2002-06-21 00:08 EDT by Peter Hite
Modified: 2007-04-18 12:43 EDT (History)
0 users

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

Attachments (Terms of Use)

  None (edit)
Description Peter Hite 2002-06-21 00:08:41 EDT
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 would be 0*/

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

How reproducible:

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

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

Additional info:
Comment 1 Jakub Jelinek 2002-06-21 05:17:01 EDT
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 09:27:53 EDT
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.