energia / Energia

Fork of Arduino for the Texas Instruments LaunchPad's
http://energia.nu
Other
793 stars 673 forks source link

exp(); bug msp430g2231, msp430g2452, msp430g2553 #327

Closed longinos closed 10 years ago

longinos commented 10 years ago

while i was cratin a little code for a neural network de IDE show this.

sketch_feb19a.cpp.o: In function loop': /home/longinos/energia-0101E0011/sketch_feb19a.ino:20: undefined reference toexp' /home/longinos/energia-0101E0011/sketch_feb19a.ino:27: undefined reference to `exp' collect2: ld returned 1 exit status

in the top of the sketch i have include the math.h library.... i dont know what to do.

here is all my code

include "math.h"

float sensor = P2_0; int ledPin = GREEN_LED;

float entrada = 0; long AUX = 0;

void setup() { Serial.begin(9600); pinMode(ledPin, OUTPUT);
pinMode(entrada, INPUT);
}

void loop() {

entrada = analogRead(sensor); entrada=map(entrada,0,4095,-6,6); AUX=1/(1+exp(-entrada));

Serial.println(AUX);

}

robertinant commented 10 years ago

Not sure why exp() is not available. This is the first time that I run into this. As a work-around for now you can replace exp() with expf();

robertinant commented 10 years ago

It turns out that exp() is not ANSI C and hence is not implemented in mspgcc. When we move to RedHat GCC these functions will be available. Until thenyou can replace exp() with expf().