Go Down

Topic: I am using intel edison & have a variable in float. what is its max range? (Read 42 times) previous topic - next topic

prag93

I am using intel edison board. The maximum range stated on the website float variable is 3.4028235E+38 to -3.4028235E+38 (http://arduino.cc/en/Reference/Float). I need value upto two decimal points for the project. I was testing my system and found the value go as high as 1040.80 after that i stopped testing. I need to know the maximum value that i can store in a float variable.

I am making an arduino based project and have a variable in float to measure distance. What is the maximum range of float?

Delta_G

Yes, I think that is the right number for a 32 bit float.  Either way, it's going to be way way larger than any distance you plan to measure with Arduino.  3*10^38 meters would be on the order of 36000000000000000000000 light years.  That's about 400 billion times the diameter of the known universe. 

I think you'll be alright with whatever number you need to use. 

But you could always have more precision, less error, and faster calculations if you used long integers and used fixed point math.  If you need meters to 2 decimals, then use millimeters instead.  Need millimeters to 2 decimals, use micrometers instead.  You can always scale it so you're only working with integers. 
Ad hoc, ad loc, and quid pro quo.  So little time - so much to know!  ~Jeremy Hillary Boob Ph.D

Go Up
 


Please enter a valid email to subscribe

Confirm your email address

We need to confirm your email address.
To complete the subscription, please click the link in the email we just sent you.

Thank you for subscribing!

Arduino
via Egeo 16
Torino, 10131
Italy