Subject:
|
Re: C standard functions with legOS?
|
Newsgroups:
|
lugnet.robotics.rcx.legos
|
Date:
|
Fri, 27 Apr 2001 15:16:34 GMT
|
Viewed:
|
1681 times
|
| |
| |
Michael Wisse wrote:
>
> Is it possible to use functions from C standard libraries with legOS,
> e.g. sin() from math.h or abs() from stdlib.h?
>
> They are a part of gcc, but e.g. math.h seems to produce compiler
> errors.
As other people have pointed out, its not possible to use them straight
off.
I've written some floating point code for my own use to do conversions
between rectangular (x,y) and polar (dist, bearing) calculations.
The codes not documented I'm afraid, but I've put it at
http://www.dur.ac.uk/k.e.elby/math_for_rcx/ in case it is some use.
Note that mymath.c uses a lookup table approach, while mymath_cordic.c
uses an approximation method called CORDIC and is therefore more
accurate. Unlike mymath.c, mymath_cordic does implement sin, cos, sqrt
and atan (which are not in mymath.h, the header).
Both approaches use about 2k of memory AFAIK.
Kieran
|
|
Message is in Reply To:
| | C standard functions with legOS?
|
| Is it possible to use functions from C standard libraries with legOS, e.g. sin() from math.h or abs() from stdlib.h? They are a part of gcc, but e.g. math.h seems to produce compiler errors. Best regards. Michael Wisse (24 years ago, 25-Apr-01, to lugnet.robotics.rcx.legos)
|
5 Messages in This Thread:
- Entire Thread on One Page:
- Nested:
All | Brief | Compact | Dots
Linear:
All | Brief | Compact
|
|
|
|