modify formula ai functions floor and ceil...

...to behave like c++ floor and ceil. fixes error spotted by mordante
This commit is contained in:
Iurii Chernyi 2011-04-17 20:01:19 +00:00
parent 8d1aad7b4a
commit 1698ddf49d

View file

@ -923,14 +923,9 @@ private:
int d = decimal.as_decimal(); int d = decimal.as_decimal();
int f = d%1000; if( (d>=0) && (d%1000 != 0) ) {
if( f > 0 ) {
d/=1000; d/=1000;
return variant( ++d ); return variant( ++d );
} else if( f < 0 ) {
d/=1000;
return variant( --d );
} else { } else {
d/=1000; d/=1000;
return variant( d ); return variant( d );
@ -975,9 +970,9 @@ private:
int d = decimal.as_decimal(); int d = decimal.as_decimal();
if( d%1000 != 0 ) { if( (d<0) && (d%1000 != 0) ) {
d/=1000; d/=1000;
return variant( d ); return variant( --d );
} else { } else {
d/=1000; d/=1000;
return variant( d ); return variant( d );