thephpleague / openapi-psr7-validator

It validates PSR-7 messages (HTTP request/response) against OpenAPI specifications
MIT License
526 stars 94 forks source link

Use epsilon to compare floating points #194

Closed bizurkur closed 1 year ago

bizurkur commented 1 year ago

This is a alternative to https://github.com/thephpleague/openapi-psr7-validator/pull/171 that doesn't require everyone to install bcmath to keep using this library.

Precision of 8 should be "close enough" to consider it equal. That's one 10 millionth of a fraction off... which is an incredibly small amount. 1 / 3 = 0.33333333 therefore 1 / 0.33333333 = 3 because it is "close enough."

Issue #172

scaytrase commented 1 year ago

Thanks @bizurkur ! Great catch