A: 

Well, it depends on how exact you want to be. Remember than when talking about engineering, it isn't enough to just store the number 3.20, because 3.2 isn't the same as 3.20 when it comes to engineering. 3.20 implies higher accuracy than 3.2, which could be 3.15 <= x < 3.25.

Lasse V. Karlsen
+2  A: 

I think engineering data usually isn't precise enough to worry about the difference. You know the engineer's expression "measure with a micrometer, mark it with chalk, cut with an axe". That about sums it up. Worrying about the difference between 8 significant figures or 12 in a calculation on something that is built in the real world to 2 significant figures tolerance just doesn't make sense.

Paul Tomblin
-1: It certainly can make a difference when used in repeated calculations. It will depend on the problem domain, of course, but small errors have a cumulative affect over time.
Ken Gentle
@Ken G, you obviously don't understand precision.
Paul Tomblin
+1 because you are right: If the measurement has a relative error of 1%, any accumulated error needs a lot of accumulation to become bigger than that.
Treb
Maybe I misunderstand your answer -- I read that you're saying "Don't worry about it - it doesn't make a difference". Including 8 or 12 sigfigs in a calculation that has only 2 can lead to bad results, which is where I disagree with the answer.
Ken Gentle
@Ken, You make the calculations with "enough" sigfigs (ie more than you need) and then throw away the insignificant parts. So multiplying two numbers with more precision than you need isn't going to make your result worse once you discard the unneccessary parts.
Paul Tomblin
@Paul: We're in violent agreement. Sorry for the misunderstanding (+1)
Ken Gentle
@Paul: DARN - I can't undo the downvote (too old) - I'll go find something else you've said to upvote.
Ken Gentle
@Ken - Don't worry about the vote thing. This weekend I fulfilled a lifelong dream and beat Jeff Atwood and got to the first page of the users!
Paul Tomblin
+6  A: 

Keep significant figures in mind -- the accuracy of the measurement. If the PSI is known to only whole pounds, then after conversion to Pa there are 15 decimals, there is still only one significant figure.

Precision is different from accuracy, and performing floating point operations on engineering units need to take this into account during the operations - don't store more precision than the accuracy of the measurement, don't use more precision in a calculation than is known.


Edit:

You might also consider using NUMERIC(p,s) where the precision (number of digits) and scale (number of digits to the right of the decimal) can be explicitly specified.

If that is not an option, consider persisting the accuracy for a particular measurement so that it may be reported and/or used in calculations.

Ken Gentle
That assumes that the accuracy of the measurement is known. From my experience, that is often not the case.
Treb
@Treb: Agreed - different problem domains have differing requirements and assumptions. Sometimes it comes down to making conservative assumptions or limiting accuracy assumptions to the least accurate measurement.
Ken Gentle
+3  A: 

I think as long as you're able to store exactly as much precision as you actually have, you have no reason to worry.

Using the example you gave of converting PSI to pascals (1 PSI = 6 894.75 pa), If I take a measurement of say 14.7 PSI and convert it to pascals I get 101,352.825. That's too much precision. You'd need to store that as 101,000 to reflect the real precision of the measurement, not the calculation.

Keep in mind that any numbers you use to do conversion need to be at least as precise as your measurements so you don't lose precision during conversion. It's best to have more digits of precision (at least one more) in your conversion factors than in your measurements.

Bill the Lizard
What if the measurement is 101.000, but with six significant figures? How do you store that it is exactly 101.000, not 101 x 10^3?
Treb
You have to know how many significant digits you store. Then it doesn't matter if you store 101, 101.000, or 101.000000000001, you always know that six digits are significant.
Bill the Lizard
+1  A: 

To avoid loss of precision due to unit conversion, you can store all data that comes from measurement in the unit that it was measured in. Of course that means that you may end up with some pressure values being stored in Pa, others in Psi, or even mmHg. You have to decide yourself if that introduces more problems than it solves.

And I agree with the other answers: In most cases, the precision offered by an Oracle float is far higher than the precision of the measurement itself.

Treb