Type of issue
Missing information
Feedback
I wrote an article about this linked below. It's not documented that ValidateRange needs you to specify the boundary types to be the same as the parameter types to allow accurate comparison on [double], [float], [decimal] . Integer literals accept a margin of error due to type conversion. It'd be useful for those less knowledgeable about PS rounding to have this explicitly stated.
https://www.reddit.com/r/PowerShell/comments/1vbsyfc/til_validaterange_with_integer_literals_silently/
Page URL
https://learn.microsoft.com/en-us/powershell/module/microsoft.powershell.core/about/about_functions_advanced_parameters?view=powershell-7.6#validaterange-validation-attribute
Content source URL
https://github.com/MicrosoftDocs/PowerShell-Docs/blob/main/reference/7.6/Microsoft.PowerShell.Core/About/about_Functions_Advanced_Parameters.md
Author
Sean Wheeler (@sdwheeler)
Platform Id
acf80b29-4d25-c279-811a-95e0b0273aba
Document Id
09f03e1d-5e99-8ca3-e665-6b50d988231b
Type of issue
Missing information
Feedback
I wrote an article about this linked below. It's not documented that ValidateRange needs you to specify the boundary types to be the same as the parameter types to allow accurate comparison on [double], [float], [decimal] . Integer literals accept a margin of error due to type conversion. It'd be useful for those less knowledgeable about PS rounding to have this explicitly stated.
https://www.reddit.com/r/PowerShell/comments/1vbsyfc/til_validaterange_with_integer_literals_silently/
Page URL
https://learn.microsoft.com/en-us/powershell/module/microsoft.powershell.core/about/about_functions_advanced_parameters?view=powershell-7.6#validaterange-validation-attribute
Content source URL
https://github.com/MicrosoftDocs/PowerShell-Docs/blob/main/reference/7.6/Microsoft.PowerShell.Core/About/about_Functions_Advanced_Parameters.md
Author
Sean Wheeler (@sdwheeler)
Platform Id
acf80b29-4d25-c279-811a-95e0b0273aba
Document Id
09f03e1d-5e99-8ca3-e665-6b50d988231b