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

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

Closed
Forgind opened this issue Apr 24, 2023 · 2 comments · Fixed by #8710
Closed

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

Forgind opened this issue Apr 24, 2023 · 2 comments · Fixed by #8710
Assignees

Comments

@Forgind
Copy link
Member

Forgind commented Apr 24, 2023

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

@jrdodds
Copy link
Contributor

jrdodds commented Apr 24, 2023

If this issue moves forward from triage, please consider assigning it to me because I'm familiar with the issue from #8569.

@Forgind
Copy link
Member Author

Forgind commented Apr 24, 2023

I don't see any problem with fixing this as long as it doesn't regress perf. Will assign 🙂 Appreciate all the help!

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

Successfully merging a pull request may close this issue.

3 participants