| 3796 | |
| 3797 | |
| 3798 | SWIGINTERNINLINE int |
| 3799 | SWIG_CanCastAsInteger(double *d, double min, double max) { |
| 3800 | double x = *d; |
| 3801 | if ((min <= x && x <= max)) { |
| 3802 | double fx = floor(x); |
| 3803 | double cx = ceil(x); |
| 3804 | double rd = ((x - fx) < 0.5) ? fx : cx; /* simple rint */ |
| 3805 | if ((errno == EDOM) || (errno == ERANGE)) { |
| 3806 | errno = 0; |
| 3807 | } else { |
| 3808 | double summ, reps, diff; |
| 3809 | if (rd < x) { |
| 3810 | diff = x - rd; |
| 3811 | } else if (rd > x) { |
| 3812 | diff = rd - x; |
| 3813 | } else { |
| 3814 | return 1; |
| 3815 | } |
| 3816 | summ = rd + x; |
| 3817 | reps = diff/summ; |
| 3818 | if (reps < 8*DBL_EPSILON) { |
| 3819 | *d = rd; |
| 3820 | return 1; |
| 3821 | } |
| 3822 | } |
| 3823 | } |
| 3824 | return 0; |
| 3825 | } |
| 3826 | |
| 3827 | |
| 3828 | SWIGINTERN int |
no outgoing calls
no test coverage detected