Re: division by zero mystery
- From: "user923005" <dcorbit@xxxxxxxxx>
- Date: 29 Dec 2006 11:46:27 -0800
CBFalconer wrote:
Or the FP unit can return +-INF for the division operation, and the
atan routine can recognize that and return the appropriate value.
Not luck, just QOI.
If with a,b we can obviously have 4 different sign states for a,b but
only two after the division. So what quadrant did the angle occur in?
This also matters for +/-INF because we can have {for example}
DBLE_MAX/DBLE_MIN or -DBLE_MAX/-DBLE_MIN which produce the same thing
(+INF) but for which the angle represented should be different.
Trapping is possible for floating point exceptions according to the C
standard:
"H.3.1.2 Traps
1 C is compatible with LIA-1's trap requirements for arithmetic
operations, but not for math library functions (which are not permitted
to generate any externally visible exceptional conditions). An
implementation can provide an alternative of notification through
termination with a ''hard-to-ignore'' message (see LIA-1
subclause 6.1.3).
2 LIA-1 does not require that traps be precise.
3 C does require that SIGFPE be the signal corresponding to arithmetic
exceptions, if there is any signal raised for them.
4 C supports signal handlers for SIGFPE and allows trapping of
arithmetic exceptions. When arithmetic exceptions do trap, C's
signal-handler mechanism allows trap-andterminate (either default
implementation behavior or user replacement for it) or trap-andresume,
at the programmer's option."
.
- Follow-Ups:
- Re: division by zero mystery
- From: CBFalconer
- Re: division by zero mystery
- References:
- division by zero mystery
- From: John Smith
- Re: division by zero mystery
- From: user923005
- Re: division by zero mystery
- From: CBFalconer
- division by zero mystery
- Prev by Date: Worst case execution time problem
- Next by Date: Re: Worst case execution time problem
- Previous by thread: Re: division by zero mystery
- Next by thread: Re: division by zero mystery
- Index(es):
Relevant Pages
|