|
Please define "is not working"
# gcc mathtest.c -omathtest /lib/libm.so.0 # ./mathtest 3.178050 3.178050 3.162278 # cat mathtest.c #include <stdio.h> #include <math.h> int main(int argc, char **argv) { float x, y; // this is working x = sqrt(10.1); printf("%f\n", x); // none of these are float a = 10.1; int b = 10; x = sqrt(a); y = sqrt(b); printf("%f %f\n", x, y); } # gcc -v Using built-in specs. Target: arm-unknown-linux-uclibcgnueabi Configured with: /home/ct/buildroot-2011.05/output/toolchain/gcc-4.3.5/configure --prefix=/usr --build=x86_64-unknown-linux-gnu --host=arm-unknown-linux-uclibcg nueabi --target=arm-unknown-linux-uclibcgnueabi --enable-languages=c,c++ --with- gxx-include-dir=/usr/include/c++ --disable-__cxa_atexit --enable-target-optspace --disable-libgomp --with-gnu-ld --disable-libssp --disable-multilib --disable-t ls --disable-shared --disable-nls --enable-threads --disable-decimal-float --wit h-float=soft --with-abi=aapcs-linux --with-arch=armv5te --with-tune=arm926ej-s - -with-pkgversion='Buildroot 2011.05' --with-bugurl=http://bugs.buildroot.net/ Thread model: posix gcc version 4.3.5 (Buildroot 2011.05)
# gcc powtest.c -opowtest /lib/libm.so.0 # ./powtest 151.290005 3.507136 # cat powtest.c #include <stdio.h> #include <math.h> int main(int argc, char **argv) { float x = 12.3; printf("%f\n", pow(x,2)); printf("%f\n", pow(x,0.5)); }
|