SDL: Revert "Added SDL_nextafter() and SDL_nextafterf()"

From 2e465ae31bd3a8ad2a4b239c4d6ff1e8c57efe65 Mon Sep 17 00:00:00 2001
From: Sam Lantinga <[EMAIL REDACTED]>
Date: Wed, 14 Jun 2023 11:05:10 -0700
Subject: [PATCH] Revert "Added SDL_nextafter() and SDL_nextafterf()"

This reverts commit bc5d074818bfb08b7429d5e6d8ef69215acb408e.

It's not clear that we need these yet, so I'm going to remove them for now.
---
 CMakeLists.txt                                |  6 +-
 VisualC-GDK/SDL/SDL.vcxproj                   |  4 +-
 VisualC-GDK/SDL/SDL.vcxproj.filters           |  8 +-
 VisualC/SDL/SDL.vcxproj                       |  2 -
 VisualC/SDL/SDL.vcxproj.filters               |  6 --
 include/SDL3/SDL_stdinc.h                     |  2 -
 include/build_config/SDL_build_config.h.cmake |  2 -
 .../build_config/SDL_build_config_android.h   |  3 -
 include/build_config/SDL_build_config_ios.h   |  3 -
 include/build_config/SDL_build_config_macos.h |  3 -
 include/build_config/SDL_build_config_winrt.h |  3 -
 src/dynapi/SDL_dynapi.sym                     |  2 -
 src/dynapi/SDL_dynapi_overrides.h             |  2 -
 src/dynapi/SDL_dynapi_procs.h                 |  2 -
 src/libm/math_libm.h                          |  2 -
 src/libm/math_private.h                       |  5 -
 src/libm/s_nextafter.c                        | 71 --------------
 src/libm/s_nextafterf.c                       | 97 -------------------
 src/stdlib/SDL_stdlib.c                       | 81 ++++++++--------
 test/testautomation_math.c                    | 62 ------------
 20 files changed, 47 insertions(+), 319 deletions(-)
 delete mode 100644 src/libm/s_nextafter.c
 delete mode 100644 src/libm/s_nextafterf.c

diff --git a/CMakeLists.txt b/CMakeLists.txt
index 4c03cb68fb1f..5411cab74291 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -1098,7 +1098,7 @@ if(SDL_LIBC)
       set(${_HAVE_H} 1)
     endforeach()
     set(HAVE_SIGNAL_H 1)
-    foreach(_FN abs acos acosf asin asinf atan atan2 atan2f atanf atof atoi bsearch calloc ceil ceilf copysign copysignf cos cosf exp expf fabs fabsf floor floorf fmod fmodf free itoa log log10 log10f logf lround lroundf _ltoa malloc memcmp memcpy memmove memset modf modff nextafter nextafterf pow powf qsort realloc round roundf scalbn scalbnf sin sinf sqrt sqrtf sscanf strchr strcmp _stricmp strlen _strlwr strncmp _strnicmp strrchr _strrev strstr strtod strtol strtoll strtoul _strupr tan tanf trunc truncf _ultoa wcscmp _wcsdup wcsdup _wcsicmp wcslen wcsncmp _wcsnicmp wcsstr wcstol)
+    foreach(_FN abs acos acosf asin asinf atan atan2 atan2f atanf atof atoi bsearch calloc ceil ceilf copysign copysignf cos cosf exp expf fabs fabsf floor floorf fmod fmodf free itoa log log10 log10f logf lround lroundf _ltoa malloc memcmp memcpy memmove memset modf modff pow powf qsort realloc round roundf scalbn scalbnf sin sinf sqrt sqrtf sscanf strchr strcmp _stricmp strlen _strlwr strncmp _strnicmp strrchr _strrev strstr strtod strtol strtoll strtoul _strupr tan tanf trunc truncf _ultoa wcscmp _wcsdup wcsdup _wcsicmp wcslen wcsncmp _wcsnicmp wcsstr wcstol)
       string(TOUPPER ${_FN} _UPPER)
       set(HAVE_${_UPPER} 1)
     endforeach()
@@ -1167,8 +1167,8 @@ if(SDL_LIBC)
     foreach(_FN
               atan atan2 atanf atan2f ceil ceilf copysign copysignf cos cosf
               exp expf fabs fabsf floor floorf fmod fmodf log logf log10 log10f
-              lround lroundf modf modff nextafter nextafterf pow powf round roundf
-              scalbn scalbnf sin sinf sqrt sqrtf tan tanf acos acosf asin asinf trunc truncf)
+              lround lroundf pow powf round roundf scalbn scalbnf sin sinf sqrt
+              sqrtf tan tanf acos acosf asin asinf trunc truncf)
         string(TOUPPER ${_FN} _UPPER)
         set(LIBC_HASVAR "LIBC_HAS_${_UPPER}")
         check_symbol_exists("${_FN}" "math.h" ${LIBC_HASVAR})
diff --git a/VisualC-GDK/SDL/SDL.vcxproj b/VisualC-GDK/SDL/SDL.vcxproj
index 015707e8c828..6d898f98eaa9 100644
--- a/VisualC-GDK/SDL/SDL.vcxproj
+++ b/VisualC-GDK/SDL/SDL.vcxproj
@@ -668,8 +668,6 @@
     <ClCompile Include="..\..\src\libm\s_fabs.c" />
     <ClCompile Include="..\..\src\libm\s_floor.c" />
     <ClCompile Include="..\..\src\libm\s_modf.c" />
-    <ClCompile Include="..\..\src\libm\s_nextafter.c" />
-    <ClCompile Include="..\..\src\libm\s_nextafterf.c" />
     <ClCompile Include="..\..\src\libm\s_scalbn.c" />
     <ClCompile Include="..\..\src\libm\s_sin.c" />
     <ClCompile Include="..\..\src\libm\s_tan.c" />
@@ -787,4 +785,4 @@
   <Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />
   <ImportGroup Label="ExtensionTargets">
   </ImportGroup>
-</Project>
+</Project>
\ No newline at end of file
diff --git a/VisualC-GDK/SDL/SDL.vcxproj.filters b/VisualC-GDK/SDL/SDL.vcxproj.filters
index 821e22eee57d..769c45215ba8 100644
--- a/VisualC-GDK/SDL/SDL.vcxproj.filters
+++ b/VisualC-GDK/SDL/SDL.vcxproj.filters
@@ -985,12 +985,6 @@
     <ClCompile Include="..\..\src\libm\s_modf.c">
       <Filter>libm</Filter>
     </ClCompile>
-    <ClCompile Include="..\..\src\libm\s_nextafter.c">
-      <Filter>libm</Filter>
-    </ClCompile>
-    <ClCompile Include="..\..\src\libm\s_nextafterf.c">
-      <Filter>libm</Filter>
-    </ClCompile>
     <ClCompile Include="..\..\src\libm\s_scalbn.c">
       <Filter>libm</Filter>
     </ClCompile>
@@ -1392,4 +1386,4 @@
   <ItemGroup>
     <ResourceCompile Include="..\..\src\core\windows\version.rc" />
   </ItemGroup>
-</Project>
+</Project>
\ No newline at end of file
diff --git a/VisualC/SDL/SDL.vcxproj b/VisualC/SDL/SDL.vcxproj
index 3235cf4adbed..a111aaeb3359 100644
--- a/VisualC/SDL/SDL.vcxproj
+++ b/VisualC/SDL/SDL.vcxproj
@@ -547,8 +547,6 @@
     <ClCompile Include="..\..\src\libm\s_fabs.c" />
     <ClCompile Include="..\..\src\libm\s_floor.c" />
     <ClCompile Include="..\..\src\libm\s_modf.c" />
-    <ClCompile Include="..\..\src\libm\s_nextafter.c" />
-    <ClCompile Include="..\..\src\libm\s_nextafterf.c" />
     <ClCompile Include="..\..\src\libm\s_scalbn.c" />
     <ClCompile Include="..\..\src\libm\s_sin.c" />
     <ClCompile Include="..\..\src\libm\s_tan.c" />
diff --git a/VisualC/SDL/SDL.vcxproj.filters b/VisualC/SDL/SDL.vcxproj.filters
index 4ef5483e00c8..cb03064bfe91 100644
--- a/VisualC/SDL/SDL.vcxproj.filters
+++ b/VisualC/SDL/SDL.vcxproj.filters
@@ -964,12 +964,6 @@
     <ClCompile Include="..\..\src\libm\s_modf.c">
       <Filter>libm</Filter>
     </ClCompile>
-    <ClCompile Include="..\..\src\libm\s_nextafter.c">
-      <Filter>libm</Filter>
-    </ClCompile>
-    <ClCompile Include="..\..\src\libm\s_nextafterf.c">
-      <Filter>libm</Filter>
-    </ClCompile>
     <ClCompile Include="..\..\src\libm\s_scalbn.c">
       <Filter>libm</Filter>
     </ClCompile>
diff --git a/include/SDL3/SDL_stdinc.h b/include/SDL3/SDL_stdinc.h
index 372a7d683556..bcdfc235ef64 100644
--- a/include/SDL3/SDL_stdinc.h
+++ b/include/SDL3/SDL_stdinc.h
@@ -640,8 +640,6 @@ extern DECLSPEC double SDLCALL SDL_log10(double x);
 extern DECLSPEC float SDLCALL SDL_log10f(float x);
 extern DECLSPEC double SDLCALL SDL_modf(double x, double *y);
 extern DECLSPEC float SDLCALL SDL_modff(float x, float *y);
-extern DECLSPEC double SDLCALL SDL_nextafter(double from, double to);
-extern DECLSPEC float SDLCALL SDL_nextafterf(float from, float to);
 extern DECLSPEC double SDLCALL SDL_pow(double x, double y);
 extern DECLSPEC float SDLCALL SDL_powf(float x, float y);
 extern DECLSPEC double SDLCALL SDL_round(double x);
diff --git a/include/build_config/SDL_build_config.h.cmake b/include/build_config/SDL_build_config.h.cmake
index a23137eab2ea..928360fdd3f5 100644
--- a/include/build_config/SDL_build_config.h.cmake
+++ b/include/build_config/SDL_build_config.h.cmake
@@ -168,8 +168,6 @@
 #cmakedefine HAVE_LROUNDF 1
 #cmakedefine HAVE_MODF 1
 #cmakedefine HAVE_MODFF 1
-#cmakedefine HAVE_NEXTAFTER 1
-#cmakedefine HAVE_NEXTAFTERF 1
 #cmakedefine HAVE_POW 1
 #cmakedefine HAVE_POWF 1
 #cmakedefine HAVE_ROUND 1
diff --git a/include/build_config/SDL_build_config_android.h b/include/build_config/SDL_build_config_android.h
index 83b201eb7817..611205573c0f 100644
--- a/include/build_config/SDL_build_config_android.h
+++ b/include/build_config/SDL_build_config_android.h
@@ -121,9 +121,6 @@
 #define HAVE_LROUND 1
 #define HAVE_LROUNDF 1
 #define HAVE_MODF   1
-#define HAVE_MODFF  1
-#define HAVE_NEXTAFTER  1
-#define HAVE_NEXTAFTERF 1
 #define HAVE_POW    1
 #define HAVE_POWF   1
 #define HAVE_ROUND  1
diff --git a/include/build_config/SDL_build_config_ios.h b/include/build_config/SDL_build_config_ios.h
index 5c48c8e7ecf7..a523a0883c7d 100644
--- a/include/build_config/SDL_build_config_ios.h
+++ b/include/build_config/SDL_build_config_ios.h
@@ -115,9 +115,6 @@
 #define HAVE_LROUND 1
 #define HAVE_LROUNDF 1
 #define HAVE_MODF   1
-#define HAVE_MODFF  1
-#define HAVE_NEXTAFTER  1
-#define HAVE_NEXTAFTERF 1
 #define HAVE_POW    1
 #define HAVE_POWF   1
 #define HAVE_ROUND  1
diff --git a/include/build_config/SDL_build_config_macos.h b/include/build_config/SDL_build_config_macos.h
index b6d18f4279e8..139cd7228901 100644
--- a/include/build_config/SDL_build_config_macos.h
+++ b/include/build_config/SDL_build_config_macos.h
@@ -117,9 +117,6 @@
 #define HAVE_LROUND 1
 #define HAVE_LROUNDF 1
 #define HAVE_MODF   1
-#define HAVE_MODFF  1
-#define HAVE_NEXTAFTER  1
-#define HAVE_NEXTAFTERF 1
 #define HAVE_POW    1
 #define HAVE_POWF   1
 #define HAVE_ROUND  1
diff --git a/include/build_config/SDL_build_config_winrt.h b/include/build_config/SDL_build_config_winrt.h
index ded876529ed5..8623b6e9b86f 100644
--- a/include/build_config/SDL_build_config_winrt.h
+++ b/include/build_config/SDL_build_config_winrt.h
@@ -135,9 +135,6 @@
 #define HAVE_LROUND 1
 #define HAVE_LROUNDF 1
 #define HAVE_MODF   1
-#define HAVE_MODFF  1
-#define HAVE_NEXTAFTER  1
-#define HAVE_NEXTAFTERF 1
 #define HAVE_POW    1
 #define HAVE_POWF   1
 #define HAVE_ROUND 1
diff --git a/src/dynapi/SDL_dynapi.sym b/src/dynapi/SDL_dynapi.sym
index 4f298c950637..d10df5474325 100644
--- a/src/dynapi/SDL_dynapi.sym
+++ b/src/dynapi/SDL_dynapi.sym
@@ -866,8 +866,6 @@ SDL3_0.0.0 {
     SDL_hid_get_report_descriptor;
     SDL_HasWindowSurface;
     SDL_DestroyWindowSurface;
-    SDL_nextafter;
-    SDL_nextafterf;
     # extra symbols go here (don't modify this line)
   local: *;
 };
diff --git a/src/dynapi/SDL_dynapi_overrides.h b/src/dynapi/SDL_dynapi_overrides.h
index 45457485f56d..c3635845fecc 100644
--- a/src/dynapi/SDL_dynapi_overrides.h
+++ b/src/dynapi/SDL_dynapi_overrides.h
@@ -892,5 +892,3 @@
 #define SDL_hid_get_report_descriptor SDL_hid_get_report_descriptor_REAL
 #define SDL_HasWindowSurface SDL_HasWindowSurface_REAL
 #define SDL_DestroyWindowSurface SDL_DestroyWindowSurface_REAL
-#define SDL_nextafter SDL_nextafter_REAL
-#define SDL_nextafterf SDL_nextafterf_REAL
diff --git a/src/dynapi/SDL_dynapi_procs.h b/src/dynapi/SDL_dynapi_procs.h
index 670da7a72357..5bbe6227b32b 100644
--- a/src/dynapi/SDL_dynapi_procs.h
+++ b/src/dynapi/SDL_dynapi_procs.h
@@ -937,5 +937,3 @@ SDL_DYNAPI_PROC(SDL_hid_device_info*,SDL_hid_get_device_info,(SDL_hid_device *a)
 SDL_DYNAPI_PROC(int,SDL_hid_get_report_descriptor,(SDL_hid_device *a, unsigned char *b, size_t c),(a,b,c),return)
 SDL_DYNAPI_PROC(SDL_bool,SDL_HasWindowSurface,(SDL_Window *a),(a),return)
 SDL_DYNAPI_PROC(int,SDL_DestroyWindowSurface,(SDL_Window *a),(a),return)
-SDL_DYNAPI_PROC(double,SDL_nextafter,(double a, double b),(a,b),return)
-SDL_DYNAPI_PROC(float,SDL_nextafterf,(float a, float b),(a,b),return)
diff --git a/src/libm/math_libm.h b/src/libm/math_libm.h
index 76756eeb8f46..510a5c2421e8 100644
--- a/src/libm/math_libm.h
+++ b/src/libm/math_libm.h
@@ -37,8 +37,6 @@ double SDL_uclibc_fmod(double x, double y);
 double SDL_uclibc_log(double x);
 double SDL_uclibc_log10(double x);
 double SDL_uclibc_modf(double x, double *y);
-double SDL_uclibc_nextafter(double from, double to);
-float SDL_uclibc_nextafterf(float from, float to);
 double SDL_uclibc_pow(double x, double y);
 double SDL_uclibc_scalbn(double x, int n);
 double SDL_uclibc_sin(double x);
diff --git a/src/libm/math_private.h b/src/libm/math_private.h
index abcec21c4755..ba5d83468369 100644
--- a/src/libm/math_private.h
+++ b/src/libm/math_private.h
@@ -41,8 +41,6 @@ typedef unsigned int u_int32_t;
 #define __ieee754_log   SDL_uclibc_log
 #define __ieee754_log10 SDL_uclibc_log10
 #define modf            SDL_uclibc_modf
-#define nextafter       SDL_uclibc_nextafter
-#define nextafterf      SDL_uclibc_nextafterf
 #define __ieee754_pow   SDL_uclibc_pow
 #define scalbln         SDL_uclibc_scalbln
 #define scalbn          SDL_uclibc_scalbn
@@ -227,7 +225,4 @@ __ieee754_sqrt(double)
      extern int32_t __kernel_rem_pio2(const double *, double *, int, int, const unsigned int,
                                   const int32_t *) attribute_hidden;
 
-/* FIXME: We don't have a cross-platform implementation of this */
-#define math_force_eval(x)  (void)x
-
 #endif /* _MATH_PRIVATE_H_ */
diff --git a/src/libm/s_nextafter.c b/src/libm/s_nextafter.c
deleted file mode 100644
index 053d3462dd79..000000000000
--- a/src/libm/s_nextafter.c
+++ /dev/null
@@ -1,71 +0,0 @@
-#include "SDL_internal.h"
-/*
- * ====================================================
- * Copyright (C) 1993 by Sun Microsystems, Inc. All rights reserved.
- *
- * Developed at SunPro, a Sun Microsystems, Inc. business.
- * Permission to use, copy, modify, and distribute this
- * software is freely granted, provided that this notice
- * is preserved.
- * ====================================================
- */
-
-/* IEEE functions
- *	nextafter(x,y)
- *	return the next machine floating-point number of x in the
- *	direction toward y.
- *   Special cases:
- */
-
-#include "math.h"
-#include "math_private.h"
-
-double nextafter(double x, double y)
-{
-	int32_t hx,hy,ix,iy;
-	u_int32_t lx,ly;
-
-	EXTRACT_WORDS(hx,lx,x);
-	EXTRACT_WORDS(hy,ly,y);
-	ix = hx&0x7fffffff;		/* |x| */
-	iy = hy&0x7fffffff;		/* |y| */
-
-	if(((ix>=0x7ff00000)&&((ix-0x7ff00000)|lx)!=0) ||   /* x is nan */
-	   ((iy>=0x7ff00000)&&((iy-0x7ff00000)|ly)!=0))     /* y is nan */
-	   return x+y;
-	if(x==y) return y;		/* x=y, return y */
-	if((ix|lx)==0) {			/* x == 0 */
-	    INSERT_WORDS(x,hy&0x80000000,1);	/* return +-minsubnormal */
-	    y = x*x;
-	    if(y==x) return y; else return x;	/* raise underflow flag */
-	}
-	if(hx>=0) {				/* x > 0 */
-	    if(hx>hy||((hx==hy)&&(lx>ly))) {	/* x > y, x -= ulp */
-		if(lx==0) hx -= 1;
-		lx -= 1;
-	    } else {				/* x < y, x += ulp */
-		lx += 1;
-		if(lx==0) hx += 1;
-	    }
-	} else {				/* x < 0 */
-	    if(hy>=0||hx>hy||((hx==hy)&&(lx>ly))){/* x < y, x -= ulp */
-		if(lx==0) hx -= 1;
-		lx -= 1;
-	    } else {				/* x > y, x += ulp */
-		lx += 1;
-		if(lx==0) hx += 1;
-	    }
-	}
-	hy = hx&0x7ff00000;
-	if(hy>=0x7ff00000) return x+x;	/* overflow  */
-	if(hy<0x00100000) {		/* underflow */
-	    y = x*x;
-	    if(y!=x) {		/* raise underflow flag */
-	        INSERT_WORDS(y,hx,lx);
-		return y;
-	    }
-	}
-	INSERT_WORDS(x,hx,lx);
-	return x;
-}
-libm_hidden_def(nextafter)
diff --git a/src/libm/s_nextafterf.c b/src/libm/s_nextafterf.c
deleted file mode 100644
index 98f8f9b7d3af..000000000000
--- a/src/libm/s_nextafterf.c
+++ /dev/null
@@ -1,97 +0,0 @@
-#include "SDL_internal.h"
-/* s_nextafterf.c -- float version of s_nextafter.c.
- * Conversion to float by Ian Lance Taylor, Cygnus Support, ian@cygnus.com.
- */
-
-/*
- * ====================================================
- * Copyright (C) 1993 by Sun Microsystems, Inc. All rights reserved.
- *
- * Developed at SunPro, a Sun Microsystems, Inc. business.
- * Permission to use, copy, modify, and distribute this
- * software is freely granted, provided that this notice
- * is preserved.
- * ====================================================
- */
-
-#include "math.h"
-#include "math_private.h"
-
-float nextafterf(float x, float y)
-{
-	int32_t hx, hy, ix, iy;
-
-	GET_FLOAT_WORD(hx, x);
-	GET_FLOAT_WORD(hy, y);
-	ix = hx & 0x7fffffff;		/* |x| */
-	iy = hy & 0x7fffffff;		/* |y| */
-
-	/* x is nan or y is nan? */
-	if ((ix > 0x7f800000) || (iy > 0x7f800000))
-		return x + y;
-
-	if (x == y)
-		return y;
-
-	if (ix == 0) { /* x == 0? */
-/* glibc 2.4 does not seem to set underflow? */
-/*		float u; */
-		/* return +-minsubnormal */
-		SET_FLOAT_WORD(x, (hy & 0x80000000) | 1);
-/*		u = x * x;     raise underflow flag */
-/*		math_force_eval(u); */
-		return x;
-	}
-
-	if (hx >= 0) { /* x > 0 */
-		if (hx > hy) { /* x > y: x -= ulp */
-			hx -= 1;
-		} else { /* x < y: x += ulp */
-			hx += 1;
-		}
-	} else { /* x < 0 */
-		if (hy >= 0 || hx > hy) { /* x < y: x -= ulp */
-			hx -= 1;
-		} else { /* x > y: x += ulp */
-			hx += 1;
-		}
-	}
-	hy = hx & 0x7f800000;
-	if (hy >= 0x7f800000) {
-		x = x + x; /* overflow */
-		return x; /* overflow */
-	}
-	if (hy < 0x00800000) {
-		float u = x * x; /* underflow */
-		math_force_eval(u); /* raise underflow flag */
-	}
-	SET_FLOAT_WORD(x, hx);
-	return x;
-}
-
-#if 0
-/* "testprog N a b"
- * calculates a = nextafterf(a, b) and prints a as float
- * and as raw bytes; repeats it N times.
- */
-#include <stdio.h>
-#include <stdlib.h>
-#include <math.h>
-int main(int argc, char **argv)
-{
-        int cnt, i;
-        float a, b;
-        cnt = atoi(argv[1]);
-        a = strtod(argv[2], NULL);
-        b = strtod(argv[3], NULL);
-        while (cnt-- > 0) {
-                for (i = 0; i < sizeof(a); i++) {
-                        unsigned char c = ((char*)(&a))[i];
-                        printf("%x%x", (c >> 4), (c & 0xf));
-                }
-                printf(" %f\n", a);
-                a = nextafterf(a, b);
-        }
-        return 0;
-}
-#endif
diff --git a/src/stdlib/SDL_stdlib.c b/src/stdlib/SDL_stdlib.c
index fe9c4d9d3d8c..3924ba1c5a12 100644
--- a/src/stdlib/SDL_stdlib.c
+++ b/src/stdlib/SDL_stdlib.c
@@ -24,7 +24,8 @@
 
 #include "../libm/math_libm.h"
 
-double SDL_atan(double x)
+double
+SDL_atan(double x)
 {
 #ifdef HAVE_ATAN
     return atan(x);
@@ -42,7 +43,8 @@ float SDL_atanf(float x)
 #endif
 }
 
-double SDL_atan2(double y, double x)
+double
+SDL_atan2(double y, double x)
 {
 #ifdef HAVE_ATAN2
     return atan2(y, x);
@@ -60,7 +62,8 @@ float SDL_atan2f(float y, float x)
 #endif
 }
 
-double SDL_acos(double val)
+double
+SDL_acos(double val)
 {
 #ifdef HAVE_ACOS
     return acos(val);
@@ -87,7 +90,8 @@ float SDL_acosf(float val)
 #endif
 }
 
-double SDL_asin(double val)
+double
+SDL_asin(double val)
 {
 #ifdef HAVE_ASIN
     return asin(val);
@@ -111,7 +115,8 @@ float SDL_asinf(float val)
 #endif
 }
 
-double SDL_ceil(double x)
+double
+SDL_ceil(double x)
 {
 #ifdef HAVE_CEIL
     return ceil(x);
@@ -134,7 +139,8 @@ float SDL_ceilf(float x)
 #endif
 }
 
-double SDL_copysign(double x, double y)
+double
+SDL_copysign(double x, double y)
 {
 #ifdef HAVE_COPYSIGN
     return copysign(x, y);
@@ -160,7 +166,8 @@ float SDL_copysignf(float x, float y)
 #endif
 }
 
-double SDL_cos(double x)
+double
+SDL_cos(double x)
 {
 #ifdef HAVE_COS
     return cos(x);
@@ -178,7 +185,8 @@ float SDL_cosf(float x)
 #endif
 }
 
-double SDL_exp(double x)
+double
+SDL_exp(double x)
 {
 #ifdef HAVE_EXP
     return exp(x);
@@ -196,7 +204,8 @@ float SDL_expf(float x)
 #endif
 }
 
-double SDL_fabs(double x)
+double
+SDL_fabs(double x)
 {
 #ifdef HAVE_FABS
     return fabs(x);
@@ -214,7 +223,8 @@ float SDL_fabsf(float x)
 #endif
 }
 
-double SDL_floor(double x)
+double
+SDL_floor(double x)
 {
 #ifdef HAVE_FLOOR
     return floor(x);
@@ -232,7 +242,8 @@ float SDL_floorf(float x)
 #endif
 }
 
-double SDL_trunc(double x)
+double
+SDL_trunc(double x)
 {
 #ifdef HAVE_TRUNC
     return trunc(x);
@@ -254,7 +265,8 @@ float SDL_truncf(float x)
 #endif
 }
 
-double SDL_fmod(double x, double y)
+double
+SDL_fmod(double x, double y)
 {
 #ifdef HAVE_FMOD
     return fmod(x, y);
@@ -272,7 +284,8 @@ float SDL_fmodf(float x, float y)
 #endif
 }
 
-double SDL_log(double x)
+double
+SDL_log(double x)
 {
 #ifdef HAVE_LOG
     return log(x);
@@ -290,7 +303,8 @@ float SDL_logf(float x)
 #endif
 }
 
-double SDL_log10(double x)
+double
+SDL_log10(double x)
 {
 #ifdef HAVE_LOG10
     return log10(x);
@@ -308,7 +322,8 @@ float SDL_log10f(float x)
 #endif
 }
 
-double SDL_modf(double x, double *y)
+double
+SDL_modf(double x, double *y)
 {
 #ifdef HAVE_MODF
     return modf(x, y);
@@ -329,25 +344,8 @@ float SDL_modff(float x, float *y)
 #endif
 }
 
-double SDL_nextafter(double from, double to)
-{
-#ifdef HAVE_NEXTAFTER
-    return nextafter(from, to);
-#else
-    return SDL_uclibc_nextafter(from, to);
-#endif
-}
-
-float SDL_nextafterf(float from, float to)
-{
-#ifdef HAVE_NEXTAFTERF
-    return nextafterf(from, to);
-#else
-    return SDL_uclibc_nextafterf(from, to);
-#endif
-}
-
-double SDL_pow(double x, double y)
+double
+SDL_pow(double x, double y)
 {
 #ifdef HAVE_POW
     return pow(x, y);
@@ -365,7 +363,8 @@ float SDL_powf(float x, float y)
 #endif
 }
 
-double SDL_round(double arg)
+double
+SDL_round(double arg)
 {
 #if defined HAVE_ROUND
     return round(arg);
@@ -405,7 +404,8 @@ long SDL_lroundf(float arg)
 #endif
 }
 
-double SDL_scalbn(double x, int n)
+double
+SDL_scalbn(double x, int n)
 {
 #ifdef HAVE_SCALBN
     return scalbn(x, n);
@@ -429,7 +429,8 @@ float SDL_scalbnf(float x, int n)
 #endif
 }
 
-double SDL_sin(double x)
+double
+SDL_sin(double x)
 {
 #ifdef HAVE_SIN
     return sin(x);
@@ -447,7 +448,8 @@ float SDL_sinf(float x)
 #endif
 }
 
-double SDL_sqrt(double x)
+double
+SDL_sqrt(double x)
 {
 #ifdef HAVE_SQRT
     return sqrt(x);
@@ -465,7 +467,8 @@ float SDL_sqrtf(float x)
 #endif
 }
 
-double SDL_tan(double x)
+double
+SDL_tan(double x)
 {
 #ifdef HAVE_TAN
     return tan(x);
diff --git a/test/testautomation_math.c b/test/testautomation_math.c
index 38344b303f4a..1f92a1d1e334 100644
--- a/test/testautomation_math.c
+++ b/test/testautomation_math.c
@@ -1293,52 +1293,6 @@ modf_baseCases(void *args)
     return TEST_COMPLETED;
 }
 
-/* SDL_nextafter tests functions */
-
-static int
-nextafter_baseCases(void *args)
-{
-    double value, expected;
-
-    value = SDL_nextafter(0.0, 1.0);
-    expected = 4.940656458412e-324;
-    SDLTest_AssertCheck(value == expected,
-                        "nextafter(%f), expected %f, got %f",
-                        0.0, expected, value);
-
-    value = SDL_nextafter(1.0, 2.0);
-    expected = 1.0000000000000002;
-    SDLTest_AssertCheck(value == expected,
-                        "nextafter(%f), expected %f, got %f",
-                        1.0, expected, value);
-
-    return TEST_COMPLETED;
-}
-
-/* SDL_nextafterf tests functions */
-
-static int
-nextafterf_baseCases(void *args)
-{
-    float value, expected;
-
-#if 0 /* Some compilers truncate this to zero */
-    value = SDL_nextafterf(0.0f, 1.0f);
-    expected = 1.401e-45f;
-    SDLTest_AssertCheck(value == expected,
-                        "nextafterf(%f), expected %f, got %f",
-                        0.0, expected, value);
-#endif
-
-    value = SDL_nextafterf(1.0f, 2.0f);
-    expected = 1.00000012f;
-    SDLTest_AssertCheck(value == expected,
-                        "nextafterf(%f), expected %f, got %f",
-                        1.0, expected, value);
-
-    return TEST_COMPLETED;
-}
-
 /* SDL_pow tests functions */
 
 /* Tests with positive and negative infinities as exponents */
@@ -3078,20 +3032,6 @@ static const SDLTest_TestCaseReference modfTestBase = {
     "Checks the base cases", TEST_ENABLED
 };
 
-/* SDL_nextafter test cases */
-
-static const SDLTest_TestCaseReference nextafterTestBase = {
-    (SDLTest_TestCaseFp)nextafter_baseCases, "nextafter_baseCases",
-    "Checks the base cases", TEST_ENABLED
-};
-
-/* SDL_nextafterf test cases */
-
-static const SDLTest_TestCaseReference nextafterfTestBase = {
-    (SDLTest_TestCaseFp)nextafterf_baseCases, "nextafterf_baseCases",
-    "Checks the base cases", TEST_ENABLED
-};
-
 /* SDL_pow test cases */
 
 static const SDLTest_TestCaseReference powTestExpInf1 = {
@@ -3405,8 +3345,6 @@ static const SDLTest_TestCaseReference *mathTests[] = {
 
     &modfTestBase,
 
-    &nextafterTestBase, &nextafterfTestBase,
-
     &powTestExpInf1, &powTestExpInf2, &powTestExpInf3,
     &powTestBaseInf1, &powTestBaseInf2,
     &powTestNan1, &powTestNan2, &powTestNan3, &powTestNan4,