OSDev.org https://forum.osdev.org/ 

Program to calculate root of cubics https://forum.osdev.org/viewtopic.php?f=13&t=37031 
Page 1 of 1 
Author:  nullplan [ Wed Jul 22, 2020 11:27 am ]  
Post subject:  Program to calculate root of cubics  
Hi all, had a bit of time on my hands and so I wrote something i wanted to implement for a while now, namely a program to calculate the roots of cubic expressions (by Cardano's method). Now I've written it, I am not entirely sure if I'm doing everything right. I added a check for the results at the end, and I regularly get results on the order of 1e16. Is that entirely down to my nonoptimized programming? Or did I get something wrong?

Author:  Octocontrabass [ Wed Jul 22, 2020 8:48 pm ] 
Post subject:  Re: Program to calculate root of cubics 
Doubleprecision values can accurately store around 15 decimal digits, so that sounds like normal rounding error. By default, compilers don't change the order of floatingpoint operations while optimizing, so you may be able to improve the rounding error by changing how you calculate intermediate values. 
Page 1 of 1  All times are UTC  6 hours 
Powered by phpBB © 2000, 2002, 2005, 2007 phpBB Group http://www.phpbb.com/ 