Not if you're calculating the mass defect of an atom nucleus decaying by beta-radiation
Which he isn't doing...
True enough.. though a double float would work fine.
In which case choosing stock float as the data type to use is quite obviously a baaaaaaaaaaaaaaaaaad idea.
only has about 15-17 decimal digits of significant precision. Yes, it's more than a float
, but it all depends on what you're doing
with your data. Both float
s and double
s can approximate 4.014e-31, which isn't the problem (and subsequently, both can approximate 4.014e-31 + 4.014e-31 pretty well). Usually, the problem isn't "Can a float
represent this number?" but instead "Can a float
approximate the mathematical operation between these two (or more) numbers?" Just throwing out a small number doesn't mean that float
s are ruled out; it all depends on what you're doing with that small number.
I'm not saying a double
wouldn't work or that it wouldn't be the better choice in your case. I'm saying it isn't the number
that's usually limiting you, it's usually the numbers
and what you're doing
with the numbers. It's a subtle but significant difference of focus.