Skip to content

[Bug]: Long versions of intrinsic functions are unreachable #8698

@Forgind

Description

@Forgind

Issue Description

Our arithmetic operations treat everything as a double, which means the 'long' version of our intrinsic functions are unavailable. This can induce floating point arithmetic errors, especially at large values where doubles are less precise. We should try to use long and only fall back to double if the input cannot be parsed as a long.

Steps to Reproduce

Create a simple console app and add this target:

  <Target Name="BadSubtract">
    <Message Text="$([MSBuild]::Subtract(9223372036854775807, 9223372036854775806)) should be 1" Importance="High" />
  </Target>

Then make that target run.

Expected Behavior

Outputs 1 should be 1

Actual Behavior

Outputs 0 should be 1

Analysis

No response

Versions & Configurations

No response

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions