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
Current implementation of multipleOf might lead to unexpected results.
Say we have a schema of number with multipleOf = 0.01. When now the number 4.22 is input then there is an error that 4.22 is no multiple of 0.01. This happens because in https://github.com/swaggest/php-json-schema/blob/master/src/Schema.php#L348 the division yields 422.0 and casting this to integer results in 421 which does not match.
Why PHP does this I'm not sure. Likely the internal representation differs and this leads to some rounding or the like. See https://stackoverflow.com/q/3385685/6221202 for a similar problem and possible solutions.
The text was updated successfully, but these errors were encountered:
Wow, even the behavior in 7.0, 7.3 and 8 is different. For me it failed with 7.0 (which is EOL I know). I'm also not sure but the string casting method could work. Maybe as most accurate method we could compute the precision of the multipleOf parameter and use that as input to bcdiv?
Current implementation of multipleOf might lead to unexpected results.
Say we have a schema of number with multipleOf = 0.01. When now the number 4.22 is input then there is an error that 4.22 is no multiple of 0.01. This happens because in https://github.com/swaggest/php-json-schema/blob/master/src/Schema.php#L348 the division yields 422.0 and casting this to integer results in 421 which does not match.
Why PHP does this I'm not sure. Likely the internal representation differs and this leads to some rounding or the like. See https://stackoverflow.com/q/3385685/6221202 for a similar problem and possible solutions.
The text was updated successfully, but these errors were encountered: