Bug 34631 - libm log2() call returning always 0.000
Summary: libm log2() call returning always 0.000
Alias: None
Product: Red Hat Linux
Classification: Retired
Component: glibc   
(Show other bugs)
Version: 7.1
Hardware: i386 Linux
Target Milestone: ---
Assignee: Jakub Jelinek
QA Contact: Aaron Brown
Depends On:
TreeView+ depends on / blocked
Reported: 2001-04-04 07:52 UTC by Phil Knirsch
Modified: 2016-11-24 12:22 UTC (History)
2 users (show)

Fixed In Version:
Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of:
Last Closed: 2001-04-04 07:54:21 UTC
Type: ---
Regression: ---
Mount Type: ---
Documentation: ---
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 07:53 UTC, Phil Knirsch
no flags Details
Correct log2() implementation (187 bytes, text/plain)
2001-04-04 07:54 UTC, Phil Knirsch
no flags Details

Description Phil Knirsch 2001-04-04 07:52:34 UTC
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

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

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 07:53:29 UTC
Created attachment 14583 [details]
log2() test program

Comment 2 Phil Knirsch 2001-04-04 07:54:18 UTC
Created attachment 14584 [details]
Correct log2() implementation

Comment 3 Jakub Jelinek 2001-04-04 08:24:07 UTC
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.