mirror of
https://gitlab.com/embeddable-common-lisp/ecl.git
synced 2026-01-14 13:21:54 -08:00
Added support for the floating point exception FE_INVALID, which is signalled when trying to do 0/0 or sqrt(-1) (A. Gavrilov)
This commit is contained in:
parent
2b7a47bab7
commit
b17e932972
3 changed files with 24 additions and 8 deletions
|
|
@ -35,6 +35,9 @@ ECL 9.5:
|
|||
- New condition EXT:SEGMENTATION-VIOLATION signaled by SIGSEGV and SIGBUS
|
||||
events.
|
||||
|
||||
- Added support for the floating point exception FE_INVALID, which is
|
||||
signalled when trying to do 0/0 or sqrt(-1) (A. Gavrilov)
|
||||
|
||||
* Bugs fixed:
|
||||
|
||||
- Remove an obsolete #if statement for Solaris that broke current builds
|
||||
|
|
|
|||
|
|
@ -233,14 +233,14 @@ handler_fn_protype(lisp_signal_handler, int sig, siginfo_t *info, void *aux)
|
|||
int bits = fetestexcept(FE_ALL_EXCEPT);
|
||||
if (bits & FE_DIVBYZERO)
|
||||
condition = @'division-by-zero';
|
||||
if (bits & FE_OVERFLOW)
|
||||
condition = @'floating-point-overflow';
|
||||
if (bits & FE_UNDERFLOW)
|
||||
condition = @'floating-point-underflow';
|
||||
if (bits & FE_INEXACT)
|
||||
condition = @'floating-point-inexact';
|
||||
if (bits & FE_INVALID)
|
||||
else if (bits & FE_INVALID)
|
||||
condition = @'floating-point-invalid-operation';
|
||||
else if (bits & FE_OVERFLOW)
|
||||
condition = @'floating-point-overflow';
|
||||
else if (bits & FE_UNDERFLOW)
|
||||
condition = @'floating-point-underflow';
|
||||
else if (bits & FE_INEXACT)
|
||||
condition = @'floating-point-inexact';
|
||||
#endif
|
||||
#ifdef SA_SIGINFO
|
||||
if (info) {
|
||||
|
|
@ -250,6 +250,10 @@ handler_fn_protype(lisp_signal_handler, int sig, siginfo_t *info, void *aux)
|
|||
condition = @'floating-point-overflow';
|
||||
if (info->si_code == FPE_FLTUND)
|
||||
condition = @'floating-point-underflow';
|
||||
if (info->si_code == FPE_FLTRES)
|
||||
condition = @'floating-point-inexact';
|
||||
if (info->si_code == FPE_FLTINV)
|
||||
condition = @'floating-point-invalid-operation';
|
||||
}
|
||||
#endif
|
||||
si_trap_fpe(@'last', Ct);
|
||||
|
|
@ -532,6 +536,9 @@ void handle_fpe_signal(int sig, int num)
|
|||
cl_object condition = @'arithmetic-error';
|
||||
|
||||
switch (num) {
|
||||
case _FPE_INVALID:
|
||||
condition = @'floating-point-invalid-operation';
|
||||
break;
|
||||
case _FPE_OVERFLOW:
|
||||
condition = @'floating-point-overflow';
|
||||
break;
|
||||
|
|
@ -571,8 +578,12 @@ si_trap_fpe(cl_object condition, cl_object flag)
|
|||
bits = FE_OVERFLOW;
|
||||
else if (condition == @'floating-point-underflow')
|
||||
bits = FE_UNDERFLOW;
|
||||
else if (condition == @'floating-point-invalid-operation')
|
||||
bits = FE_INVALID;
|
||||
else if (condition == @'floating-point-inexact')
|
||||
bits = FE_INEXACT;
|
||||
else if (condition == Ct)
|
||||
bits = FE_DIVBYZERO | FE_OVERFLOW | FE_UNDERFLOW;
|
||||
bits = FE_DIVBYZERO | FE_OVERFLOW | FE_UNDERFLOW | FE_INVALID;
|
||||
else if (condition == @'last')
|
||||
bits = last_bits;
|
||||
#if defined(_MSC_VER) || defined(mingw32)
|
||||
|
|
|
|||
|
|
@ -315,6 +315,8 @@ extern cl_fixnum ecl_runtime(void);
|
|||
# define FE_DIVBYZERO EM_ZERODIVIDE
|
||||
# define FE_OVERFLOW EM_OVERFLOW
|
||||
# define FE_UNDERFLOW EM_UNDERFLOW
|
||||
# define FE_INVALID EM_INVALID
|
||||
# define FE_INEXACT EM_INEXACT
|
||||
typedef int fenv_t;
|
||||
# else
|
||||
# ifdef _MCW_EM
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue