Literals/Floating point: Difference between revisions
Added Wren
Thundergnat (talk | contribs) (Rename Perl 6 -> Raku, alphabetize, minor clean-up) |
(Added Wren) |
||
Line 1,389:
{{out}}
<pre>-1,#IND</pre>
=={{header|Wren}}==
Wren has just one kind of floating point literal which must have digits both before and after the decimal point. Forms such as ''123.'' and ''.123'' are not allowed.
Negative zero can be represented directly but infinities or NaN cannot.
It is also possible to represent floating point numbers using scientific notation.
All numbers are instances of the built-in Num class which is always 8 bytes in size. Integers are really just floating point numbers which have no decimal part.
<lang ecmascript>var f = 123.45
var g = 0.12345 // .12345 not allowed
var h = 1.234e2
var i = -0.0
System.print([f, g, h, i])</lang>
{{out}}
<pre>
[123.45, 0.12345, 123.4, -0]
</pre>
=={{header|XPL0}}==
|