Float32 f.exp
The rangefinder I am using for a project is connected to an ADC and I need to use the equation below to get the proper range values from the ADC. There is little documentation for float32 especially the exp.
my equation is dist=66.928e^(-0.01*ADC value)
obj
f: "float32"
pub
f.start
f.exp( this is where I am lost)
Do I need to do just the e^( ) portion and save that as one variable and then multiply that by the 66.928 and do everything in pieces or can I do it all as one?
I would appreciate any help with the equation.
Thanks
my equation is dist=66.928e^(-0.01*ADC value)
obj
f: "float32"
pub
f.start
f.exp( this is where I am lost)
Do I need to do just the e^( ) portion and save that as one variable and then multiply that by the 66.928 and do everything in pieces or can I do it all as one?
I would appreciate any help with the equation.
Thanks

Comments
untested, getADC returns an integer
[code]
r := f.fround(f.fmul(66.928, f.exp(f.fmul(-0.01, f.ffloat(getADC)))))
'or
r := f.fmul(66.928, f.exp(f.fmul(-0.01, f.ffloat(getADC))))
r:=f.fround(r)
CON _clkmode = XTAl1|PLL16X _xinfreq = 5_000_000 OBJ serial: "FullDuplexSerial" f: "Float32" s: "FloatString" PUB null | r serial.start(31, 30, %0000, 115200) f.start waitcnt(clkfreq*3 + cnt) r := f.fmul(66.928, f.exp(f.fmul(-0.01, f.ffloat(getADC)))) serial.str(s.FloatToString(r)) serial.tx(13) serial.dec(f.fround(r)) serial.tx(13) PRI getADC return 42 DATgives me:r:=f.fmul(2427.0,f.pow(f.ffloat(adcOut),-1.095)) r:=f.fround(r) pst.str(fstring.floattostring(r))I get 1.401299e-44 and I am expecting a value from 6-48 depending on the adc value. Is there a way to only show 1 decimal? Without the rounding function I get 10.27675 at a set range.
PUB FRound(a) {{Convert floating point to integer (with rounding). Parameters: a 32-bit floating point value Returns: 32-bit integer value }}