|
Jonathan Wilson wrote:
> > But doing float with the brick is s-l-o-w, better avoid it if you can.
> Mabie Fixed Point is an answer.
For most brick projects I can think of, it is. If you want to travel
your robot around, you will have to deal with sin, cos, tan and square root.
First thing you can do is working with tables to avoid "on the fly" sin
calculation. Second, you could multiply your table values with a factor
and get int (or long) values instead. For example, a sinus value for 45°
could be stored as 707 when you multiplied it by 1000.
Regards,
Michael
|
|
Message is in Reply To:
| | Re: Float and int
|
| (...) Mabie Fixed Point is an answer. I dont know how it works but I have a book that suggests that a decent Fixed Point library can be faster than Floating Point if there isnt an FPU available. (22 years ago, 30-Dec-02, to lugnet.robotics.rcx.legos)
|
6 Messages in This Thread:
- Entire Thread on One Page:
- Nested:
All | Brief | Compact | Dots
Linear:
All | Brief | Compact
|
|
|
|