Skip to content
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

add warning or error when using bigint with floating point types #1991

Open
Tragen opened this issue Apr 6, 2024 · 1 comment
Open

add warning or error when using bigint with floating point types #1991

Tragen opened this issue Apr 6, 2024 · 1 comment

Comments

@Tragen
Copy link

Tragen commented Apr 6, 2024

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.
PowerShell/PowerShell#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

@bergmeister
Copy link
Collaborator

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants