KNOWLEDGE BASE
Log In    |    Knowledge Base    |    4D Home
Tech Tip: Handling real number data
PRODUCT: 4D | VERSION: 2004 | PLATFORM: Mac & Win
Published On: January 30, 2007

When dealing with real numbers computers use floating point arithmetic. A floating point real number is represented as a set of bits. These bits can then be manipulated with the use of some arithmetic to mimic arithmetic operations done with real numbers. Unfortunately, floating point math creates the potential for introducing inaccuracies in calculations. For more detailed information regarding these inaccuracies see:

https://en.wikipedia.org/wiki/Floating_point

To minimize erroneous or invalid real number data in your 4D applications, use the Round and/or Trunc commands to specify how many significant digits your real number data will use.

Documentation for the Round command:
https://www.4d.com/docs/CMU/CMU00094.HTM

Documentation for the Trunc command:
https://www.4d.com/docs/CMU/CMU00095.HTM

Related Sources:

Comparing real numbers to 'n' significant digits.
https://kb.4d.com/assetid=5344

Set Real Comparison Level
https://kb.4d.com/assetid=31286