PSScriptAnalyzer icon indicating copy to clipboard operation
PSScriptAnalyzer copied to clipboard

add warning or error when using bigint with floating point types

Open Tragen opened this issue 1 year ago • 1 comments

Summary of the new feature

When you use bigint and add or multiply a floating point number, the result is wrong. I discussed it with the PowerShell team but they don't want to fix it. https://github.com/PowerShell/PowerShell/issues/21341

[double]$r = [bigint]5 * [double]1.5 Write-Host "bigint: $r" The result is "bigint: 5"

[double]$r = [bigint]5 + [double]1.5 Write-Host "bigint: $r" The result is "bigint: 6"

What is the latest version of PSScriptAnalyzer at the point of writing 1.22.0

Tragen avatar Apr 06 '24 07:04 Tragen

If you can add a meaningful rule that doesn't result in many false positives, happy for you to add such a rule and support you in that.

bergmeister avatar Apr 09 '24 10:04 bergmeister