News for hackers. Stuff that matters.
Re:The use of ‘class’ for things that should be simple free ... by mojuba on Sunday May 29, 2022 @06:08AM (#31547946)
No. Depending on the language you can find a way of returning 0 to 2 results. Could be a dynamic array, could be a tuple that allows NaN's of some sort.
Re:The use of ‘class’ for things that should be simple free ... by aragilar on Sunday May 29, 2022 @07:12AM (#31548195)
What algorithm did you use? The standard formula is pretty inaccurate, whereas following most of https://people.eecs.berkeley.edu/~wkahan/Math128/Cubic.pdf, I was able to get down to near machine precision. I've seen enough cases where someone blindly copied in a formula (or numerical algorithm) from a textbook, without considering how the numerics behave, and getting bad results, to trust unsourced numerical code.