View Full Version : Exp10 function in spin
07-01-2009, 06:42 PM
Does anyone have the EXp10 function coded in spin?
I have no cogs left so I can't use the FloatMath functions.
07-01-2009, 07:56 PM
If you don't use FloatMath, is the result you need a float? Do you expect negative exponents?
07-01-2009, 08:11 PM
Sorry, my error - I am using FloatMath but it does not have an EXP10 function. Float32, Float32A etc have the function but are written in assembler and need a cog to run.
07-01-2009, 08:22 PM
ten_exp long 10.0 & %0111111110000000000000000000000
ten_mant long 10.0 & %0000000001111111111111111111111
pub exp10( exp )
return (ten_exp+%0111111110000000000000000000000 & (exp<<22)) & %0111111110000000000000000000000 + ten_mant
quick and dirty because it does not check for overflow. So, as long as you don't deal with to big exponents.
*Note: this is theory ... let's see if it works in practice ;o) *