## Literal Numbers

Integer literals are 32-bit and can be created from decimals as well as hexadecimals:

``````val a = 2
val b = 31
val c = 0x30f
val e = 0
val f = -2
val g = -31
val h = -0x30f
a should be(res0)
b should be(res1)
c should be(res2) //Hint: 30F = 783
e should be(res3)
f should be(res4)
g should be(res5)
h should be(res6)``````

Long literals are 64-bit. They are specified by appending an `L` at the end of the declaration:

``````val a = 2L
val b = 31L
val c = 0x30fL
val e = 0L
val f = -2L
val g = -31L
val h = -0x30fL

a should be(res0)
b should be(res1)
c should be(res2) //Hint: 30F = 783
e should be(res3)
f should be(res4)
g should be(res5)
h should be(res6)``````

Float and Double literals conform to IEEE-754. Floats are 32-bit, while doubles are 64-bit. Floats can be defined using a f or F suffix, while doubles use a d or D suffix. Exponents are specified using e or E.

``````val a = 3.0
val b = 3.00
val c = 2.73
val d = 3f
val e = 3.22d
val f = 93e-9
val g = 93e-9
val h = 0.0
val i = 9.23e-9d

a should be(res0)
b should be(res1)
c should be(res2)
d should be(res3)
e should be(res4)
f should be(res5)
g should be(res6)
h should be(res7)
i should be(res8)``````