Skip to content

Commit

Permalink
fix #302
Browse files Browse the repository at this point in the history
  • Loading branch information
Darkempire78 committed Aug 1, 2023
1 parent 22c2dc0 commit 4124d93
Showing 1 changed file with 5 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -304,7 +304,11 @@ class Calculator(
is_infinity = true
x = BigDecimal.ZERO
} else {
if (exponent > BigDecimal.ZERO) {
// If the number is negative and the factor is smaller than 1 ( e.g : (-5)^0.5 )
if (x < BigDecimal.ZERO && exponent < BigDecimal.ONE) {
require_real_number = true
}
else if (exponent > BigDecimal.ZERO) {

// To support bigdecimal exponent (e.g: 3.5)
x = x.pow(intPart, MathContext.DECIMAL64)
Expand Down

0 comments on commit 4124d93

Please sign in to comment.