aboutsummaryrefslogtreecommitdiff
path: root/src/PJ_robin.c
diff options
context:
space:
mode:
authorKurt Schwehr <schwehr@google.com>2018-03-22 09:06:03 -0700
committerKurt Schwehr <schwehr@google.com>2018-03-22 09:06:03 -0700
commitec494f12d10412d389733a196ec58a4d0c4beffa (patch)
tree18c14fc778dc65d0272535a0576ee0cb068a6f36 /src/PJ_robin.c
parent3c59dad1b6502963bfc8ee74700101f631d3e302 (diff)
downloadPROJ-ec494f12d10412d389733a196ec58a4d0c4beffa.tar.gz
PROJ-ec494f12d10412d389733a196ec58a4d0c4beffa.zip
Handle nan float cast overflow in PJ_robin.c and nad_intr.c
Uses the new pj_is_nan to avoid x == x checks. Removes an assignment from an arg list
Diffstat (limited to 'src/PJ_robin.c')
-rw-r--r--src/PJ_robin.c6
1 files changed, 4 insertions, 2 deletions
diff --git a/src/PJ_robin.c b/src/PJ_robin.c
index 7514b325..92aebfd3 100644
--- a/src/PJ_robin.c
+++ b/src/PJ_robin.c
@@ -1,4 +1,5 @@
#define PJ_LIB__
+#include "proj_internal.h"
#include "proj.h"
#include "projects.h"
@@ -80,7 +81,8 @@ static XY s_forward (LP lp, PJ *P) { /* Spheroidal, forward */
double dphi;
(void) P;
- i = (int)floor((dphi = fabs(lp.phi)) * C1);
+ dphi = fabs(lp.phi);
+ i = pj_is_nan(lp.phi) ? -1 : (int)floor(dphi * C1);
if( i < 0 ){
proj_errno_set(P, PJD_ERR_TOLERANCE_CONDITION);
return xy;
@@ -115,7 +117,7 @@ static LP s_inverse (XY xy, PJ *P) { /* Spheroidal, inverse */
}
} else { /* general problem */
/* in Y space, reduce to table interval */
- i = (int)floor(lp.phi * NODES);
+ i = pj_is_nan(lp.phi) ? -1 : (int)floor(lp.phi * NODES);
if( i < 0 || i >= NODES ) {
proj_errno_set(P, PJD_ERR_TOLERANCE_CONDITION);
return lp;