4D v15Real numbers, Reduction of number of significant digits |
|||||||||||
|
4D v15
Real numbers, Reduction of number of significant digits
|
Operation | Result in 4D < v15 | Result in 4D v15 and higher |
String(3216.36 - 3214.89) | "1.47000000000025" | "1.47" |
String(0.321636-0.321489) | "0.000146999999999953" | "0.000147" |
Using 13 significant digits for real numbers is usually adequate for computer applications and improves processing of these numbers. Remember that computer calculations on real numbers are always made by approximation since these numbers are expressed internally on a binary basis and not a decimal one. The number of significant digits allows the conversion algorithm to perform the rounding and approximations needed to obtain the expected representation. Similarly, equality comparisons on real numbers are done by analyzing the result when the two numbers are subtracted from each other (in 4D, the degree of accuracy by default of these comparisons can be modified using the SET REAL COMPARISON LEVEL command).
If your 4D application uses the first 15 digits of real numbers, you may need to use other data formats, such as text or long integers. Note that, as explained above, real numbers are not suitable for storage and/or calculation of values with large numbers of significant digits, like serial numbers or astronomical measurements, since their accuracy is limited in nature.
Product: 4D
Theme: Language
4D v15 - Upgrade (standard edition) ( 4D v15)