Initial data commit

This commit is contained in:
Ingy döt Net 2023-07-01 11:58:00 -04:00
parent 72d218235f
commit f23f22d71c
199087 changed files with 3378941 additions and 0 deletions

View file

@ -0,0 +1,16 @@
fcn pow(n,exp){
reg v;
if(n.isType(1)){ // Int
if (exp<0) return(if(n*n!=1) 0 else (if(exp.isOdd) n else 1));
v=1;
}else{
if(exp<0){ n=1.0/n; exp=-exp; }
v=1.0;
}
while(exp>0){
if(exp.isOdd) v*=n;
n*=n;
exp/=2;
}
v
}

View file

@ -0,0 +1,4 @@
println("2^6 = %d".fmt(pow(2,6)));
println("2^-6 = %d".fmt(pow(2,-6)));
println("2.71^6 = %f".fmt(pow(2.71,6)));
println("2.71^-6 = %f".fmt(pow(2.71,-6)));