Add tasks for all the new languages
This commit is contained in:
parent
9dc3c2bb62
commit
bba7bfd280
13208 changed files with 134745 additions and 0 deletions
|
|
@ -0,0 +1,2 @@
|
|||
123→float{L₁}
|
||||
float{L₁}→I
|
||||
|
|
@ -0,0 +1 @@
|
|||
12.25→A
|
||||
|
|
@ -0,0 +1,14 @@
|
|||
' FB 1.05.0 Win64 (default dialect)
|
||||
|
||||
Dim a As Double = 123.456
|
||||
Dim b As Double = -123.0
|
||||
Dim c As Double = -123.0d
|
||||
Dim d As Double = -123e
|
||||
Dim e As Double = 743.1e+13
|
||||
Dim f As Double = 743.1D-13
|
||||
Dim g As Double = 743.1E13
|
||||
Dim h As Single = 743D! Rem ! overrides D
|
||||
Dim i As Single = 3.1!
|
||||
Dim j As Single = -123.456e-7f
|
||||
Dim k As Double = 0#
|
||||
Dim l As Double = 3.141592653589e3#
|
||||
|
|
@ -0,0 +1,6 @@
|
|||
0.0
|
||||
0.1
|
||||
-0.1
|
||||
1.2e3
|
||||
1.3e+3
|
||||
1.2e-3
|
||||
|
|
@ -0,0 +1,23 @@
|
|||
put 0.23
|
||||
-- 0.2300
|
||||
|
||||
-- activate higher printing precision
|
||||
the floatPrecision = 8
|
||||
|
||||
put -.23
|
||||
-- -0.23000000
|
||||
|
||||
put 9.00719925474099e15
|
||||
-- 9.00719925474099e15
|
||||
|
||||
-- result is NOT a float
|
||||
put 2/3
|
||||
-- 0
|
||||
|
||||
-- casting integer to float
|
||||
put float(2)/3
|
||||
-- 0.66666667
|
||||
|
||||
-- casting string to float
|
||||
put float("0.23")
|
||||
-- 0.23000000
|
||||
12
Task/Literals-Floating-point/Nim/literals-floating-point.nim
Normal file
12
Task/Literals-Floating-point/Nim/literals-floating-point.nim
Normal file
|
|
@ -0,0 +1,12 @@
|
|||
var x: float
|
||||
x = 2.3
|
||||
x = 2.0
|
||||
x = 0.3
|
||||
x = 123_456_789.000_000_1
|
||||
x = 2e10
|
||||
x = 2.5e10
|
||||
x = 2.523_123E10
|
||||
x = 5.2e-10
|
||||
|
||||
var y = 2'f32 # Automatically a float32
|
||||
var z = 2'f64 # Automatically a float64
|
||||
|
|
@ -0,0 +1,5 @@
|
|||
3.14
|
||||
1.0e-12
|
||||
0.13
|
||||
1000.0
|
||||
.22
|
||||
|
|
@ -0,0 +1,7 @@
|
|||
?1e+12 -- (same as 1e12)
|
||||
?1e-12
|
||||
?5 -- (same as 5.0)
|
||||
--?1. -- (illegal, use 1 or 1.0)
|
||||
?.1 -- (same as 0.1)
|
||||
?1/3 -- 0.333333
|
||||
printf(1,"%g %G\n",1e-30)
|
||||
|
|
@ -0,0 +1,4 @@
|
|||
say 1.234;
|
||||
say .1234;
|
||||
say 1234e-5;
|
||||
say 12.34e5;
|
||||
|
|
@ -0,0 +1,9 @@
|
|||
let double = 1.0 as Double // Double precision
|
||||
let float = 1.0 as Float // Single precision
|
||||
let scientific = 1.0E-12
|
||||
|
||||
// Swift does not feature type coercion for explicit type declaration
|
||||
let sum = double + float // Error
|
||||
|
||||
let div = 1.1 / 2 // Double
|
||||
let div1 = 1 / 2 // 0
|
||||
|
|
@ -0,0 +1,11 @@
|
|||
1.
|
||||
1.0
|
||||
2432311.7567374
|
||||
1.234E-10
|
||||
1.234e-10
|
||||
758832d
|
||||
728832f
|
||||
1.0f
|
||||
758832D
|
||||
728832F
|
||||
1.0F
|
||||
|
|
@ -0,0 +1,7 @@
|
|||
1.0 => 1
|
||||
1.2 => 1.2
|
||||
1e10 => 10000000000
|
||||
1e100 => 1e+100
|
||||
1e1234 => 1.7976931348623157e+308
|
||||
.1 => 0.1
|
||||
.1e1 => 1
|
||||
Loading…
Add table
Add a link
Reference in a new issue