Replace <math.h> with <tgmath.h> throughout

C89 provided only double-precision mathematical functions (sin() etc),
and so despite using single-precision elsewhere, those are what Puzzles
has traditionally used.  C99 introduced single-precision equivalents
(sinf() etc), and I hope it's been long enough that we can safely use
them.  Maybe they'll even be faster.

Rather than directly use the single-precision functions, though, we use
the magic macros from <tgmath.h> that automatically choose the precision
of mathematical functions based on their arguments.  This has the
advantage that we only need to change which header we include, and thus
that we can switch back again if some platform has trouble with the new
header.
This commit is contained in:
Ben Harris
2023-04-04 21:43:25 +01:00
parent 4fcc1ea601
commit 2e48ce132e
55 changed files with 55 additions and 55 deletions

View File

@ -73,7 +73,7 @@
#include <assert.h>
#include <ctype.h>
#include <limits.h>
#include <math.h>
#include <tgmath.h>
#include "puzzles.h"