From f0a6c6757a795b8e186de0076836a87acef59fa7 Mon Sep 17 00:00:00 2001 From: Cliff Click Date: Sun, 15 Nov 2026 11:20:40 -0800 Subject: Graphics now allow resize Reorganize docs. Fix bugs X86 LOad+cmp scheduling. Math intrinsics --- chapter31/src/main/c/simple_crt.c | 10 ++++++++++ 1 file changed, 10 insertions(+) (limited to 'chapter31/src/main/c/simple_crt.c') diff --git a/chapter31/src/main/c/simple_crt.c b/chapter31/src/main/c/simple_crt.c index 39708629..e50042c2 100644 --- a/chapter31/src/main/c/simple_crt.c +++ b/chapter31/src/main/c/simple_crt.c @@ -3,6 +3,7 @@ #include #include #include +#include #include #include @@ -19,6 +20,15 @@ double simple_f64_from_bits(int64_t bits) { return value; } +// Floating remainder's machine instruction uses this memory-preserving helper. +double simple_f64_mod(double x, double y) { + // fmod can set errno for NaN-producing inputs; arithmetic leaves it alone. + int saved_errno = errno; + double result = fmod(x, y); + errno = saved_errno; + return result; +} + // errno may be thread-local or a macro calling a platform accessor. int32_t simple_errno(void) { return errno; } int32_t simple_set_errno(int32_t error) { errno = error; return -1; } -- cgit v1.2.3