From 8716ed5ac8dd9e5d6456f9b86e9968ee7ec82a50 Mon Sep 17 00:00:00 2001 From: Greg Haerr Date: Tue, 4 Mar 2025 18:28:45 -0700 Subject: [PATCH] [owc libc] Cleanup math library source a bit --- libc/watcom/math/fmod.c | 4 ---- libc/watcom/{syscall => math}/fpexcept.c | 0 libc/watcom/math/ldexp.c | 3 +-- libc/watcom/math/math2err.c | 1 + libc/watcom/math/mathlib.h | 2 ++ libc/watcom/math/pow.c | 2 -- libc/watcom/math/round.c | 5 +---- libc/watcom/math/sincos.c | 4 +--- 8 files changed, 6 insertions(+), 15 deletions(-) rename libc/watcom/{syscall => math}/fpexcept.c (100%) diff --git a/libc/watcom/math/fmod.c b/libc/watcom/math/fmod.c index ea7ca9d66..2b143bcd9 100644 --- a/libc/watcom/math/fmod.c +++ b/libc/watcom/math/fmod.c @@ -36,10 +36,6 @@ #include //#include "_matherr.h" -#ifdef __ELKS__ -#define __reporterror(a,b,c,d,e) assert(0) -#endif - /* The fmod function computes the floating-point remainder of x/y. It returns x if y is 0, otherwise it returns the value f that has diff --git a/libc/watcom/syscall/fpexcept.c b/libc/watcom/math/fpexcept.c similarity index 100% rename from libc/watcom/syscall/fpexcept.c rename to libc/watcom/math/fpexcept.c diff --git a/libc/watcom/math/ldexp.c b/libc/watcom/math/ldexp.c index d6fc030bc..7fc6b9191 100644 --- a/libc/watcom/math/ldexp.c +++ b/libc/watcom/math/ldexp.c @@ -32,9 +32,8 @@ #include "variety.h" #include - +#include "mathlib.h" //#include "clibsupp.h" -extern void __set_ERANGE( void ); _WMRTLINK double ldexp( double value, int n ) diff --git a/libc/watcom/math/math2err.c b/libc/watcom/math/math2err.c index 374bc31f0..3d3638928 100644 --- a/libc/watcom/math/math2err.c +++ b/libc/watcom/math/math2err.c @@ -49,6 +49,7 @@ _WMRTLINK double __math2err( unsigned int err_info, double *arg1, double *arg2 ) { #ifdef __ELKS__ assert(0); + return 0; #else int why; struct exception exc; diff --git a/libc/watcom/math/mathlib.h b/libc/watcom/math/mathlib.h index f030bc78f..dac079710 100644 --- a/libc/watcom/math/mathlib.h +++ b/libc/watcom/math/mathlib.h @@ -37,6 +37,8 @@ #include "cplx.h" #include "mathcode.h" +#define __reporterror(a,b,c,d,e) assert(0) +extern void __set_ERANGE( void ); #if !defined(_M_IX86) || defined(__FLAT__) typedef double *m_dbl_stk_ptr; diff --git a/libc/watcom/math/pow.c b/libc/watcom/math/pow.c index a100cd174..8be7fa0b3 100644 --- a/libc/watcom/math/pow.c +++ b/libc/watcom/math/pow.c @@ -35,9 +35,7 @@ #include #include "mathlib.h" #include "ifprag.h" - //#include "clibsupp.h" -extern void __set_ERANGE( void ); _WMRTLINK float _IF_pow( float x, float y ) /*****************************************/ diff --git a/libc/watcom/math/round.c b/libc/watcom/math/round.c index 9f87c739f..2f4a28b55 100644 --- a/libc/watcom/math/round.c +++ b/libc/watcom/math/round.c @@ -39,12 +39,9 @@ #include #include "variety.h" #include +#include "mathlib.h" //#include "_matherr.h" -#ifdef __ELKS__ -#define __reporterror(a,b,c,d,e) assert(0) -#endif - _WMRTLINK double round(double x) { double y; diff --git a/libc/watcom/math/sincos.c b/libc/watcom/math/sincos.c index 3f42cf011..db597190e 100644 --- a/libc/watcom/math/sincos.c +++ b/libc/watcom/math/sincos.c @@ -35,10 +35,8 @@ #include "mathlib.h" #include "ifprag.h" //#include "rtdata.h" -#include "pi.h" - //#include "clibsupp.h" -extern void __set_ERANGE( void ); +#include "pi.h" static const double _sinpoly[] = { 1.0 / (2.*3*4*5*6*7*8*9*10*11*12*13*14*15*16*17),