Difference between revisions of "Floating-point constants"

From Microduino Wiki
Jump to: navigation, search
Line 6: Line 6:
 
<pre style="color:green">
 
<pre style="color:green">
 
Floating-point number Transformation Transformation
 
Floating-point number Transformation Transformation
10.0                 10
+
10.0               10
 
2.34E5         2.34 * 10^5         234000
 
2.34E5         2.34 * 10^5         234000
67E-12               67.0 * 10^-12     0.000000000067
+
67E-12               67.0 * 10^-12       0.000000000067
 
</pre>
 
</pre>
 
[[https://wiki.microduino.cc/index.php/Arduino_Syntax_Manual Return to Arduino Syntax Manual]]
 
[[https://wiki.microduino.cc/index.php/Arduino_Syntax_Manual Return to Arduino Syntax Manual]]

Revision as of 03:42, 18 August 2016

Floating-point constants Similar to int constants, floating-point constants can make the code more readable. Floating-point constants are transformed into the values of their expressions when compiling.

  • Example

n = .005; Floating-point numbers can be represented in scientific notation. 'E' and 'e' both can be used as effective index signs.

Floating-point number		Transformation		Transformation
10.0 		               10
2.34E5			        2.34 * 10^5	        234000
67E-12		               67.0 * 10^-12	      0.000000000067

[Return to Arduino Syntax Manual]