PowerShell / PowerShell/PSScriptAnalyzer

add warning or error when using bigint with floating point types

Open
#1,991 1 comment 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Issue - New Rule Up-for-Grabs
Dominant language
C#
Stars
2.2k
Forks
414
Avg merge
13h 1m
Merged PRs (30d)
2

Description

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

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

No file, test, or entry point is named. Start by locating the analyzer rule or type-checking entry point for arithmetic expressions, then reproduce the two examples from the issue; done means bigint combined with floating-point addition or multiplication receives a warning or error instead of silently producing the shown incorrect results.

Written by the indexing model from the issue text.

Assessment

Tech stack
csharp, powershell
Domain
tooling
Issue type
Feature
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.