Re: Why does my Exercism task fail?

new topic     » goto parent     » topic index » view thread      » older message » newer message

First thing I'd do is subtract and print the difference of the offending numbers.
On Phix, 32-bit is 2048 out, which (I know you're not using and) is about right since there are only 53 bits of precision, which
makes it pretty much unavoidable when using *10 rather than *2 to construct it, whereas on 64-bit Phix it sails through.
One thing I did fix about 5 months ago was an error in the (Phix) parser:

Bugfix: constant n = 9_007_199_254_740_991 was creating the wrong constant, ending 
        in 92 not 91. The tokeniser was performing TokN = TokN*10 + Ch-'0', but 
        the (TokN*10 + Ch) part was exceeding available precision (temporarily), 
        which no longer happens with the corrected TokN = TokN*10 + (Ch-'0'). 

(as worded that is strictly speaking a 32-bit error, but no doubt there was a similar 64-bit one)

One quick and dirty fix might be to replace your 9223372036854775808 with power(2,63), works for me and even on 32-bit Phix anyway.
For absolute correctness you might want to be testing "res=9223372036854775808 or res=power(2,63)"

new topic     » goto parent     » topic index » view thread      » older message » newer message

Search



Quick Links

User menu

Not signed in.

Misc Menu