diff options
| author | Kristian Evers <kristianevers@gmail.com> | 2018-05-06 17:43:26 +0300 |
|---|---|---|
| committer | Kristian Evers <kristianevers@gmail.com> | 2018-05-08 09:16:07 +0200 |
| commit | 58cbb9fe4f89b9febd780f7bdcfa4c2bb74a723e (patch) | |
| tree | dec50c945b01d09c5cf94d0665a6996e2d34ae5d /src/gie.c | |
| parent | 8fef2126f1c9fa17b79e6669f4457c299c0e33bf (diff) | |
| download | PROJ-58cbb9fe4f89b9febd780f7bdcfa4c2bb74a723e.tar.gz PROJ-58cbb9fe4f89b9febd780f7bdcfa4c2bb74a723e.zip | |
Replace int typecasts with calls to lround to avoid bad conversions on NaN input. Added test to check for those cases.
Diffstat (limited to 'src/gie.c')
| -rw-r--r-- | src/gie.c | 13 |
1 files changed, 13 insertions, 0 deletions
@@ -1942,6 +1942,19 @@ static int cart_selftest (void) { if (P->f != 1.0/298.257223563) return 125; proj_destroy(P); + /* Test that pj_fwd* and pj_inv* returns NaNs when receiving NaN input */ + P = proj_create(PJ_DEFAULT_CTX, "+proj=merc"); + if (0==P) return 0; + a = proj_coord(NAN, NAN, NAN, NAN); + a = proj_trans(P, PJ_FWD, a); + if ( !( isnan(a.v[0]) && isnan(a.v[1]) && isnan(a.v[2]) && isnan(a.v[3]) ) ) + return 126; + a = proj_coord(NAN, NAN, NAN, NAN); + a = proj_trans(P, PJ_INV, a); + if ( !( isnan(a.v[0]) && isnan(a.v[1]) && isnan(a.v[2]) && isnan(a.v[3]) ) ) + return 127; + proj_destroy(P); + return 0; } |
