Hello

Is possible get an exponent value of variable and return integer?

for example:

float number=2E-5; somefunction(number)=-5;

Is the function like above exist?

Hello

Is possible get an exponent value of variable and return integer?

for example:

float number=2E-5; somefunction(number)=-5;

Is the function like above exist?

Values are not stored internally like that. They are stored in binary. You would have to write a function to do what you want.

Or explain why you want to do that, and perhaps we can suggest something.

How about repeatedly multiplying by 10 until the result is greater or equal to one and less than ten. The number of times you multiplied is the negitave exponent. Same principle for positave exponents with a divide in place of a multiply.

I can write a function doing that task. Howerer I'm wondering if arduino language has direct solution.

The integer part of log10() is the exponent. e.g. log10(.0001) is -4.00

Pete [edit] typo (I originally typed .00001)

Arduino uses C++. If you can do it in C++ you can do it in Arduino.

Thank you all, el_supremo your hint is the simplest. I calculate using large numbers and I need to show its at LCD screen.

I did some work to support SCIentific notation in the Arduino core - http://forum.arduino.cc/index.php?topic=166041.0 - Might contain some tricks

further check - http://www.nongnu.org/avr-libc/user-manual/group__avr__stdlib.html#ga6c140bdd3b9bd740a1490137317caa44 -