modify formula ai functions floor and ceil...
...to behave like c++ floor and ceil. fixes error spotted by mordante
This commit is contained in:
parent
8d1aad7b4a
commit
1698ddf49d
1 changed files with 3 additions and 8 deletions
|
@ -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 );
|
||||||
|
|
Loading…
Add table
Reference in a new issue