We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
It would be nice if swrlb:pow would accept negative values.
swrlb:pow
I get an invalid math operation error with a negative pow value
https://github.com/protegeproject/swrlapi/blob/5b89d824541899255bc858aeca4a9c4f4b585882/src/main/java/org/swrlapi/builtins/swrlb/SWRLBuiltInLibraryImpl.java#L1527C6-L1527C8
It seems that BigDecimal requires a math context when using negative
BigDecimal
https://stackoverflow.com/a/9932295
If not, by default a BigDecimal will only accept pow with positive numbers.
Alternative for my use case:
Add a second SWRL rule that processes negative pows with division (1/pow(10,x))
swrlb:lessThan(?power_neg,0) ^ swrlb:abs(?abs_val,?power_neg)^swrlb:pow(?pow_val,10,?abs_val) ^ swrlb:divide(?result,1.0000,pow_val) -> my_consequents_here
The text was updated successfully, but these errors were encountered:
Add a mathcontext to swrlb:pow
b243b5e
Mathcontext is required to allow the use of negative values as second argument for a pow operation with BigDecimal. Fixes protegeproject#87
No branches or pull requests
It would be nice if
swrlb:pow
would accept negative values.I get an invalid math operation error with a negative pow value
https://github.com/protegeproject/swrlapi/blob/5b89d824541899255bc858aeca4a9c4f4b585882/src/main/java/org/swrlapi/builtins/swrlb/SWRLBuiltInLibraryImpl.java#L1527C6-L1527C8
It seems that
BigDecimal
requires a math context when using negativehttps://stackoverflow.com/a/9932295
If not, by default a
BigDecimal
will only accept pow with positive numbers.Alternative for my use case:
Add a second SWRL rule that processes negative pows with division (1/pow(10,x))
swrlb:lessThan(?power_neg,0) ^ swrlb:abs(?abs_val,?power_neg)^swrlb:pow(?pow_val,10,?abs_val) ^ swrlb:divide(?result,1.0000,pow_val) -> my_consequents_here
The text was updated successfully, but these errors were encountered: