bug-gnulib
[Top][All Lists]
Advanced

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

How to force using a module in Gnulib? (expl() on OpenBSD)


From: Assaf Gordon
Subject: How to force using a module in Gnulib? (expl() on OpenBSD)
Date: Mon, 14 Apr 2014 19:54:06 -0400
User-agent: Mozilla/5.0 (X11; Linux i686 on x86_64; rv:24.0) Gecko/20100101 Thunderbird/24.2.0

Hello,

How do I force using the GnuLib implementation of a module, despite the 
platform having the function ?

Case in point:
It seems "expl()" is broken on OpenBSD5.4.

Others have noticed the same:
http://openbsd.7691.n7.nabble.com/exp-expl-on-Linux-and-OpenBSD-expl-bug-td242556.html

But a simple test-case is:
======
$ cat 1.c
#include <math.h>
#include <stdio.h>
#include <stdlib.h>

int main()
{
  const long double x = 0.705084 ;
  const long double x2 = -x/2;
  const long double e = exp(x2);
  const long double el = expl(x2);
  printf("x = %Lg\n", x);
  printf("-x/2 = %Lg\n", x2);
  printf("exp(-x/2) = %Lg\n", e);
  printf("expl(-x/2) = %Lg\n", el);
  return 0;
}
$ cc -O2 -pipe   -lm -o 1 1.c
$ ./1
x = 0.705084
-x/2 = -0.352542
exp(-x/2) = 0.702899
expl(-x/2) = nan
========

Notice "expl" returns "nan", whereas every other system I've tried returns the correct value of 
"0.702" instead of "nan" .

The system is
=====
$ uname -a
OpenBSD obsd.my.domain 5.4 GENERIC#37 amd64
$ cc --version
cc (GCC) 4.2.1 20070719
=====

In my project, the "expl" module from Gnulib is included in the distribution, but during 
"configure" it is determined that it is not needed,
and it is not compiled.

How can I override that ?

Thank you,
 -gordon



reply via email to

[Prev in Thread] Current Thread [Next in Thread]