Pages: [1]   Go Down
Author Topic: Using pow() from math.h  (Read 1051 times)
0 Members and 1 Guest are viewing this topic.
Montréal, Qc
Offline Offline
Full Member
***
Karma: 0
Posts: 185
Practice safe hex!
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

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??
Logged

"Pilots believe in a clean living... they never drink wisky from a dirty glass."

London, UK
Offline Offline
Newbie
*
Karma: 0
Posts: 20
If you can't open it, you don't own it.
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

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.
Logged

Montréal, Qc
Offline Offline
Full Member
***
Karma: 0
Posts: 185
Practice safe hex!
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

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.
Logged

"Pilots believe in a clean living... they never drink wisky from a dirty glass."

London, UK
Offline Offline
Newbie
*
Karma: 0
Posts: 20
If you can't open it, you don't own it.
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

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.
Logged

Pages: [1]   Go Up
Jump to: