This is the mail archive of the
newlib@sourceware.org
mailing list for the newlib project.
Problem with ARM port and pow() function
- From: Fau Marz <faumarz at libero dot it>
- To: newlib at sourceware dot org
- Date: Wed, 10 Oct 2007 19:56:59 +0200
- Subject: Problem with ARM port and pow() function
Hi all!
I am using newlib with gcc in an ARM7 cross compiling toolchain (arm-elf-gcc)
and I've found a problem in using the pow(x,y) function.
The problem is like that: when in pow(x,y) the "y" factor is an integer, there
is no problem. But when the "y" factor is a double or float (for
example "2.1") there is a data exception and the program hangs. Crash.
To better explain, this is my code:
Alpha = pow((To/100.0), 2.0); // This works
Alpha = pow((To/100.0), 2.1); // This does not work: crash
"To" is a double, set to = 2500.0.
My toolchain:
I've tried gcc 4.1.1 and 4.2.0, and newlib 1.15.0
Then I've tried also compiling the last newlib CVS (yesterday's CVS: October
10, 2007).
The problem is the same.
Newlib is configured with:
./configure --target=arm-elf --prefix=/usr/cross/arm-elf --enable-interwork --enable-multilib --with-float=soft
The target CPU is NXP LPC2106, ROM mode (code executed in internal flash ROM).
If I use the formula:
Alpha = exp((2.1)*log(To/100.0));
It works correctly.
It seems (but I'm not sure, it's only an idea) a data write access to a "code"
(ROM) variable...
Anyone has any idea for solving this problem?
If you need more info or tests, please ask me.
Thank you!
Fausto
--
Faumarz