You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
However it somehow give different result when I wrote dividedBy then multipliedBy and multipliedBy then dividedBy
$tc & $cc is BigDecimal Object
For testing :
if $tc = 10 and $cc = 1, the result should be 10
if $tc = 10 and $cc = 2, the result should be 20
BigDecimal::of($tc->minus($tc->minus($cc)))->dividedBy($tc, 0, RoundingMode::HALF_UP)->multipliedBy('100') // always return 0 (incorrect result)
BigDecimal::of($tc->minus($tc->minus($cc)))->multipliedBy('100')->dividedBy($tc, 0, RoundingMode::HALF_UP) // correct result returned
I'm not quite sure if this behavior is intended or there is incorrect implementation from my end..
Thank you for creating this amazingly useful library though 😄
The text was updated successfully, but these errors were encountered:
Hi!
I'm currently trying to convert this following formula to my code
However it somehow give different result when I wrote
dividedBy then multipliedBy
andmultipliedBy then dividedBy
I'm not quite sure if this behavior is intended or there is incorrect implementation from my end..
Thank you for creating this amazingly useful library though 😄
The text was updated successfully, but these errors were encountered: