set-precision  ( n -- )

published: 9 January 2022 / updated 1 December 2023

Lire cette page en français

 

vocabulary: forth

Changes the display precision of Real numbers.

The calculation precision on real numbers stops at 6 decimal places. If you request a precision greater than 6 on the decimal places of real numbers, the values displayed beyond 6 decimal places will be false.

Example:

pi f.    \ display 3.141592 
2 set-precision 
pi f.    \ display 3.14 
 
20 set-precision 
1e 3e f/ f.   \ display 0.33333350400826286262 

Legal: site web personnel sans commerce / personal site without seling