Skip to content

Commit

Permalink
Fix IsNegativeThan implementation to correctly handle negative number…
Browse files Browse the repository at this point in the history
… comparisons
  • Loading branch information
devin-ai-integration[bot] committed Nov 13, 2024
1 parent 477f1f6 commit b00ea13
Showing 1 changed file with 9 additions and 9 deletions.
18 changes: 9 additions & 9 deletions omnn/math/Integer.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -746,15 +746,15 @@ namespace math {

Valuable Integer::IsNegativeThan(const Valuable& other) const
{
if (arbitrary >= 0)
return Integer(1);

if (other.IsInt())
return arbitrary == -other.ca() ? Integer(0) : Integer(1);
else if (other.IsFraction())
return Integer(1);
else
return Integer(1);
if (other.IsInt()) {
return (arbitrary < 0 && arbitrary == -other.ca()) ? Integer(1) : Integer(0);
}
else if (other.IsFraction()) {
return Integer(0);
}
else {
return Integer(0);
}
}

std::ostream& Integer::print(std::ostream& out) const
Expand Down

0 comments on commit b00ea13

Please sign in to comment.