Literals/Floating point: Difference between revisions

Content added Content deleted
(Added EasyLang implementation)
Line 797: Line 797:


=={{header|Kotlin}}==
=={{header|Kotlin}}==
There are two floating point types: Double (64 bits) and Float (32 bits). The default floating point type is Double.
<syntaxhighlight lang="scala">val d: Double = 1.0

val d2: Double = 1.234e-10
Double literals must end with a decimal point with at least one digit after it, and/or a scientific notation suffix made with <code>e</code> (or <code>E</code>) followed by an integer literal.
val f: Float = 728832f

val f2: Float = 728832F</syntaxhighlight>
A Float literal is made by appending <code>f</code> (or <code>F</code>) to a Double or Int literal (see [[Literals/Integer#Kotlin|integer literals]]).

<syntaxhighlight lang="kotlin">
val d = 1.0 // Double
val d2 = 1.234e-10 // Double
val f = 728832f // Float
val f2 = 7.28832e5F // Float
</syntaxhighlight>


=={{header|Lasso}}==
=={{header|Lasso}}==