Float variables in locals.

This is a discussion on Float variables in locals. within the Forth forums in Programming Languages category; here 100 floats allot value fsp : flocs ( S: n -- n*x )( F: n*f -- ) fsp over floats over + rot 0 ?do ( fsp0 fspn ) 1 floats - dup f! ( fsp0 fspn-1 ) over 1 floats + swap ( fsp0 fsp1 fspn-1 ) loop over ! 1 floats + to fsp ; : release-flocs ( -- ) \ possible to automate on exit. fsp 1 floats - @ to fsp ; \ test : foo ( S: a b --)( F: x y -- ) 2 flocs locals| 'y 'x b a | a ...

Go Back   Application Development Forum > Programming Languages > Forth

Object Mix

Register FAQ Calendar Search Today's Posts Mark Forums Read
  #1  
Old 08-21-2008, 01:06 PM
Celime
Guest
 
Default Float variables in locals.


here 100 floats allot value fsp

: flocs ( S: n -- n*x )( F: n*f -- )
fsp over floats over + rot 0 ?do ( fsp0 fspn )
1 floats - dup f! ( fsp0 fspn-1 )
over 1 floats + swap ( fsp0 fsp1 fspn-1 )
loop over ! 1 floats + to fsp ;

: release-flocs ( -- ) \ possible to automate on exit.
fsp 1 floats - @ to fsp ;


\ test

: foo ( S: a b --)( F: x y -- )
2 flocs locals| 'y 'x b a |
a b + s>f
'x f@ f+
'y f@ f+
f.
'x f@ f.
release-flocs ;

1 2 3e 4e foo \ display 10e 3e

( Celime )


Reply With Quote
Reply


Thread Tools
Display Modes


All times are GMT -5. The time now is 03:31 AM.


Powered by vBulletin® Version 3.7.2
Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
Search Engine Optimization by vBSEO 3.2.0
vB Ad Management by =RedTyger=

In an effort to better serve ads to our visitors, cookies are used on objectmix.com. For more information, check out our Privacy Policy.