version 1.18, 1995/11/07 18:06:40
|
version 1.23, 1998/12/08 22:02:42
|
Line 1
|
Line 1
|
\ High level floating point 14jan94py |
\ High level floating point 14jan94py |
|
|
\ Copyright (C) 1995 Free Software Foundation, Inc. |
\ Copyright (C) 1995,1997 Free Software Foundation, Inc. |
|
|
\ This file is part of Gforth. |
\ This file is part of Gforth. |
|
|
Line 55 dofield: lastxt code-address! \ change t
|
Line 55 dofield: lastxt code-address! \ change t
|
|
|
: f, ( f -- ) here 1 floats allot f! ; |
: f, ( f -- ) here 1 floats allot f! ; |
|
|
: fconstant ( r -- ) \ float |
: fconstant ( r "name" -- ) \ float |
Create f, |
Create f, |
DOES> ( -- r ) |
DOES> ( -- r ) |
f@ ; |
f@ ; |
|
|
: fdepth ( -- n ) f0 @ fp@ - [ 1 floats ] Literal / ; |
: fdepth ( -- n ) fp0 @ fp@ - [ 1 floats ] Literal / ; |
|
|
: FLit ( -- r ) r> dup f@ float+ >r ; |
: FLit ( -- r ) r> dup f@ float+ >r ; |
: FLiteral ( r -- ) |
: FLiteral ( r -- ) |
Line 98 DOES> ( -- r )
|
Line 98 DOES> ( -- r )
|
scratch over c@ emit '. emit 1 /string type |
scratch over c@ emit '. emit 1 /string type |
'E emit . ; |
'E emit . ; |
|
|
require debugging.fs |
require debugs.fs |
|
|
: sfnumber ( c-addr u -- r / ) |
: sfnumber ( c-addr u -- r true | false ) |
2dup [CHAR] e scan |
2dup [CHAR] e scan ( c-addr u c-addr2 u2 ) |
dup 0= |
dup 0= |
IF |
IF |
2drop 2dup [CHAR] E scan |
2drop 2dup [CHAR] E scan ( c-addr u c-addr3 u3 ) |
THEN |
THEN |
nip |
nip |
IF |
IF |
2dup >float |
>float |
IF |
ELSE |
2drop state @ |
2drop false |
IF |
THEN ; |
POSTPONE FLiteral |
|
THEN |
:noname ( c-addr u -- ) |
EXIT |
2dup sfnumber |
THEN |
IF |
THEN |
2drop POSTPONE FLiteral |
defers notfound ; |
ELSE |
|
defers compiler-notfound |
|
ENDIF ; |
|
IS compiler-notfound |
|
|
' sfnumber IS notfound |
:noname ( c-addr u -- r ) |
|
2dup sfnumber |
|
IF |
|
2drop |
|
ELSE |
|
defers interpreter-notfound |
|
ENDIF ; |
|
IS interpreter-notfound |
|
|
: fvariable ( -- ) |
: fvariable ( "name" -- ) \ float |
Create 0.0E0 f, ; |
Create 0.0E0 f, ; |
\ does> ( -- f-addr ) |
\ does> ( -- f-addr ) |
|
|