@@ -1018,26 +1018,40 @@ Transformation::nonlinear_only_numerix(const Py::Tuple & args, const Py::Dict &k
1018
1018
1019
1019
double thisx = *(double *)(x->data + i*x->strides [0 ]);
1020
1020
double thisy = *(double *)(y->data + i*y->strides [0 ]);
1021
- try {
1022
- this ->nonlinear_only_api (&thisx, &thisy);
1023
- }
1024
- catch (...) {
1025
-
1021
+ if (MPL_isnan64 (thisx) || MPL_isnan64 (thisy)) {
1026
1022
if (returnMask) {
1027
1023
*(unsigned char *)(retmask->data + i*retmask->strides [0 ]) = 0 ;
1028
- *(double *)(retx->data + i*retx->strides [0 ]) = 0.0 ;
1029
- *(double *)(rety->data + i*rety->strides [0 ]) = 0.0 ;
1030
- continue ;
1031
1024
}
1032
- else {
1033
- throw Py::ValueError (" Domain error on this->nonlinear_only_api(&thisx, &thisy) in Transformation::nonlinear_only_numerix" );
1025
+ double MPLnan; // don't require C99 math features - find our own nan
1026
+ if (MPL_isnan64 (thisx)) {
1027
+ MPLnan=thisx;
1028
+ } else {
1029
+ MPLnan=thisy;
1030
+ }
1031
+ *(double *)(retx->data + i*retx->strides [0 ]) = MPLnan;
1032
+ *(double *)(rety->data + i*rety->strides [0 ]) = MPLnan;
1033
+ } else {
1034
+ try {
1035
+ this ->nonlinear_only_api (&thisx, &thisy);
1036
+ }
1037
+ catch (...) {
1038
+
1039
+ if (returnMask) {
1040
+ *(unsigned char *)(retmask->data + i*retmask->strides [0 ]) = 0 ;
1041
+ *(double *)(retx->data + i*retx->strides [0 ]) = 0.0 ;
1042
+ *(double *)(rety->data + i*rety->strides [0 ]) = 0.0 ;
1043
+ continue ;
1044
+ }
1045
+ else {
1046
+ throw Py::ValueError (" Domain error on this->nonlinear_only_api(&thisx, &thisy) in Transformation::nonlinear_only_numerix" );
1047
+ }
1034
1048
}
1035
- }
1036
1049
1037
- *(double *)(retx->data + i*retx->strides [0 ]) = thisx;
1038
- *(double *)(rety->data + i*rety->strides [0 ]) = thisy;
1039
- if (returnMask) {
1040
- *(unsigned char *)(retmask->data + i*retmask->strides [0 ]) = 1 ;
1050
+ *(double *)(retx->data + i*retx->strides [0 ]) = thisx;
1051
+ *(double *)(rety->data + i*rety->strides [0 ]) = thisy;
1052
+ if (returnMask) {
1053
+ *(unsigned char *)(retmask->data + i*retmask->strides [0 ]) = 1 ;
1054
+ }
1041
1055
}
1042
1056
1043
1057
}
0 commit comments