Skip to content

Instantly share code, notes, and snippets.

@forkineye
Last active August 29, 2015 14:26
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save forkineye/d05909c5c0184c7300ae to your computer and use it in GitHub Desktop.
Save forkineye/d05909c5c0184c7300ae to your computer and use it in GitHub Desktop.
ESP8266 Arduino pow() issue with floats in loops
void setup() {
Serial.begin(115200);
Serial.println("");
float x = 2.0;
float y = 2.2;
int i;
for(i = 0; i < 10; i++) {
Serial.println(pow(i, x));
Serial.println(pow(i, y)); // Fails to compile
}
Serial.println(pow(i, y)); // Compiles fine, 10 ^ 2.2
}
void loop() {
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment