erg-lang / erg

A statically typed language compatible with Python
http://erg-lang.org
Apache License 2.0
2.62k stars 54 forks source link

`abs(Float)` is converted to `Nat` #401

Open mtshiba opened 1 year ago

mtshiba commented 1 year ago

Describe the bug?

...

Reproducible code

assert abs(1.0 - 1.2) >= 1.0

Expected result

passed

Actual result

AssertionError

Additional context

This seems to be due to the fact that the result of abs is inferred to be Nat; converting 0.2 to Nat yields 0.

Erg version

0.6.5

Python version

None

OS

None