Scryer-prolog: Unexpected type_error(float,-1)

Created on 21 May 2020  路  6Comments  路  Source: mthom/scryer-prolog

Currently, we get:

?- X is -1^ -1.
caught: error(type_error(float,-1),(^)/2)

Expected: X = -1.

Noted by @notoria in #547 .

All 6 comments

This now works, thank you a lot!

This works only for:

?- X is -1 ^ -1.
   X = -1.
?- E is -2, X is -1 ^ E.
caught: error(type_error(float,-1),(^)/2)
?-

For every integer E < -1, it doesn't work.

For every integer E < -1, it doesn't work.

That's what the standard says should happen:

https://www.complang.tuwien.ac.at/ulrich/iso-prolog/dtc2#pow

OK, so even mathematics doesn't change the standard.

(^) is for integer exponentiation, (**) is the general kind. This works just fine:

?- E is -2, X is -1 ** E.
   E = -2, X = 1.

I have filed #558 and #559 about these issues!

Was this page helpful?
0 / 5 - 0 ratings