Plutonomicon / plutarch-plutus

Typed eDSL for writing UPLC /ˈpluː.tɑːk/
MIT License
123 stars 63 forks source link

POrd, PEq instances for PRationalData seems broken #618

Closed peter-mlabs closed 8 months ago

peter-mlabs commented 1 year ago
0/1 #< 758566050/758566050 #&& 758566050/758566050 #<= 1/1

appears to evaluate to false. The instance is autoderived (while neither PRational nor PlutusTx.Rational are autoderived), so I'm assuming that either its broken entirely or assumes it is reduced.

Likewise, 1/1 #== 2/2 appears to evaluate to false.

L-as commented 1 year ago

Probably not intended. Seems simple to fix though.

SeungheonOh commented 8 months ago

Neither Koz nor I can reproduce failure on 1/1 #== 2/2. Plutarch doesn't expose constructor for PRationalData and it only allows values to be lifted from PlutusTx.Rational. And all constructors of PlutusTx.Rational reduce the rational given. Both 1/1 and 2/2 will be reduced to 1/1.

SeungheonOh commented 8 months ago

Bug on POrd instance is fixed