On Wed, May 01, 2002 at 04:29:03PM +0200, [EMAIL PROTECTED] wrote:
> has anyone ever managed to get trigonometric functions like sin cos or atan
> to work using only mathf.h / libmf.a included with prc-tools
Code based on yours works fine for me.
> the trigonometrics
> always give 0 (prc-tools2.1, random crap value with prc-tools2.0).
(There is as yet no such thing as prc-tools 2.1.)
> float v, t1;
>
> t1=1;
>
> v=atan(t1);
>
> //v is 0 now but should be 0,78539816339744830961566084581988
[...]
> StrIToA(outputstringarray2, (Int16)v);
How do you know v is 0 at this point?
If you're printing it out via StrIToA(foo,(Int16)v) then of course the
cast will print 0.785398... as 0.
Try writing "t1=1.0" instead. If this fixes v, you'll know that you are
actually using the ancient and buggy prc-tools 2.0.
Otherwise I don't have any interesting ideas: similar code to yours
printed 0.0, 0.7853, 45.0 just fine (well, actually I printed out
(long)(1000000L * x), which is an easy quick and nasty way to dump the
values of floating point variables on Palm OS).
John
--
For information on using the Palm Developer Forums, or to unsubscribe, please see
http://www.palmos.com/dev/support/forums/