# Mathematical calculation with exponents

Hello everyone
With a MKR1310 board I've to calculate mathematical formulas related to the vapour saturation pressure like: Es = 6.11 * 10.0 exp(7.5 * t / 237.7 + t) where t is the temperature and is variable and (7.5 * t / 237.7 + t) is an exponent;
The pow function does not allow an exponent that is not numeric;
How to do it?
Thank you

Your topic is not specific to IDE 2.x and does not indicate a problem with the IDE; therefore it has been moved to a more suitable location on the forum.

Just use exp(x) if you want e as the base
Or pow(10, x) if you want 10 as the base.

so long a variable t is defined as a suitable data type exp() should work OK, e.g.

``````void setup() {
Serial.begin(115200);
double t=1.5;
double Es = 6.11 * exp10(7.5 * t / 237.7 + t) ;
Serial.println(Es);

}

void loop() {}
``````

serial monitor displays

``````215.46
``````

what do you want to pass if not a numeric value — text ?

Your code is as requested but wrong

It should be: `exp10(7.5 * t / (237.7 + t))`
then the result is 6.81

What does that mean ? The pow() function is just a function. And it works. You can call it. With parameters. It returns the right value.

``````void setup()
{
Serial.begin(115200);
double t=1.5;
double Es = 6.11 * pow(10.0,(7.5 * t / (237.7 + t)));
Serial.println(Es);
}

void loop() {}
``````

[UPDATE]
The build environment for the Raspberry Pi Pico seems to be wrong since the "exp10()" does not exist on the Pico. Tested in the Arduino IDE 1.8.19 and in Wokwi simulation.

`exp10()` is a GNU extension, available if `_GNU_SOURCE` is defined as a nonzero value, not availabale on AVR.

``````#define _GNU_SOURCE 1
#include <Arduino.h> // added here to make sure it is included *after* the define

...
``````

Of the 30+ cores I have on this computer only the ESP32 and ESP8266 cores have `-D_GNU_SOURCE` in `platform.txt`.

Thanks for the quick replies;
It's my fault because I didn't read the pow instructions well, I used float instead of double, now it works fine.

Float would be promoted to double by the compiler, that can’t be your issue.