Go Down

Topic: Using pow() from math.h (Read 1 time) previous topic - next topic

xSmurf

I have included math.h in my sketch in the intention of using the pow() function. However, if I use the function the program won't build anymore and bails out with:

/Users/xsmurf/Applications/Development/Arduino/arduino-0006/tools/avr/bin/../lib/gcc/avr/4.0.3/../../../../avr/bin/ld: region text is full (/tmp/build33002.tmp/Parallax_4x4_Keypad_74C922.elf section .text)

Couldn't determine program size: tools/avr/bin/avr-size: '/tmp/build33002.tmp/Parallax_4x4_Keypad_74C922.hex': No such file


Any ideas how I could make this work??
"Pilots believe in a clean living... they never drink wisky from a dirty glass."

Lionel Lemarie

Hi xSmurf,

If you're just after pow(), can't you just implement it yourself ?

There's many clever ways to implement it, but even just a for loop would do it.

Of course this is no use to you if you want to use other math functions.

Hope this helps,
Lionel.

xSmurf

Myeah you're right, but I was mostly asking about the error, pow isn'wasn't really my motivation, it was mostly out of curiosity.
"Pilots believe in a clean living... they never drink wisky from a dirty glass."

Lionel Lemarie

Fair enough.

How big is your program when you don't use the function ? Is there enough space for the math lib ?

If you make an empty program and compile it, then just call pow() and compile it again; what is the size difference ? (Sorry I'm nowhere near my arduino, I can't try it just yet).

Maybe this thread can help you : http://www.arduino.cc/cgi-bin/yabb2/YaBB.pl?num=1164904468/2
It explains how to reduce the overall size of your program by ~1KB.

Hope this helps,
Lionel.

Go Up