Re: math.h functions returning incorrect results

<[email protected]>
Newsgroups gmane.comp.handhelds.openzaurus.devel
Message-ID <[email protected]>
Hi,
 
Thanks for your reply. So do you think using -msoft-float might solve the problem. I do not have the device with me now, but will try it tomorrow.
 
Thanks,
Damjee

----- Original Message -----
From: Henry von Tresckow <[email protected]>
Date: Wednesday, November 22, 2006 23:44
Subject: Re: [Openzaurus-devel] math.h functions returning incorrect results
To: [email protected], [email protected]

> I think you might be running into soft vs hard float problems. 
> OpenZaurus 3.5.4 and above use softfloat and gcc 3.4. This is 
> the same 
> reason older sharp rom programs won't work on OZ.
> [email protected] wrote:
> > Hi All,
> >
> > I am using a Zaurus SL-5500 running OpenZaurus 3.5.4 ( 
> > 2.4.18-rmk7-pxa3-embedix) with  Opie 1.2.1.
> >
> > libm version =  libm-2.3.90.so
> >                          libm.so.6 -> libm-2.3.90.so
> >
> >
> > I am trying to compile and run the following code which uses 
> the 'cos' 
> > function in math.h.
> >
> > include <stdio.h>
> > #include <math.h>
> > #define pi 3.14159265358979
> >
> > int main(int argc, char **argv)
> > {
> >     double valtester,val11;
> >     valtester = 51.298351 * pi / 
> 180;   //converting degrees to radians
> >     
> printf("*[%f]\n",valtester);       
> >     printf("**[%f]\n",cos(valtester));
> > }
> >
> > ------------------------------------
> >
> > *Please note that the value 51.298351 above is not 
> significant, it is 
> > just an example.
> >
> > I am using the gcc cross compiler (gcc version 2.95.2 19991024 
> > (release)) to build the code with the following command.
> >
> > $ gcc -o test test.c -lm
> >
> > The code compiles and builds without any problem. However when 
> I run 
> > it on the Zaurus, the 'cos' funcitons returns incorrect values 
> (0.0000 
> > in the above case). The return values do not seem to be random 
> either, 
> > and it is not 0.0000 always either, but it is always 
> incorrect. For 
> > example the restuls are always wrong compared to the values I 
> get when 
> > I compile and run the same code on my linux desktop. Also what 
> is very 
> > interesting is that I tried the ARM cross combiled code on an 
> IPAQ 
> > h2200 running Familiar, which returned me the correct results.
> >
> > Any ideas how to get this working on the Zaurus, or what is 
> causing 
> > the problem.
> >
> > Thanks,
> > Damjee
> > ---------------------------------------------------------------
> ---------
> >
> > ---------------------------------------------------------------
> ----------
> > Take Surveys. Earn Cash. Influence the Future of IT
> > Join SourceForge.net's Techsay panel and you'll get the chance 
> to share your
> > opinions on IT & business topics through brief surveys - and 
> earn cash
> > 
> http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDEV> ------------------------------------------------------------------------
> >
> > _______________________________________________
> > Openzaurus-devel mailing list
> > [email protected]
> > https://lists.sourceforge.net/lists/listinfo/openzaurus-devel
> >   
> 
>

-------------------------------------------------------------------------
Take Surveys. Earn Cash. Influence the Future of IT
Join SourceForge.net's Techsay panel and you'll get the chance to share your
opinions on IT & business topics through brief surveys - and earn cash
http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDEV

_______________________________________________
Openzaurus-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/openzaurus-devel
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.