This commit is contained in:
Ingy döt Net 2013-04-10 21:29:02 -07:00
parent 764da6cbbb
commit db842d013d
19005 changed files with 197040 additions and 7 deletions

View file

@ -0,0 +1 @@
1/0.

View file

@ -0,0 +1,5 @@
class Main
{
static Float getInfinity () { Float.posInf }
public static Void main () { echo (getInfinity ()) }
}

View file

@ -0,0 +1,9 @@
# Floating point infinity
inf := FLOAT_INT(1) / FLOAT_INT(0);
IS_FLOAT(inf);
#true;
# GAP has also a formal ''infinity'' value
infinity in Cyclotomics;
# true

View file

@ -0,0 +1 @@
def biggest = { Double.POSITIVE_INFINITY }

View file

@ -0,0 +1,2 @@
println biggest()
printf ( "0x%xL \n", Double.doubleToLongBits(biggest()) )

View file

@ -0,0 +1,2 @@
print, !Values.f_infinity ;; for normal floats or
print, !Values.D_infinity ;; for doubles

View file

@ -0,0 +1 @@
inf := 1/0

View file

@ -0,0 +1 @@
Number constants inf

View file

@ -0,0 +1,6 @@
_ * 5 NB. multiplying infinity to 5 results in infinity
_
5 % _ NB. dividing 5 by infinity results in 0
0
5 % 0 NB. dividing 5 by 0 results in infinity
_

View file

@ -0,0 +1,49 @@
/ Integer infinities
/ 0I is just 2147483647
/ -0I is just -2147483647
/ -2147483648 is a special "null integer"(NaN) 0N
0I*0I
1
0I-0I
0
0I+1
0N
0I+2
-0I
0I+3 / -0I+1
-2147483646
0I-1
2147483646
0I%0I
1
0I^2
4.611686e+18
0I^0I
0i
0I^-0I
0.0
1%0
0I
0%0
0
0i^2
0i
0i^0i
0i
/ Floating point infinities in K are something like
/ IEEE 754 values
/ Also there is floating point NaN -- 0n
0i+1
0i
0i*0i
0i
0i-0i
0n
0i%0i
0n
0i%0n
0n
/ but
0.0%0.0
0.0

View file

@ -0,0 +1,2 @@
> proc() Float(infinity) end();
Float(infinity)

View file

@ -0,0 +1,2 @@
> proc() HFloat(infinity) end();
HFloat(infinity)

View file

@ -0,0 +1,4 @@
Sum[1/n^2,{n,Infinity}]
1/Infinity
Integrate[Exp[-x^2], {x, -Infinity, Infinity}]
10^100 < Infinity

View file

@ -0,0 +1 @@
Integrate[Exp[-x^2]/(x^2 - 1), {x, 0, DirectedInfinity[Exp[I Pi/4]]}]

View file

@ -0,0 +1,14 @@
/* Maxima has inf (positive infinity) and minf (negative infinity) */
declare(x, real)$
is(x < inf);
/* true */
is(x > minf);
/* true */
/* However, it is an error to try to divide by zero, even with floating-point numbers */
1.0/0.0;
/* expt: undefined: 0 to a negative exponent.
-- an error. To debug this try: debugmode(true); */

View file

@ -0,0 +1 @@
infinity := 4095.99998;

View file

@ -0,0 +1,8 @@
MODULE inf;
IMPORT InOut;
BEGIN
InOut.WriteReal (1.0 / 0.0, 12, 12);
InOut.WriteLn
END inf.

View file

@ -0,0 +1,4 @@
jan@Beryllium:~/modula/rosetta$ inf
**** RUNTIME ERROR bound check error
Floating point exception

View file

@ -0,0 +1,8 @@
MODULE Inf EXPORTS Main;
IMPORT IO, IEEESpecial;
BEGIN
IO.PutReal(IEEESpecial.RealPosInf);
IO.Put("\n");
END Inf.