Bug#560026: [PATCH] yorick test2.i fails with "mathlib signals error" on ia64

Thibaut Paumard thibaut at debian.org
Mon Jan 7 15:23:59 UTC 2013


-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA256

Dear Stefan,

thanks for your time. I will check with upstream whether your patch
seems OK to them (to me it looks fine, but I'd rather have it fixed
upstream). I don't think this is grave enough to fix it in wheezy so
close to the release, mostly because the Yorick userbase on ia64 must be
very few. I should be able to provide a backport soon after the release
though.

Kind regards, Thibaut.


Le 06/01/2013 00:18, Stephan Schreiber a écrit :
> found 560026 2.2.02+dfsg-6
> notfound 560026 2.1.05 2.1.05+dfsg+cvs20091202-1
> # these versions are over; I think, nobody wants to patch them anymore
> tags 560026 - help
> tags 560026 + patch
> thanks
>
>
>
> The problem is in the source code file yorick/std0.c, line 1355, in the
function expLoop():
>
> static void expLoop(double *dst, double *src, long n)
> {
> long i;
> for (i=0 ; i<n ; i++) {
> dst[i]= exp(src[i]);
> if (errno) { if (errno==ERANGE && !dst[i]) errno=0; else break; }
> }
> }
>
>
> The function calculates the mathematical exp function for each item of
the src array.
> One item is -744.668 (IEEE754 representation C08745590D710CC1) when the
test runs. The exp() function sets errno to 34 (ERANGE) upon that and
returns the IEEE754 representation 0000000000000001. This is around
4.94066E-324, a denormalized value; means underflow.
>
> As you see above, the idea of the expLoop() code is to commute a result
to 0 if exp() returns an underflow upon (large) negative exponents.
>
> Unfortunately it doesn't work for the example since the check for a
result of 0 - the
> !dst[i]
> evaluates to 0 (false).
> Since errno isn't 0 after that, the yorick interpreter stops the
execution of the script and reports the seen error message:
> ERROR (escout) mathlib function signals error
> LINE: 251 FILE: /usr/lib/yorick/i/test2.i
> yorick: quitting on error in batch mode
>
> Obviously the floating point arithmetic doesn't behave in the same way
on the different archs in 'subnormal' cases.
> I assume, the exp() function returns denormalized values on ia64 but
round them down to 0 on other archs.
>
> My proposal is to the check the arg of exp() rather than the result in
order to determine whether it is an underflow or not:
> (Note that the pointer dst may be equal to the src pointer.)
>
> static void expLoop(double *dst, double *src, long n)
> {
> long i;
> for (i=0 ; i<n ; i++) {
> double e = src[i];
> dst[i]= exp(e);
> if (errno) { if (errno==ERANGE && e<0.0) errno=0; else break; }
> }
> }
>
> The test does no longer fail, and can be enabled on ia64.
>
> Stephan
>

-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.12 (GNU/Linux)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org/

iQIcBAEBCAAGBQJQ6uiFAAoJEJOUU0jg3ChAMI4P/0SpG7yqReJ+HuE0Opkt4J1O
VjktfM14KGfdcQU+kStCVe8NyZc/j18GfRybQvWK6sT9BEFWZDX5wqjoYVhnrO6+
0nITFogWM+0qhGk/NbMfLN2u3EPI9Jhg8r4XE6rcAlNyD/xm4qAw+CAdDaTOKBj1
hTJveUUra4gE52MDuJiHdHVD6nccvGYD0KGnkP/qf58gPr1UgJADBc2sfBGXa2Eh
ZzS64xq/BuzGYlVdkMESTyHHrWvhq29LZuthEDFcNmEewtIH8mbgtevWFxWp9GxF
P2LfW8EG+PkeqZGo4TSoYJftXPzmytJbFoAv5GDSiIONCTuGz2LrwuGQGIIQEFAX
IBaC70hPUZ30Hub2ipQ5lAJsAA4aO5kjA5k4JAYqrOc79QAHJeHZUXWM1XtdSRL0
Q5OXcz7smcPMkPoIwEvrhg4tZAAw6agCoU5oNmvKFEEsJ581rfIAUbCSNVveLAkl
Za2w4935xOuAmcfCk7cBS8tqf7OJ6vFqqKRz/5fr/84KdZg4QBkRqD0qxdJZRWD3
Sx5CXcIpIM3fDTsFrG/YnVsxScxkj/bJ6A7K18VYVexMCfImXXCP9rW3zhTqOblQ
YfofwmTfR9tWXu+qdTEVc9kpytop+bpliK78X6zim2j+0YXs0J5sT/iqf629Fnkv
mAz97LYAJl0YrJH8yJP3
=LAlW
-----END PGP SIGNATURE-----



More information about the debian-science-maintainers mailing list