enirwin
Mechanical
- Feb 14, 2002
- 46
I want a function to convert numbers from inches to mm using the following standard rules.
1) If the first significant digit of the metric value is greater than or equal to the first significant digit of the inch value, round the metric value to the same number of significant digits as the inch value.
2) If the first significant digit of the metric value is less than the first significant digit of the inch value, round the metric value to one more significant digit than the inch value.
So, I need to be able to identify the first significant digit and the number of significant digits of an input number. Once I know how to do this I think I can figure out the rest.
Thanks.
1) If the first significant digit of the metric value is greater than or equal to the first significant digit of the inch value, round the metric value to the same number of significant digits as the inch value.
2) If the first significant digit of the metric value is less than the first significant digit of the inch value, round the metric value to one more significant digit than the inch value.
So, I need to be able to identify the first significant digit and the number of significant digits of an input number. Once I know how to do this I think I can figure out the rest.
Thanks.