Jean-Luc-Picard-2021
Jean-Luc-Picard-2021
As already mentioned in another ticket, the error is gone. For example it is now: ``` Trealla Prolog (c) Infradig 2020-2022, v2.7.15 ?- X is 39^9, Y is 39*39*39*39*39*39*39*39*39. X...
Strange on my side printing 3.0000000000000004 is not in conflict with printing 1/10. I still get: ``` /* Jekejeke Prolog 1.5.4 */ ?- X is 1/10. X = 0.1. ```...
Well usually people use the predicate format/2 if they want to see less, don't they? And for indempodent input/output the predicate write/1 needs to show more? > **format(+Format, :Arguments)** >...
Concerning your examples I get, these are all systems that can also show 3.0000000000000004: ``` /* Java, JavaScript and Python */ ?- X is 1/3. X = 0.3333333333333333. ``` For...
BTW: SWI-Prolog is full of bugs, I get this strange result, a bigger numerator, leads to a smaller result? ``` /* SWI-Prolog 8.5.17 */ ?- N9 is 370370367037037036703703703670 / 123456789012345678901234567890....
This is also a nice test case: ``` /* Scryer, SWI-Prolog and Jekejeke */ ?- X is 0.1+0.1+0.1+0.1+0.1+0.1+0.1+0.1. X = 0.7999999999999999. /* Trealla 2.7.15 */ ?- X is 0.1+0.1+0.1+0.1+0.1+0.1+0.1+0.1. X...
Now its overshooting in the other direction. Was expecting that when it shows 0.8, I can also subtract 0.8 and get zero? ``` Trealla Prolog (c) Infradig 2020-2023, v2.9.4 ?-...
Thanks to format/2 can investigate the case in more detail. The number seems to be a challenge for the "g" format: ``` /* Java, JavaScript and Python */ ?- X...
Since Trealla Prolog can produce the same: ``` /* Trealla Prolog 2.14.32 */ ?- X is 370370367037037036703703703670 / 123456789012345678901234567890, format('~16g~n', [X]). 3 ?- X is 370370367037037036703703703670 / 123456789012345678901234567890, format('~17g~n', [X])....
Maybe I hit the jackpot now, with this adaptive algorithm in JavaScript: ``` let res = num.toPrecision(16); if (Number(res) === num) { return shape_number(res); } else { return shape_number(num.toPrecision(17)); }...