September 2017 Update
This commit is contained in:
parent
bba7bfd280
commit
ba8067c3b7
14570 changed files with 153136 additions and 63871 deletions
|
|
@ -0,0 +1,25 @@
|
|||
main = do
|
||||
let inf = 1/0
|
||||
let minus_inf = -1/0
|
||||
let minus_zero = -1/inf
|
||||
let nan = 0/0
|
||||
|
||||
putStrLn ("Positive infinity = "++(show inf))
|
||||
putStrLn ("Negative infinity = "++(show minus_inf))
|
||||
putStrLn ("Negative zero = "++(show minus_zero))
|
||||
putStrLn ("Not a number = "++(show nan))
|
||||
|
||||
--Some Arithmetic
|
||||
|
||||
putStrLn ("inf + 2.0 = "++(show (inf+2.0)))
|
||||
putStrLn ("inf - 10 = "++(show (inf-10)))
|
||||
putStrLn ("inf - inf = "++(show (inf-inf)))
|
||||
putStrLn ("inf * 0 = "++(show (inf * 0)))
|
||||
putStrLn ("nan + 1.0= "++(show (nan+1.0)))
|
||||
putStrLn ("nan + nan = "++(show (nan + nan)))
|
||||
|
||||
--Some Comparisons
|
||||
|
||||
putStrLn ("nan == nan = "++(show (nan == nan)))
|
||||
putStrLn ("0.0 == - 0.0 = "++(show (0.0 == minus_zero)))
|
||||
putStrLn ("inf == inf = "++(show (inf == inf)))
|
||||
|
|
@ -0,0 +1,16 @@
|
|||
function showextremes()
|
||||
values = [0.0, -0.0, Inf, -Inf, NaN]
|
||||
println(1 ./ values)
|
||||
end
|
||||
|
||||
showextremes()
|
||||
|
||||
@show Inf + 2.0
|
||||
@show Inf + Inf
|
||||
@show Inf - Inf
|
||||
@show Inf * Inf
|
||||
@show Inf / Inf
|
||||
@show Inf * 0
|
||||
@show 0 == -0
|
||||
@show NaN == NaN
|
||||
@show NaN === NaN
|
||||
|
|
@ -0,0 +1,28 @@
|
|||
// version 1.0.5-2
|
||||
|
||||
@Suppress("DIVISION_BY_ZERO", "FLOAT_LITERAL_CONFORMS_ZERO")
|
||||
|
||||
fun main(args: Array<String>) {
|
||||
val inf = 1.0 / 0.0
|
||||
val negInf = -1.0 / 0.0
|
||||
val nan = 0.0 / 0.0
|
||||
val negZero = -1.0e-325
|
||||
|
||||
println("*** Indirect ***\n")
|
||||
println("Infinity : $inf")
|
||||
println("Negative infinity : $negInf")
|
||||
println("Not a number : $nan")
|
||||
println("Negative zero : $negZero")
|
||||
|
||||
println("\n*** Direct ***\n")
|
||||
println("Infinity : ${Double.POSITIVE_INFINITY}")
|
||||
println("Negative infinity : ${Double.NEGATIVE_INFINITY}")
|
||||
println("Not a number : ${Double.NaN}")
|
||||
println("Negative zero : ${-0.0}")
|
||||
|
||||
println("\n*** Calculations ***\n")
|
||||
println("inf * inf : ${inf * inf}")
|
||||
println("inf + negInf : ${inf + negInf}")
|
||||
println("nan / nan : ${nan / nan}")
|
||||
println("negZero + 0.0 : ${negZero + 0.0}")
|
||||
}
|
||||
|
|
@ -0,0 +1,4 @@
|
|||
local inf=math.huge
|
||||
local minusInf=-math.huge
|
||||
local NaN=0/0
|
||||
local negativeZeroSorta=-1E-240
|
||||
|
|
@ -0,0 +1,2 @@
|
|||
1/(1/-math.huge)==math.huge
|
||||
true
|
||||
|
|
@ -0,0 +1,22 @@
|
|||
fn main() {
|
||||
let inf: f64 = 1. / 0.; // or std::f64::INFINITY
|
||||
let minus_inf: f64 = -1. / 0.; // or std::f64::NEG_INFINITY
|
||||
let minus_zero: f64 = -1. / inf; // or -0.0
|
||||
let nan: f64 = 0. / 0.; // or std::f64::NAN
|
||||
// or std::f32 for the above
|
||||
println!("positive infinity: {:+}", inf);
|
||||
println!("negative infinity: {:+}", minus_inf);
|
||||
println!("negative zero: {:+?}", minus_zero);
|
||||
println!("not a number: {:+}", nan);
|
||||
println!();
|
||||
println!("+inf + 2.0 = {:+}", inf + 2.);
|
||||
println!("+inf - 10.0 = {:+}", inf - 10.);
|
||||
println!("+inf + -inf = {:+}", inf + minus_inf);
|
||||
println!("0.0 * inf = {:+}", 0. * inf);
|
||||
println!("1.0 / -0.0 = {:+}", 1. / -0.);
|
||||
println!("NaN + 1.0 = {:+}", nan + 1.);
|
||||
println!("NaN + NaN = {:+}", nan + nan);
|
||||
println!();
|
||||
println!("NaN == NaN = {}", nan == nan);
|
||||
println!("0.0 == -0.0 = {}", 0. == -0.);
|
||||
}
|
||||
|
|
@ -0,0 +1,5 @@
|
|||
foreach $1 ([{-0.0}, {_Inf, "1.0/0"}, {-_Inf, "-1.0/0"}, {_NaN}]) {
|
||||
() = printf("%S", $1[0]);
|
||||
if (length($1) > 1) () = printf("\t%S\n", eval($1[1]));
|
||||
else () = printf("\n");
|
||||
}
|
||||
|
|
@ -0,0 +1,4 @@
|
|||
% And make some comparisons:
|
||||
() = printf("-0.0 and 0.0 are %sequal\n", -0.0 == 0.0 ? "" : "not ");
|
||||
() = printf("-_Inf == _Inf are %sequal\n", -_Inf == _Inf ? "" : "not ");
|
||||
() = printf("-0.0 and 0.0 are %sthe 'same'\n", __is_same(-0.0, 0.0) ? "" : "not ");
|
||||
|
|
@ -0,0 +1,11 @@
|
|||
. display %21x .
|
||||
+1.0000000000000X+3ff
|
||||
|
||||
. display %21x .a
|
||||
+1.0010000000000X+3ff
|
||||
|
||||
. display %21x .z
|
||||
+1.01a0000000000X+3ff
|
||||
|
||||
. display %21x c(maxdouble)
|
||||
+1.fffffffffffffX+3fe
|
||||
Loading…
Add table
Add a link
Reference in a new issue