I'm now using floats, but ...
What is the better method to pass floats parameters to a IMPORT(ED): word ?
Example...
4 IMPORT: VectorMagnitude ( x y z -- len )
1e 2e 3e VectorMagnitude f. ( sure its not correct ! )
....the 'C' prototype can be
float VectorMagnitude( float x, float y, float z);
....or can be
double VectorMagnitude( double x, double y, double z);
....or (rare)
double VectorMagnitude( float x, double y, float z);
The problem comes from the floating/normal stack separation.
My first solution was to convert as this:
create sfarr 32 sfloats allot
: n> ( n*f n -- )
>R
R@ 0 ?DO i cells sfarr + sf! LOOP
R> 0 ?DO i cells sfarr + @ LOOP ;
then...
1e 2e 3e 3 n> VectorMagnitude f.
I think its not the better solution.
Charles Melice
.
Received on Tue Feb 23 1999 - 11:37:12 PST
Subscribe to our e-mail list service. It's free for all SwiftForth and SwiftX users!
This archive was generated 09-Feb-2012. Archive updated nightly.