I find it strange as well that no unit test caught this. Squaring a negative number is definitely a case I'd expect to be covered. Perhaps compiler optimization made this case work in the unit test, allowing the runtime function to break? And then it broken in .net where the JIT compiler is dumber than the C++ compiler?
Math.Pow(-1, 2) == -1 in Windows 11 Insider build
101–110 of 142 posts
Re: Math.Pow(-1, 2) == -1 in Windows 11 Insider build
#102Re: Math.Pow(-1, 2) == -1 in Windows 11 Insider build
#103Earlier quoted context omitted.
AFAIK TDD culturally occurred at the same time as the push for 100% test coverage. So we would end up with code bases that were 90% test code and 10% actual code, every individual method had many tests. This meant for every code change there was a 10x test change so test timelines dominated dev timelines, there was a push at the time to expand the test org to be 2x the size of the dev org. AFAIK at MS that was abando…
The push wasn't to test every individual method but to test every individual code change . This confusion you had was shared by many others and caused havoc because if you unnecessarily couple every single interface in the code base to a test then every change breaks a test. This became worse for many people than not writing tests at all. >I have only seen TDD used poorly, as a crutch, an alternative to thinking deep…
Re: Math.Pow(-1, 2) == -1 in Windows 11 Insider build
#104I disagree with the comment “Both Math.Pow and std::pow invokes the pow function in UCRT, which is shipped with Windows. The issue should be reported to MSVC instead” It’s not the job of a bug reporter to figure that out and to verify that nothing goes wrong in setting up stuff for invoking that function or in getting its output back into the C# world. That’s even more true because the dynamic nature of .NET code mak…
Re: Math.Pow(-1, 2) == -1 in Windows 11 Insider build
#105Earlier quoted context omitted.
The push wasn't to test every individual method but to test every individual code change . This confusion you had was shared by many others and caused havoc because if you unnecessarily couple every single interface in the code base to a test then every change breaks a test. This became worse for many people than not writing tests at all. >I have only seen TDD used poorly, as a crutch, an alternative to thinking deep…
It sounds like your definition of TDD is regression tests + user acceptance test and I've already agreed that those are good things, we seem to just disagree that is TDD is generally practiced in this manner - though you've only given me your personal anecdote. I made a generalization based on an observed pattern of behavior at a rather large scale, I will assume that you do TDD as is intended, but I already assumed…
That's it. It says nothing about the type of test you write. Personally i do it with literally every type of test that i write - acceptance, integration, unit.
If you write a decent test, yes, TDD is always valuable. If you TDD with shitty tests, not so much, but that isnt really an issue with TDD.
Re: Math.Pow(-1, 2) == -1 in Windows 11 Insider build
#106I disagree with the comment “Both Math.Pow and std::pow invokes the pow function in UCRT, which is shipped with Windows. The issue should be reported to MSVC instead” It’s not the job of a bug reporter to figure that out and to verify that nothing goes wrong in setting up stuff for invoking that function or in getting its output back into the C# world. That’s even more true because the dynamic nature of .NET code mak…
What do you disagree with, exactly? The bug is in an underlying library, so it should be reported to that library. That all seems correct to me, I don't see what there is to disagree with there. The problem with the comment is it does not make ownership of the next steps clear. The maintainer should've either taken the ball ("I will report this to...") or made it clear that the reporter should hold the ball ("We can'…
Instead means "this isn't our bug, it's the underlying library."
The libraries you rely on are part of your product. You own the issues that bubble up from them.
A much much better reply for the maintainer would've been: "The root cause looks to be X, I'll submit a ticket and make sure a fix makes it into our build."
Re: Math.Pow(-1, 2) == -1 in Windows 11 Insider build
#107Reminds me of this 2005 paper: https://www.sciencedirect.com/science/article/abs/pii/S01679...
Surely math libraries and optimizations have been a solved problem for the last 20+ years.
Re: Math.Pow(-1, 2) == -1 in Windows 11 Insider build
#108Earlier quoted context omitted.
It sounds like your definition of TDD is regression tests + user acceptance test and I've already agreed that those are good things, we seem to just disagree that is TDD is generally practiced in this manner - though you've only given me your personal anecdote. I made a generalization based on an observed pattern of behavior at a rather large scale, I will assume that you do TDD as is intended, but I already assumed…
The definition is you write or amend a test before making the code change that makes it pass. That's it. It says nothing about the type of test you write. Personally i do it with literally every type of test that i write - acceptance, integration, unit. If you write a decent test, yes, TDD is always valuable. If you TDD with shitty tests, not so much, but that isnt really an issue with TDD.
Re: Math.Pow(-1, 2) == -1 in Windows 11 Insider build
#109Earlier quoted context omitted.
It's going to be interpreted, and is probably meant, as saying that the person who filed the bug should close this report and open a new one in the right place.
Since the comment you responded to already complained about use of passive voice... It's going to be interpreted BY WHOM to say that? Other .NET developers? Yeah, maybe, at least some of them. By the submitter of the original bug? No idea, I can't read their mind.
Re: Math.Pow(-1, 2) == -1 in Windows 11 Insider build
#110I disagree with the comment “Both Math.Pow and std::pow invokes the pow function in UCRT, which is shipped with Windows. The issue should be reported to MSVC instead” It’s not the job of a bug reporter to figure that out and to verify that nothing goes wrong in setting up stuff for invoking that function or in getting its output back into the C# world. That’s even more true because the dynamic nature of .NET code mak…