3 ms·
Float or double?
- jepler 9y agoA good high-level overview for those new to the topic. Here's my advice: If you have the time to do error analysis and performance optimization, then maybe use float; if not, use double. http://www.lsi.upc.edu/~robert/teaching/master/material/p5-goldberg.pdf http://www.lsi.upc.edu/~robert/teaching/master/material/p5-g... If you have to implement a numeric or geometric algorithm, even as simple as "find the intersection of two infinite, non-parallel lines in 2D", use a library; don't code it yourself. https://stackoverflow.com/questions/8585427/precision-issues-with-segment-segment-intersection-code https://stackoverflow.com/questions/8585427/precision-issues... If you do code it yourself, study a reference that approaches things numerically, not merely symbolically; the usual symbolic approach taught in school is often not appropriate numerically. see e.g., https://en.wikipedia.org/wiki/Loss_of_significance#Instability_of_the_quadratic_equation https://en.wikipedia.org/wiki/Loss_of_significance#Instabili... Once you understand why you should teach beginning coders rules like the above, even though they're huge over-simplifications, then use your own common sense instead of these rules.