\ 4tH library - ZEN FP ANS layer - Copyright 2009 J.L. Bezemer \ You can redistribute this file and/or modify it under \ the terms of the GNU General Public License [UNDEFINED] fdup [IF] [UNDEFINED] f+ [IF] [ABORT] [THEN] [UNDEFINED] 2@ [IF] include lib/anscore.4th [THEN] aka 2rot frot \ simple synonyms aka 2over fover aka 2@ f@ aka 2! f! 2 cells constant float : float+ cell+ cell+ ; : floats float * ; : fdup 2dup ; \ equivalents of double stack words : fswap 2swap ; : fdrop 2drop ; [UNDEFINED] >float [IF] \ ONLY supports "e", no decimal point : >float ( a n -- f bool) 2dup bounds \ set up loop, scan for "e" begin dup c@ bl or [char] e <> while over over <> while char+ repeat nip >r over r@ swap - tuck 1+ - r> char+ \ construct strings and convert swap dup 0> if number else drop dup xor then >r number error? r> error? rot or dup if nip nip then 0= ; \ return numbers and flag ( a n -- f) : s>float >float 0= abort" Bad float" ; [THEN] [THEN]