Add a bunch of new languages

This commit is contained in:
Ingy döt Net 2013-04-09 00:31:41 -07:00
parent 1e05ecd7ee
commit 2a4d27cea0
158 changed files with 1469 additions and 0 deletions

View file

@ -0,0 +1,2 @@
trace(5 / 0); // outputs "Infinity"
trace(isFinite(5 / 0)); // outputs "false"

View 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

View 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

View 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)))

View file

@ -0,0 +1,3 @@
+inf.0 ; positive infinity
(define (finite? x) (< -inf.0 x +inf.0))
(define (infinite? x) (not (finite? x)))

View file

@ -0,0 +1,6 @@
[
1.0 / 0.0
] on: ZeroDivide do:[:ex |
ex proceedWith: (Float infinity)
]
-> INF

View file

@ -0,0 +1,2 @@
Float infinity -> INF
1.0 / 0.0 -> "ZeroDivide exception"