Re: [Flashforth-devel] Floating point math for FF 5.x - IEEE-754 format - Part II.
Brought to you by:
oh2aun
From: om1zz <om...@vo...> - 2015-05-16 11:27:03
|
Part II. This is a short intro how the single precision (32bit) floating point numbers work in the lib: We need to process some data coming from ADC, 9DOF, I2C sensors with our FF system, of course :) To process integers you may use the s>f and d>f words for conversion to float. For example, with "precison" set to 7 (6decimal places) for printing with fs. : 16bit signed integers: 100 s>f fs. 1.000000E2 ok<#,ram> -100 s>f fs. -1.000000E2 ok<#,ram> 30001 s>f fs. 3.000100E4 ok<#,ram> -30001 s>f fs. -3.000100E4 ok<#,ram> 32bit signed integers: 12000000. d>f fs. 1.200000E7 ok<#,ram> -12000000. d>f fs. -1.200000E7 ok<#,ram> 12345678. d>f fs. 1.234568E7 ok<#,ram> 10000000. d>f 10000000. d>f f* fs. 1.000000E14 ok<#,ram> -1000000. d>f 1. d>f f+ fs. -9.999990E5 ok<#,ram> Happy floating! I. |