NetBSD-Bugs archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

Re: port-alpha/46301: log(3) bugs with positive infinity



On Fri, Apr 06, 2012 at 08:05:01AM +0000, Jukka Ruohonen wrote:
> >Number:         46301
> >Category:       port-alpha
> >Synopsis:       log(3) bugs with positive infinity
> >Confidential:   no
> >Severity:       non-critical
> >Priority:       low
> >Responsible:    port-alpha-maintainer
> >State:          open
> >Class:          sw-bug
> >Submitter-Id:   net
> >Arrival-Date:   Fri Apr 06 08:05:00 +0000 2012
> >Originator:     Jukka Ruohonen
> >Release:        NetBSD 6.0_BETA
> >Organization:
> -
> >Environment:
> >Description:
> 
> If a value is +Inf, log10f(3), log1pf(3), log2f(3), and logf(3) should
> return +Inf. But this is not the case with Alpha.

Looks like a compiler issue. The testcases fail when compiled with -O2
and succeed without.

I can reproduce the very same behaviour with the following sample code
outside ATF. Both values seems correct, that's the comparison which
fails.

njoly@thanos [tmp/logf]> cat sample.c
#include <assert.h>
#include <math.h>

int main() {
  const float f = 1.0L / 0.0L;
  assert(isinf(f) != 0);
  assert(isinf(logf(f)) != 0);
  assert(logf(f) == f);
  return 0; }

njoly@thanos [tmp/logf]> cc -mieee -O2 -o sample sample.c -lm
njoly@thanos [tmp/logf]> ./sample; echo $?
assertion "logf(f) == f" failed: file "sample.c", line 8, function "main"
zsh: abort (core dumped)  ./sample
134

njoly@thanos [tmp/logf]> cc -mieee -o sample sample.c -lm
njoly@thanos [tmp/logf]> ./sample; echo $?
0

-- 
Nicolas Joly

Projects and Developments in Bioinformatics
Institut Pasteur, Paris.


Home | Main Index | Thread Index | Old Index