-
Notifications
You must be signed in to change notification settings - Fork 197
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Should we implement @range on float and double shapes? #2007
Comments
Shouldn't this issue be in the awslabs/smithy repo? The spec "seems to suggest", but it not really clear right? |
Yes, this is for tracking on our side/to give visibility to users of |
I don't want to implement Consider a client performing floating point arithmetic and sending the result to a service: $ python3 -c "print((0.1 + 0.2) > 0.3)"
True Having the server framework compare floating point numbers generically can have devastating consequences in certain application domains. Depending on the hardware, FPU, compiler and compiler flags, an operation like This is not even getting into the problems that arise from negative and positive infinities, I think that there's no easy way for Smithy to support float comparisons as-is interoperably across languages and architectures without prescribing an epsilon threshold. This is also one of the reasons why Smithy dropped support for floating point shapes from However, smithy-rs, especially server-side development, is usually greenfield, and so we have a chance here to warn service owners. I therefore think it's best that this is not implemented, and instead each smithy-rs application, depending on their needs, enforce the check themselves as they require. |
To point to a better issue #2007.
To point to a better issue #2007. Also let users know this is unlikely to ever get implemented.
The
smithy
spec seems to suggest that@range
is allowed onfloat
anddouble
shapes.We should clarify if that is correct and how it should be implemented (e.g. should
range
allow to specify a tolerance threshold for comparisons?).The text was updated successfully, but these errors were encountered: