Skip to content

Commit

Permalink
Formula engine: fix comparison trying to cast everything to decimal
Browse files Browse the repository at this point in the history
Now it only tries to cast to decimal if both are numbers.
  • Loading branch information
CelticMinstrel committed Mar 18, 2016
1 parent b53ee99 commit e78b5d7
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion src/variant.cpp
Expand Up @@ -829,7 +829,10 @@ bool variant::operator!=(const variant& v) const
bool variant::operator<=(const variant& v) const
{
if(type_ != v.type_) {
if( type_ == TYPE_DECIMAL || v.type_ == TYPE_DECIMAL ) {
if(type_ == TYPE_DECIMAL && v.type_ == TYPE_INT) {
return as_decimal() <= v.as_decimal();
}
if(v.type_ == TYPE_DECIMAL && type_ == TYPE_INT) {
return as_decimal() <= v.as_decimal();
}

Expand Down

0 comments on commit e78b5d7

Please sign in to comment.