diff --git a/CImg.h b/CImg.h index 9e2cdf13..ac3d33e8 100644 --- a/CImg.h +++ b/CImg.h @@ -21301,8 +21301,10 @@ namespace cimg_library { try { arg1 = compile(ss6,se1,depth1,0,block_flags); } catch(CImgException&) { _cimg_mp_return(0); } if (is_vector(arg1)) _cimg_mp_vector1_v(mp_isint,arg1); - if (is_const_scalar(arg1)) - _cimg_mp_return((unsigned int)((double)(longT)mem[arg1]==mem[arg1])); + if (is_const_scalar(arg1)) { + val = mem[arg1]; + _cimg_mp_return((unsigned int)(std::modf(mem[arg1],&val1)?0:(val==0) + 2*(val>0) + 4*(val<0))); + } _cimg_mp_scalar1(mp_isint,arg1); } @@ -26241,7 +26243,8 @@ namespace cimg_library { } static double mp_isint(_cimg_math_parser& mp) { - return (double)((double)(longT)_mp_arg(2)==_mp_arg(2)); + double val = _mp_arg(2), intpart; + return std::modf(val,&intpart)?0:(val==0) + 2*(val>0) + 4*(val<0); } static double mp_isfile(_cimg_math_parser& mp) {