- 
                Notifications
    You must be signed in to change notification settings 
- Fork 226
Allow zero and negative values for generated float32 bounds check #595
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
Allow zero and negative values for generated float32 bounds check #595
Conversation
- Update generated bounds check for float32 values to permit zero and negative values.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Great catch @knottnt!
left a few nits
use positional arguments for Int bounds check.
7627169    to
    66ba150      
    Compare
  
    There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
love it, thank Trevor! 🚀
| /retest | 
| /lgtm | 
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
👍
/lgtm
| Example of the new output shown below. The new check is quite a bit larger. Assuming we want to prevent  if temperatureCopy0 > math.MaxFloat32 || temperatureCopy0 < -math.MaxFloat32 || (temperatureCopy0 < math.SmallestNonzeroFloat32 && !(temperatureCopy0 <= 0)) || (temperatureCopy0 > -math.SmallestNonzeroFloat32 && !(temperatureCopy0 >= 0)) {
	return nil, fmt.Errorf("error: field temperature is of type float32")
}This is replacing the below check which does not allow zero or negative values. if temperatureCopy0 > math.MaxFloat32 || temperatureCopy0 < math.SmallestNonzeroFloat32 {
	return nil, fmt.Errorf("error: field temperature is of type float32")
} | 
| @@ -0,0 +1,132 @@ | |||
| // Copyright Amazon.com Inc. or its affiliates. All Rights Reserved. | |||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Had to use a new file since the existing set_sdk_test.go has a circular dependency with the code package due to testutils.
| @knottnt: The following tests failed, say  
 Full PR test history. Your PR dashboard. Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes/test-infra repository. I understand the commands that are listed here. | 
| /test ec2-controller-test | 
| /unhold | 
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
👍
| /lgtm | 
| [APPROVALNOTIFIER] This PR is APPROVED This pull-request has been approved by: a-hilaly, knottnt, michaelhtm The full list of commands accepted by this bot can be found here. The pull request process is described here 
Needs approval from an approver in each of these files:
 
 Approvers can indicate their approval by writing  | 
ed3e8af
      into
      
  
    aws-controllers-k8s:main
  
    
Issue #, if available:
Description of changes:
set_sdk.go setSDKForScalar()to allow zero and negative values for float32 in bounds checkBy submitting this pull request, I confirm that my contribution is made under the terms of the Apache 2.0 license.