diff options
author | Mattias Andrée <m@maandree.se> | 2024-10-22 22:22:41 +0200 |
---|---|---|
committer | Mattias Andrée <m@maandree.se> | 2024-10-22 22:22:41 +0200 |
commit | bb5de3aa2ee118df78f0347cffd4e58f846dc1fb (patch) | |
tree | b313a20b79d67f35a5e4e05bc9106b22dc17f451 /libtellurian_azimuth_radians.c | |
parent | ... (diff) | |
download | libtellurian-bb5de3aa2ee118df78f0347cffd4e58f846dc1fb.tar.gz libtellurian-bb5de3aa2ee118df78f0347cffd4e58f846dc1fb.tar.bz2 libtellurian-bb5de3aa2ee118df78f0347cffd4e58f846dc1fb.tar.xz |
Signed-off-by: Mattias Andrée <m@maandree.se>
Diffstat (limited to '')
-rw-r--r-- | libtellurian_azimuth_radians.c | 17 |
1 files changed, 11 insertions, 6 deletions
diff --git a/libtellurian_azimuth_radians.c b/libtellurian_azimuth_radians.c index 18c954e..469eb45 100644 --- a/libtellurian_azimuth_radians.c +++ b/libtellurian_azimuth_radians.c @@ -17,9 +17,16 @@ libtellurian_azimuth_radians(double latitude1, double longitude1, #else -#if 1 -TODO_TEST -#else +static int +eq(double a, double b) +{ + if (isfinite(a) && isfinite(b)) + return a == b; + if (isnan(a) && isnan(b)) + return 1; + printf("Unexpected floating-point class\n"); + return 0; +} static int check(double a, double b, double c, double d) @@ -34,7 +41,7 @@ check(double a, double b, double c, double d) libtellurian_azimuth_radians(a, b, c, d, &az1b, NULL); libtellurian_azimuth_radians(a, b, c, d, NULL, &az2b); libtellurian_azimuth_radians(a, b, c, d, NULL, NULL); - return az1 == az1_ref && az2 == az2_ref && az1 == az1b && az2 == az2b; + return eq(az1, az1_ref) && eq(az2, az2_ref) && eq(az1, az1b) && eq(az2, az2b); } int @@ -49,7 +56,5 @@ main(void) return 0; } -#endif - #endif |