Become a member

Get the best offers and updates relating to Liberty Case News.

― Advertisement ―

spot_img

CodeSOD: And Config

It's not unusual to store format templates in your application configuration files. I'd argue it's probably a good and wise thing to do. But...
HomeTechC# Math.Pow(-1, 2) doesn't output correct value on Windows 11 Insider Preview,...

C# Math.Pow(-1, 2) doesn’t output correct value on Windows 11 Insider Preview, Canary channel (27881.1000) · Issue #117233 · dotnet/runtime · GitHub

Description

The following is copied with extra bits from https://aka.ms/AAwwjwl (Feedback Hub) to raise awareness of this issue:

Hello, I’m a contributor to osu! (https://github.com/ppy/osu). A user reported a really weird problem with our game that only happens in the current version of Canary (27881.1000) in ppy/osu#33948. I’ve narrowed it down to ppy/osu#33948 (comment), which is Math.Pow(-1, 2) returning -1 instead of 1 for some odd reason.

Used VSCode for C# installation of .NET 8 (what osu! uses). I’ve also tried the same math function in Python, but the value was correct (1). C++’s std::pow(-1,2) seems to also output -1, so it may be a bigger issue in Windows.

If you need to contact us better, joining the osu! Discord server would be best (https://discord.gg/ppy).

Reproduction Steps

Console.WriteLine(Math.Pow(-1, 2));

or

std::cout << std::pow(-1, 2) << std::endl;

Expected behavior

It should output 1.

Actual behavior

It outputs -1 on Windows 11 Insider Preview, Canary channel (27881.1000).

Regression?

No response

Known Workarounds

No response

Configuration

  • .NET SDK 8.0.411
  • Windows 11 Insider Preview, Canary channel (27881.1000)

Other information

No response

Source link