Add a bunch of new languages
This commit is contained in:
parent
1e05ecd7ee
commit
2a4d27cea0
158 changed files with 1469 additions and 0 deletions
2
Task/Infinity/ActionScript/infinity.as
Normal file
2
Task/Infinity/ActionScript/infinity.as
Normal file
|
|
@ -0,0 +1,2 @@
|
|||
trace(5 / 0); // outputs "Infinity"
|
||||
trace(isFinite(5 / 0)); // outputs "false"
|
||||
18
Task/Infinity/Eiffel/infinity.e
Normal file
18
Task/Infinity/Eiffel/infinity.e
Normal file
|
|
@ -0,0 +1,18 @@
|
|||
class
|
||||
APPLICATION
|
||||
inherit
|
||||
ARGUMENTS
|
||||
create
|
||||
make
|
||||
feature {NONE} -- Initialization
|
||||
number:REAL_64
|
||||
make
|
||||
-- Run application.
|
||||
do
|
||||
number := 2^2000
|
||||
print(number)
|
||||
print("%N")
|
||||
print(number.is_positive_infinity)
|
||||
print("%N")
|
||||
end
|
||||
end
|
||||
11
Task/Infinity/R/infinity.r
Normal file
11
Task/Infinity/R/infinity.r
Normal file
|
|
@ -0,0 +1,11 @@
|
|||
Inf #positive infinity
|
||||
-Inf #negative infinity
|
||||
.Machine$double.xmax # largest finite floating-point number
|
||||
is.finite # function to test to see if a number is finite
|
||||
|
||||
# function that returns the input if it is finite, otherwise returns (plus or minus) the largest finite floating-point number
|
||||
forcefinite <- function(x) ifelse(is.finite(x), x, sign(x)*.Machine$double.xmax)
|
||||
|
||||
forcefinite(c(1, -1, 0, .Machine$double.xmax, -.Machine$double.xmax, Inf, -Inf))
|
||||
# [1] 1.000000e+00 -1.000000e+00 0.000000e+00 1.797693e+308
|
||||
# [5] -1.797693e+308 1.797693e+308 -1.797693e+308
|
||||
5
Task/Infinity/Racket/infinity.rkt
Normal file
5
Task/Infinity/Racket/infinity.rkt
Normal file
|
|
@ -0,0 +1,5 @@
|
|||
#lang racket
|
||||
|
||||
+inf.0 ; positive infinity
|
||||
(define (finite? x) (< -inf.0 x +inf.0))
|
||||
(define (infinite? x) (not (finite? x)))
|
||||
3
Task/Infinity/Scheme/infinity.ss
Normal file
3
Task/Infinity/Scheme/infinity.ss
Normal file
|
|
@ -0,0 +1,3 @@
|
|||
+inf.0 ; positive infinity
|
||||
(define (finite? x) (< -inf.0 x +inf.0))
|
||||
(define (infinite? x) (not (finite? x)))
|
||||
6
Task/Infinity/Smalltalk/infinity-2.st
Normal file
6
Task/Infinity/Smalltalk/infinity-2.st
Normal file
|
|
@ -0,0 +1,6 @@
|
|||
[
|
||||
1.0 / 0.0
|
||||
] on: ZeroDivide do:[:ex |
|
||||
ex proceedWith: (Float infinity)
|
||||
]
|
||||
-> INF
|
||||
2
Task/Infinity/Smalltalk/infinity.st
Normal file
2
Task/Infinity/Smalltalk/infinity.st
Normal file
|
|
@ -0,0 +1,2 @@
|
|||
Float infinity -> INF
|
||||
1.0 / 0.0 -> "ZeroDivide exception"
|
||||
Loading…
Add table
Add a link
Reference in a new issue