This commit is contained in:
Ingy döt Net 2013-04-10 16:19:29 -07:00
parent e5e8880e41
commit 518da4a923
1019 changed files with 15877 additions and 0 deletions

View file

@ -0,0 +1,19 @@
REPEAT
READ N$
IF FN_isanumber(N$) THEN
PRINT "'" N$ "' is a number"
ELSE
PRINT "'" N$ "' is NOT a number"
ENDIF
UNTIL N$ = "end"
END
DATA "PI", "0123", "-0123", "12.30", "-12.30", "123!", "0"
DATA "0.0", ".123", "-.123", "12E3", "12E-3", "12+3", "end"
DEF FN_isanumber(A$)
ON ERROR LOCAL = FALSE
IF EVAL("(" + A$ + ")") <> VAL(A$) THEN = FALSE
IF VAL(A$) <> 0 THEN = TRUE
IF LEFT$(A$,1) = "0" THEN = TRUE
= FALSE

View file

@ -0,0 +1,11 @@
43257349578692:/
F
260780243875083/35587980:/
S
247/30:~/#
F
80000000000:~/#
S

View file

@ -0,0 +1,29 @@
@("1.000-4E-10":~/# (|"." (|? 0|`) (|~/#:>0)) (|(E|e) ~/#))
F
@("1.0004E-54328":~/# (|"." (|? 0|`) (|~/#:>0)) (|(E|e) ~/#))
S
@("-464641.0004E-54328":~/# (|"." (|? 0|`) (|~/#:>0)) (|(E|e) ~/#))
S
@("1/2.0004E-10":~/# (|"." (|? 0|`) (|~/#:>0)) (|(E|e) ~/#))
F
@("1357E-10":~/# (|"." (|? 0|`) (|~/#:>0)) (|(E|e) ~/#))
S
@("1357e0":~/# (|"." (|? 0|`) (|~/#:>0)) (|(E|e) ~/#))
S
@("13579":~/# (|"." (|? 0|`) (|~/#:>0)) (|(E|e) ~/#))
S
@("1.246":~/# (|"." (|? 0|`) (|~/#:>0)) (|(E|e) ~/#))
S
@("0.0":~/# (|"." (|? 0|`) (|~/#:>0)) (|(E|e) ~/#))
S
@("0.0000":~/# (|"." (|? 0|`) (|~/#:>0)) (|(E|e) ~/#))
S

View file

@ -0,0 +1,35 @@
(float2fraction=
integerPart decimalPart d1 dn exp sign
. @( !arg
: ~/#?integerPart
( &0:?decimalPart:?d1:?dn
| "."
[?d1
(|? 0|`)
( &0:?decimalPart
| ~/#?decimalPart:>0
)
[?dn
)
( &0:?exp
| (E|e) ~/#?exp
)
)
& ( !integerPart*(-1:?sign):>0:?integerPart
| 1:?sign
)
& !sign*(!integerPart+!decimalPart*10^(!d1+-1*!dn))*10^!exp
);
( out$float2fraction$"1.2"
& out$float2fraction$"1.02"
& out$float2fraction$"1.01"
& out$float2fraction$"10.01"
& out$float2fraction$"10.01e10"
& out$float2fraction$"10.01e1"
& out$float2fraction$"10.01e2"
& out$float2fraction$"10.01e-2"
& out$float2fraction$"-10.01e-2"
& out$float2fraction$"-10e-2"
& out$float2fraction$"0.000"
);

View file

@ -0,0 +1 @@
ps^^-]to{"Int""Double"}\/~[\/L[1==?*