Bug 34631 - libm log2() call returning always 0.000
libm log2() call returning always 0.000
Status: CLOSED NOTABUG
Product: Red Hat Linux
Classification: Retired
Component: glibc (Show other bugs)
7.1
i386 Linux
high Severity high
: ---
: ---
Assigned To: Jakub Jelinek
Aaron Brown
:
Depends On:
Blocks:
  Show dependency treegraph
 
Reported: 2001-04-04 03:52 EDT by Phil Knirsch
Modified: 2015-03-04 20:09 EST (History)
1 user (show)

See Also:
Fixed In Version:
Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of:
Environment:
Last Closed: 2001-04-04 03:54:21 EDT
Type: ---
Regression: ---
Mount Type: ---
Documentation: ---
CRM:
Verified Versions:
Category: ---
oVirt Team: ---
RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: ---


Attachments (Terms of Use)
log2() test program (259 bytes, text/plain)
2001-04-04 03:53 EDT, Phil Knirsch
no flags Details
Correct log2() implementation (187 bytes, text/plain)
2001-04-04 03:54 EDT, Phil Knirsch
no flags Details

  None (edit)
Description Phil Knirsch 2001-04-04 03:52:34 EDT
From Bugzilla Helper:
User-Agent: Mozilla/4.76 [de] (X11; U; Linux 2.4.2-0.1.49 i686)


After double checking with a simple testprogram i discovered that the
log2() call in libm (which is part of glibc) always returns 0.000 for any
input.

Reproducible: Always
Steps to Reproduce:
1. Write a simple program to calculate log2()
2. Check returned value
3.
	

Actual Results:  log2() return 0.0000

Expected Results:  log2() should have returned the expected mathematical
results of the logarithmus on base 2.
Comment 1 Phil Knirsch 2001-04-04 03:53:29 EDT
Created attachment 14583 [details]
log2() test program
Comment 2 Phil Knirsch 2001-04-04 03:54:18 EDT
Created attachment 14584 [details]
Correct log2() implementation
Comment 3 Jakub Jelinek 2001-04-04 04:24:07 EDT
I guess you forgot to use either -std=c99 or -D_ISOC99_SOURCE on the gcc
command line (or -D_GNU_SOURCE).
log2() is a ISO C99 standard function or part of GNU extensions.
Glibc supports many standards and needs to keep namespace clean.
If you compiled your testcase with -Wall, you'd see warning about implicit
declaration of log2 (and as implicit prototype is returning int, there is no
wonder you get wrong results).

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