Project

General

Profile

Actions

Bug #6570

open

Inconsistent behavior and manpages for log(3M), log10(3M), and log2(3M)

Added by Nikita Baksalyar over 5 years ago.

Status:
New
Priority:
Normal
Assignee:
-
Category:
-
Start date:
2016-01-21
Due date:
% Done:

0%

Estimated time:
Difficulty:
Medium
Tags:
needs-triage
Gerrit CR:

Description

man -s 3M log says that

double log(double x)
...
For finite values of x that are less than 0, or if x is -Inf, a domain
error occurs and a NaN is returned.

But if you compile and run the following program:

#include <math.h>
#include <stdio.h>

int main(int argc, char *argv[]) {
  printf("%f\n", log(-13.9));
}

the actual output will be -Inf.
Besides, the same program actually outputs NaN on Linux, so perhaps the implementation of log itself should be changed?

No data to display

Actions

Also available in: Atom PDF