Red Hat axp-list: Linux on Alpha (1995-2022)
 help / color / mirror / Atom feed
* log(-1) raises SIGFPE
@ 1997-05-09 14:34 Zarmfab Software Development
  1997-05-09 15:19 ` Richard Henderson
  0 siblings, 1 reply; 6+ messages in thread
From: Zarmfab Software Development @ 1997-05-09 14:34 UTC (permalink / raw)


Running the tcl test-suite, i found undefined mathematical operations like log(-1) always
generate SIGFPE at my avanti. Looking inside the log() function, if found that log(x) for all
x < 0 executes the following:

static double zero   =  0.0;
return (x-x)/zero;

This should result in NaN, but it doesn't. Instead, the division by zero raises SIGFPE.
Surprisingly, leaving the generation of NaN's or infinite values to the compiler works:

isnan(0.0/0.0) returns 1 and isinf(1.0/0.0) returns 1, as expected.

Does the alpha's FPU not support infinities and NaN's ? 

-- 
Martin Cornelius, ZARMFAB software development, University of Bremen
phone: 49-421-218-4807    FAX: 49-421-218-3889
email: fabsoft@zarm.uni-bremen.de
paper-mail: Hochschulring / Am Fallturm, 28359 BREMEN, Germany

--
To unsubscribe: send e-mail to axp-list-request@redhat.com with
'unsubscribe' as the subject.  Do not send it to axp-list@redhat.com

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: log(-1) raises SIGFPE
  1997-05-09 14:34 log(-1) raises SIGFPE Zarmfab Software Development
@ 1997-05-09 15:19 ` Richard Henderson
  0 siblings, 0 replies; 6+ messages in thread
From: Richard Henderson @ 1997-05-09 15:19 UTC (permalink / raw)


> Does the alpha's FPU not support infinities and NaN's ? 

Not directly.  You must compile with -mieee to get them which
turns on software completion.  Incidentally, libm must be 
built with -mieee as well in this case.

I'm thinking of making some changes to ld to change the library
search algorithm when -mieee or similar is present.  And making
glibc build libm.{a,so} and libm_ieee.{a,so}.

I've been mulling this problem over for several months and this
is the only solution I can see that is workable.

r~

--
To unsubscribe: send e-mail to axp-list-request@redhat.com with
'unsubscribe' as the subject.  Do not send it to axp-list@redhat.com

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: log(-1) raises SIGFPE
       [not found] <richard@stommel.tamu.edu>
@ 1997-05-09 16:28 ` Zarmfab Software Development
  0 siblings, 0 replies; 6+ messages in thread
From: Zarmfab Software Development @ 1997-05-09 16:28 UTC (permalink / raw)


On May 9, 10:19am, Richard Henderson wrote:
> Subject: Re: log(-1) raises SIGFPE
> Not directly.  You must compile with -mieee to get them which
> turns on software completion.  Incidentally, libm must be 
> built with -mieee as well in this case.
>-- End of excerpt from Richard Henderson

well, i made a libm_ieee.a with -mieee and rebuilt my little test, also with -mieee. 
Now, log(-1) returns NaN, but:
double r=0.0;x=1/r;
still results in x=0, and isinf(x) returns 0.

both 'illegal' operations still raise SIGFPE.

-- 
Martin Cornelius, ZARMFAB software development, University of Bremen
phone: 49-421-218-4807    FAX: 49-421-218-3889
email: fabsoft@zarm.uni-bremen.de
paper-mail: Hochschulring / Am Fallturm, 28359 BREMEN, Germany

--
To unsubscribe: send e-mail to axp-list-request@redhat.com with
'unsubscribe' as the subject.  Do not send it to axp-list@redhat.com

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: log(-1) raises SIGFPE
       [not found] <199705091519.KAA30572@stommel.tamu.edu>
@ 1997-05-12 19:09 ` Carlos Alberto Carvalho
  1997-05-14 21:20   ` Richard Henderson
  0 siblings, 1 reply; 6+ messages in thread
From: Carlos Alberto Carvalho @ 1997-05-12 19:09 UTC (permalink / raw)


Richard Henderson (richard@stommel.tamu.edu) wrote on 9 May 1997 10:19:
 >> Does the alpha's FPU not support infinities and NaN's ? 
 >
 >Not directly.  You must compile with -mieee to get them which
 >turns on software completion.  Incidentally, libm must be 
 >built with -mieee as well in this case.
 >
 >I'm thinking of making some changes to ld to change the library
 >search algorithm when -mieee or similar is present.  And making
 >glibc build libm.{a,so} and libm_ieee.{a,so}.
 >
 >I've been mulling this problem over for several months and this
 >is the only solution I can see that is workable.

Why isn't -mieee the default?

Carlos

--
To unsubscribe: send e-mail to axp-list-request@redhat.com with
'unsubscribe' as the subject.  Do not send it to axp-list@redhat.com

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: log(-1) raises SIGFPE
@ 1997-05-13  0:22 Jim Paradis
  0 siblings, 0 replies; 6+ messages in thread
From: Jim Paradis @ 1997-05-13  0:22 UTC (permalink / raw)


Carlos Alberto Carvalho wrote:
> Why isn't -mieee the default?

On Alpha, generating code that complies with the floating-point
exception recovery rules exacts a small but noticeable performance
penalty.  The default is for maximum performance, and you have to
*ask* to sacrifice a little performance for correctness...

-- 
Jim Paradis   jrp@jrp.tiac.net  
http://www.tiac.net/users/jrp/index.html
"It's not procrastination, it's my new Just-In-Time Workload Management
System!"

--
To unsubscribe: send e-mail to axp-list-request@redhat.com with
'unsubscribe' as the subject.  Do not send it to axp-list@redhat.com

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: log(-1) raises SIGFPE
  1997-05-12 19:09 ` Carlos Alberto Carvalho
@ 1997-05-14 21:20   ` Richard Henderson
  0 siblings, 0 replies; 6+ messages in thread
From: Richard Henderson @ 1997-05-14 21:20 UTC (permalink / raw)


> Why isn't -mieee the default?

(A) It isn't for Digital Unix either, so in theory people building
    packages for Alpha know to expect it.

(B) It is a noticable performance hit; the pipeline stalls while
    instructions are determining whether they will fault for 
    software completion.

(C) Not very many programs actually care about non-finite arithmetic.
    Sure, so you give them a NaN, but they can't deal with that any
    better than if you just went ahead and faulted.

    There are exceptions, but that is why -mieee is there as opposed
    to be missing entirely.

r~

--
To unsubscribe: send e-mail to axp-list-request@redhat.com with
'unsubscribe' as the subject.  Do not send it to axp-list@redhat.com

^ permalink raw reply	[flat|nested] 6+ messages in thread

end of thread, other threads:[~1997-05-14 21:20 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
1997-05-09 14:34 log(-1) raises SIGFPE Zarmfab Software Development
1997-05-09 15:19 ` Richard Henderson
     [not found] <richard@stommel.tamu.edu>
1997-05-09 16:28 ` Zarmfab Software Development
     [not found] <199705091519.KAA30572@stommel.tamu.edu>
1997-05-12 19:09 ` Carlos Alberto Carvalho
1997-05-14 21:20   ` Richard Henderson
  -- strict thread matches above, loose matches on Subject: below --
1997-05-13  0:22 Jim Paradis

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox