Monta Vista Linux Supporting Floating Point operations
Hi All,
I am working on 440GP using Monta Vista Linux 2.1. I need floating point operation support (for eg. function sqrt() for calculating square root of given float variable) on Linux. I didn't find math emualtion on the Linux. Can anyone tell me how can I get floating point support ?
Thanks in advance.
Regards,
Vishwanath
** Sent via the linuxppc-embedded mail list. See http://lists.linuxppc.org/
Quoted 3 lines · you
I am working on 440GP using Monta Vista Linux 2.1. I need floating point operation support (for eg. function
sqrt()for calculating square root of given float variable) on Linux. I didn't find math emualtion on the Linux.
This is strange.
Floating point emulation IS available in MVL2.1 on 440. You probably forgot to link with libm.
I just typed trivial test and ran it on our custom 440 board:
main.cpp:
----------------------------------------------
#include <stdio.h>
#include <math.h>
int main(int argc, char* argv[]){
printf("sqrt(10) = %f\n", sqrt(10.0)); return 0;
}
----------------------------------------------
Compile and run:
# gcc test.cpp -lm # ./a.out sqrt(10) = 3.162278 #
Regards,
Eugene Surovegin <mailto:[email protected]>
** Sent via the linuxppc-embedded mail list. See http://lists.linuxppc.org/
Quoted 6 lines · Vishwanath
Hi All,
I am working on 440GP using Monta Vista Linux 2.1. I need floating point operation support (for eg. function
sqrt()for calculating square root of given float variable) on Linux. I didn't find math emualtion on the Linux. Can anyone tell me how can I get floating point support ?
Floating point support in MontaVista Linux is handled by the compiler and _NOT_ the kernel. In architecting our system we have weighed the tradeoffs between soft-floating point, or hard-floating point using kernel exceptions. Soft-floating point was found to be superior so we use it on all platforms without a hardware FPU.
One thing to note, because of this the ABI is slightly different then the binaries you would download off of a random community website. You need to use our compiler (or a community compiler configured appropriatly) to build soft-float. (On a non-MontaVista compiler, you usually need to pass -msoft-float on the command line to gcc.)
--Mark
** Sent via the linuxppc-embedded mail list. See http://lists.linuxppc.org/