Literals/Floating point: Difference between revisions

Content deleted Content added
Adds Clojure section
Line 100:
Why does 6.4.4.2 seem to disallow negative floats? Clearly this isn't the intent... maybe -1.2 is considered to be the unary negation of 1.2?
-->
 
=={{header|Clojure}}==
 
Clojure supports both standard and scientific notation.
 
<pre>user=> 1.
1.0
user=> 1.0
1.0
user=> 3.1415
3.1415
user=> 1.234E-10
1.234E-10
user=> 1e100
1.0E100
user=> (Float/valueOf "1.0f")
1.0</pre>
 
Clojure also supports returning ratios (fractions) if you divide integers. These are not subject to roundoff error. If you do specify a floating point in the division, it will return a floating point value.
<pre>user=> (/ 1 3)
1/3
user=> (/ 1.0 3)
0.3333333333333333</pre>
 
=={{header|Common Lisp}}==