You. Forth. Simplicity. git repository download prior releases documentation wiki issue tracker mailing list and forum irc channel and logs try it
Create a new paste
Pasted by crc on 2007-05-01 00:10:53
: fvariable create 10 allot ; : finit [ $9b 1, $db 1, $e3 1, ] ; : f+ [ $de 1, $c1 1, ] ; : f- [ $de 1, $e9 1, ] ; : f* [ $de 1, $c9 1, ] ; : f/ [ $de 1, $f9 1, ] ; : f! [ $db 1, $38 1, ] drop ; : f@ [ $db 1, $28 1, ] drop ; : fsin [ $d9 1, $fe 1, ] ; : fcos [ $d9 1, $ff 1, ] ; : ftan [ $d9 1, $f2 1, ] ; : fswap [ $d9 1, $c9 1, ] ; : f= 0 [ $df 1, $f1 1, $75 1, $1 1, $48 1, ] ; : >f [ $50 1, $db 1, $4 1, $24 1, $58 1, ] drop ; : f> dup [ $50 1, $db 1, $14 1, $24 1, $58 1, ] ; : fnegate [ $d9 1, $e0 1, ] ; NOTE: tof = top of floating point stack fvariable -<n> creates a floating point variable named <n> finit - set up the fpu for use (just call once) f+ ab-c a+b and return the result (uses fpu stack) f- ab-c a-b and return the result (uses fpu stack) f* ab-c a*b and return the result (uses fpu stack) f/ ab-c a/b and return the result (uses fpu stack) >f a- put the tos on the fpu stack f> -a put the tof on the data stack fswap ab-ba swap the top two items (uses fpu stack) fsin a-b calculate the sine of a (uses fpu stack) fcos a-b calculate the cosine of a (uses fpu stack) ftan a-b calculate the tangent of a (uses fpu stack) fnegate a-b negate the tof (uses fpu stack) f= ab-f compare a=b, return a flag (uses fpu stack)