Coder-Spirit / php-bignumbers

A robust library to handle immutable big numbers inside PHP applications
MIT License
131 stars 29 forks source link

Fixed truncation when scale not passed to comp() #38

Closed shabbyrobe closed 9 years ago

shabbyrobe commented 9 years ago

Ran in to some surprising behaviour when scale is not passed to comp() in master:

var_dump(Decimal::create("1.234")->comp(Decimal::create("1.235")));
// int(0)!

I've updated it to be in line with how equals() behaves. With this PR:

var_dump(Decimal::create("1.234")->comp(Decimal::create("1.235")));
// int(-1)
coveralls commented 9 years ago

Coverage Status

Coverage increased (+0.61%) to 96.02% when pulling 0d06bb7d7c18f67989c91ed6fd9eb82292698b30 on shabbyrobe:master into 64c696a6ffede88c8964eeb0270a2df665715820 on Litipk:master.

castarco commented 9 years ago

@shabbyrobe Thanks for yous observations and your code. I'll merge it in a week, because I'm burned out with other tasks. I'll start holidays June 13th.

shabbyrobe commented 9 years ago

Sorry to hear about your burnout, take it easy eh, get some well-earned rest! Thanks for the quick reply and for your work on the library.

shabbyrobe commented 9 years ago

@castarco Is it still possible to for this to be merged?

castarco commented 9 years ago

Hey @shabbyrobe , excuse me /// , I'm sorry. This evening I'll review and merge it, promised!