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
The text was updated successfully, but these errors were encountered:
dansleboby
changed the title
Not rounded substration for interval cause Unknown or bad format
DateMalformedIntervalStringException when parsing high-precision seconds in CarbonInterval::make()
Oct 31, 2024
Indeed there is a bug when the rounding is below 0.000001 which is what happens with 13.000001 - 13 as in you analyze returns 0.000000999999999
I'm making a fix which will convert microseconds from the string to integer (without stepping by float type) which should avoir this rounding issue: #3098
Hello,
I encountered an issue with the following code:
Carbon version: 3.8.0
PHP version: 8.1.3
I expected to get:
But I actually get:
I narrow down the error is comming from:
https://github.com/briannesbitt/Carbon/blob/master/src/Carbon/CarbonInterval.php#L521-L526
Because we are dealing with float and we do not round the result wird thing append due to how decimal and base 10 to base 2, see IEEE 754 and https://www.php.net/manual/en/language.types.float.php
Thanks!
The text was updated successfully, but these errors were encountered: