From: <di...@us...> - 2020-08-09 08:28:02
|
Revision: 3758 http://sourceforge.net/p/ftm/code/3758 Author: diemo Date: 2020-08-09 08:28:00 +0000 (Sun, 09 Aug 2020) Log Message: ----------- 64bit bug? int of a large float value can wrap to negative, need to check before trunc (better than re-check) Modified Paths: -------------- trunk/ftm/ftmlib/classes/fmat.c Modified: trunk/ftm/ftmlib/classes/fmat.c =================================================================== --- trunk/ftm/ftmlib/classes/fmat.c 2020-08-04 17:46:57 UTC (rev 3757) +++ trunk/ftm/ftmlib/classes/fmat.c 2020-08-09 08:28:00 UTC (rev 3758) @@ -2311,15 +2311,15 @@ else if(fts_is_float(at)) { double i_arg = fts_get_float(at); - - if(i_arg > 0.0) + + if (i_arg >= m - 1) + i = m - 1; + else if (i_arg < 0.0) + i = 0; + else { - i = (int)i_arg; - - if(i >= m - 1) - i = m - 1; - else - i_frac = i_arg - floor(i_arg); + i = (int)i_arg; + i_frac = i_arg - floor(i_arg); } } This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |