Initial data commit
This commit is contained in:
parent
72d218235f
commit
f23f22d71c
199087 changed files with 3378941 additions and 0 deletions
7
Task/Test-integerness/Tcl/test-integerness-1.tcl
Normal file
7
Task/Test-integerness/Tcl/test-integerness-1.tcl
Normal file
|
|
@ -0,0 +1,7 @@
|
|||
proc isNumberIntegral {x} {
|
||||
expr {$x == entier($x)}
|
||||
}
|
||||
# test with various kinds of numbers:
|
||||
foreach x {1e100 3.14 7 1.000000000000001 1000000000000000000000 -22.7 -123.000} {
|
||||
puts [format "%s: %s" $x [expr {[isNumberIntegral $x] ? "yes" : "no"}]]
|
||||
}
|
||||
8
Task/Test-integerness/Tcl/test-integerness-2.tcl
Normal file
8
Task/Test-integerness/Tcl/test-integerness-2.tcl
Normal file
|
|
@ -0,0 +1,8 @@
|
|||
% set a 1.0000000000000001
|
||||
1.0000000000000001
|
||||
% expr $a
|
||||
1.0
|
||||
% IsNumberIntegral $a
|
||||
1
|
||||
% puts $a
|
||||
1.0000000000000001
|
||||
5
Task/Test-integerness/Tcl/test-integerness-3.tcl
Normal file
5
Task/Test-integerness/Tcl/test-integerness-3.tcl
Normal file
|
|
@ -0,0 +1,5 @@
|
|||
>>> a = 1.0000000000000001
|
||||
>>> a
|
||||
1.0
|
||||
>>> 1.0 == 1.0000000000000001
|
||||
True
|
||||
Loading…
Add table
Add a link
Reference in a new issue