x404.co.uk http://www.x404.co.uk/forum/ |
|
FLOPS http://www.x404.co.uk/forum/viewtopic.php?f=4&t=12270 |
Page 1 of 1 |
Author: | Fogmeister [ Thu Jan 27, 2011 1:42 pm ] |
Post subject: | FLOPS |
Just been learning about numbers and floats and stuff... Specifically learning the inadequacies of floating point operations (i.e. 10.0f * 0.03f <> 0.3f) Is using floats for arithmetic generally a bad idea or are the inacurracies something that most people aren't affected by? I can't imagine I'm going to be using anything like this for a while but I wanted to ask whilst I'm on this section of the book. |
Author: | JJW009 [ Thu Jan 27, 2011 4:21 pm ] |
Post subject: | Re: FLOPS |
You certainly need to be aware of their limitations and use them accordingly. It's particularly important when adding or subtracting numbers with very different indices. Where possible, formulae should be re-arranged so that any subtractions are done either at the very end or when operands are of similar size. Re-arranging a formulae with a couple of brackets can be the difference between them working satisfactorily or not. |
Author: | finlay666 [ Thu Jan 27, 2011 10:38 pm ] | |||||||||
Post subject: | Re: FLOPS | |||||||||
They are fine if it's an operation on a large number and you aren't too fussed about accuracy, we did have 0.3 store in the db as 0.300017 or so though so for precision use a double, decimal or similar |
Page 1 of 1 | All times are UTC |
Powered by phpBB® Forum Software © phpBB Group https://www.phpbb.com/ |