develooper Front page | perl.perl5.porters | Postings from August 2014

[perl #122571] sqrt() and sin() broken in AIX with long doubles

Thread Previous
Jarkko Hietaniemi
August 20, 2014 03:26
[perl #122571] sqrt() and sin() broken in AIX with long doubles
Message ID:
# New Ticket Created by  Jarkko Hietaniemi 
# Please include the string:  [perl #122571]
# in the subject line of all future correspondence about this issue. 
# <URL: >

(haven't been able to yet build a full perl (some weird env set up issues), but looks like AIX 6.1, have been able to buld miniperl)

If I configure with -Duselongdouble, sqrt() and sin() become quite oddly broken: sqrt() returns result twice too high:

./miniperl -le 'print sqrt(2)'

(yeah, yeah, it *is* double the value - get it?)

and sin() returns just weird stuff:


(should be something like 0.841470984807897...)

Now, interestingly all of sin/cos/exp/log/sqrt are implemented by pp_sin (in pp.c).  But only the sqrt/sin seem to be broken, the cos/exp/log are seemingly not.

The plot thickens: the problem seems to be calling the functions (sqrtl, sinl) through function pointers (which is what pp_sin does).  I wrote a C test snippet which calls sqrtl(2.0L) directly, and it returns the expected 1.4142135623731... just fine.

I haven't yet looked into what is sqrtl(), really is, is it a real function with real code in -lm, or something else.

(These basic math functions are tested in t/op/exp.t, and yes, with results like this, the test fails)

So I guess there hasn't been much testing of AIX with long doubles.

Thread Previous Perl Programming lists via nntp and http.
Comments to Ask Bjørn Hansen at | Group listing | About