View Full Version : Lorenz attractor - help
Hi all
Im new propeller user and teaching basic programming
Is possible help me with basic FloatMath example ? specialy Lorenz attractor ?
(im using Arduino and any attractor programming not problem in arduino wire code)
Please help me - very very THANKS
Sorry my bad english
Mike Green
11-03-2010, 02:14 PM
There's nothing complicated about floating point programming on the Propeller. It's all function calls.
A := B + C
becomes
A := FAdd(B, C)
and
D := - E
becomes
D := FNeg(E)
If you have something more complex, you can either separate it out into individual operations or nest the functions calls.
A := (B + C) * (D - E)
becomes
A := FMul( FAdd( B, C ) , FSub( D, E ) )
Read the documentation that comes with the floating point library from the Propeller Object Exchange. It shows you the routines that come with each version of the library. FloatMath is written in Spin, so it's relatively slow. I recommend using one of the assembly language versions instead.
ElectricAye
11-03-2010, 02:29 PM
I've attached a little more info on FloatMath.
Very thanks info and examples :-)
And little question - is possible convert floating value to integer ? (for controlling sound or lcd etc...)
example floating value 1.256
integer value 1256
not rounded like 1
thanks
MacGeek117
11-03-2010, 02:52 PM
Absolutely, just multiply your fp number by 1000 in your case, and then truncate.
MG117
Mike Green
11-03-2010, 03:11 PM
That would be: FTrunc(FMul(1.256,1000.0))
My first working code :-)
Lorenz 3D fractal map and nokia 6100 lcd
Thanks previous help
Gingerbreadman fractal map