Math.Pow(-1, 2) == -1 in Windows 11 Insider build

Bug nature and scope

  • Report: On a Windows 11 Insider build, Math.Pow(-1, 2) (and C++ pow(-1, 2)) returns -1 instead of 1.
  • Affected stack: Both .NET and C++ appear to hit the same underlying issue via the Windows Universal CRT (UCRT) pow implementation.
  • Clarification: A later comment states the UCRT bug was already reported internally and fixed (OS bug #58189958), but the fix may take time to reach public Insider builds.
  • Several commenters are surprised a bug in such a fundamental function escaped to users and wasn’t caught by basic tests.

Testing, TDD, and AI-assisted development

  • Many express disbelief that CI or regression tests didn’t cover simple cases like squaring negative numbers.
  • Anecdotes are shared about LLMs “fixing” failing tests by changing expected values or mocking the function under test, likened to human anti-patterns.
  • Long subthread on TDD:
    • Critiques: TDD often degenerates into “make the test pass” without understanding, overemphasis on per-method tests, and huge test overhead.
    • Defenses: Proper TDD writes tests that mirror the spec at higher levels (acceptance/integration) and is valuable when done competently.
    • Disagreement over whether this “proper TDD” actually happens in the general industry, with accusations of “no true Scotsman” when defenders narrow the definition.

Ownership and bug-report handling

  • Strong disagreement with the suggestion that the bug “should be reported to MSVC instead”:
    • View 1: From the user’s perspective, it’s a .NET bug; .NET maintainers should own it, escalate upstream, and keep tracking it.
    • View 2: If the root cause is clearly in UCRT, it’s reasonable to direct the bug there, but the reply’s passive phrasing leaves responsibility ambiguous.
  • Several argue that telling users to refile upstream is poor practice for a commercially backed product; the application team should file and follow up.
  • Once clarified that the commenter was a community volunteer, some criticism softens, but the broader point about clear ownership remains.

Broader commentary on software quality and process

  • Jokes and concerns that software quality is “exponentially worse,” with references to AI-generated code making up a significant fraction of Microsoft’s codebase.
  • Comparisons to past numerical bugs (e.g., Pentium FDIV) and assertions that fundamental math libraries should have extremely strong regression testing.
  • Discussion of big-company bureaucracy: bug “buck-passing,” fragmented responsibility, and the idea that large firms behave like states with entrenched processes.

Tools, ecosystem, and communication channels

  • Brief discussion of how UCRT is shared across Windows and how OS, compiler, and CRT interact.
  • Comments note that most critical OS code likely avoids floating-point pow, mitigating immediate system impact.
  • Side thread criticizes reliance on Discord for issue handling and support:
    • Complaints: poor web searchability, lock-in, “too social” culture, and NSFW side channels mixing with technical topics.
    • Others note that the project in question also uses GitHub and forums, and Discord is mainly for fast, informal coordination.