From: George H. <geo...@us...> - 2006-05-20 12:00:10
|
Update of /cvsroot/win32forth/win32forth/doc In directory sc8-pr-cvs9.sourceforge.net:/tmp/cvs-serv15452/win32forth/doc Modified Files: p-float.htm Log Message: gah: Updated doc to match dexing.. Index: p-float.htm =================================================================== RCS file: /cvsroot/win32forth/win32forth/doc/p-float.htm,v retrieving revision 1.17 retrieving revision 1.18 diff -C2 -d -r1.17 -r1.18 *** p-float.htm 21 Feb 2006 11:03:54 -0000 1.17 --- p-float.htm 20 May 2006 11:59:53 -0000 1.18 *************** *** 62,81 **** processor documentation. </p><p><b> WARNING! </b> do not alter the settings unless you know what you're doing. ! </p><pre><b><a name="0">code >fregs ( addr -- ) \ W32F Floating extra </a></b></pre><p>Restore x87 FPU State. ! </p><pre><b><a name="1">code >fregs> ( addr -- ) \ W32F Floating extra </a></b></pre><p>Save and Restore x87 FPU State. ! </p><pre><b><a name="2">code fpcw> ( -- n ) \ W32F Floating extra </a></b></pre><p>Get x87 FPU Control Word. ! </p><pre><b><a name="3">code >fpcw ( n -- ) \ W32F Floating extra </a></b></pre><p>Set x87 FPU Control Word. ! </p><pre><b><a name="4">code fpsw> ( -- n ) \ W32F Floating extra </a></b></pre><p>Get x87 FPU Status Word. ! </p><pre><b><a name="5"> 10 constant B/FLOAT ( -- n ) \ W32F Floating extra </a></b></pre><p>Number of bytes in a floating-point number. Note the default is 8 bytes. </p><pre><b><a name="6">value cells/float </a></b></pre><p>Number of cells in a floating-point number. If the number of bytes is not a multiple of 4 this is rounded up. ! </p><pre><b><a name="7">code finit ( -- ) \ W32F Floating extra </a></b></pre><p>Clears the floating-point stack & sets the appropriate byte mode. It is executed by the system on start-up and by the default exception handler. --- 62,83 ---- processor documentation. </p><p><b> WARNING! </b> do not alter the settings unless you know what you're doing. ! </p><pre><b><a name="0">code >fregs ( addr -- ) \ W32F Floating extra </a></b></pre><p>Restore x87 FPU State. ! </p><pre><b><a name="1">code >fregs> ( addr -- ) \ W32F Floating extra </a></b></pre><p>Save and Restore x87 FPU State. ! </p><pre><b><a name="2">code fpcw> ( -- n ) \ W32F Floating extra </a></b></pre><p>Get x87 FPU Control Word. ! </p><pre><b><a name="3">code >fpcw ( n -- ) \ W32F Floating extra </a></b></pre><p>Set x87 FPU Control Word. ! </p><pre><b><a name="4">code fpsw> ( -- n ) \ W32F Floating extra </a></b></pre><p>Get x87 FPU Status Word. ! </p><pre><b><a name="5"> 10 constant B/FLOAT ( -- n ) \ W32F Floating extra </a></b></pre><p>Number of bytes in a floating-point number. Note the default is 8 bytes. </p><pre><b><a name="6">value cells/float </a></b></pre><p>Number of cells in a floating-point number. If the number of bytes is not a multiple of 4 this is rounded up. ! </p><pre><b><a name="7">cell NEWUSER FLOATSP ( -- addr ) \ W32F Floating extra ! </a></b></pre><p>Address of floating point stack pointer in the user area. ! </p><pre><b><a name="8">code finit ( -- ) \ W32F Floating extra </a></b></pre><p>Clears the floating-point stack & sets the appropriate byte mode. It is executed by the system on start-up and by the default exception handler. *************** *** 85,113 **** </p><a name="Sec#2"></a> <h3>Memory Access ! </h3><pre><b><a name="8">code F@ ( addr -- ; fs: -- r ) \ ANSI Floating </a></b></pre><p>Fetch a float. ! </p><pre><b><a name="9">code SF@ ( addr -- ; fs: -- r ) \ ANSI Floating ext </a></b></pre><p>Fetch a 32 bit (short) float. ! </p><pre><b><a name="10">code DF@ ( addr -- ; fs: -- r ) \ ANSI Floating ext </a></b></pre><p>Fetch a 64 bit (double) float. ! </p><pre><b><a name="11">code F! ( addr -- ; fs: r -- ) \ ANSI Floating </a></b></pre><p>Store a float. ! </p><pre><b><a name="12">code SF! ( addr -- ; fs: r -- ) \ ANSI Floating ext </a></b></pre><p>Store a 32 bit (short) float. ! </p><pre><b><a name="13">code DF! ( addr -- ; fs: r -- ) \ ANSI Floating ext </a></b></pre><p>Store a 64 bit (double) float. ! </p><pre><b><a name="14">code F+! ( addr -- ; fs: r -- ) \ W32F Floating extra </a></b></pre><p>Add the value to a float. ! </p><pre><b><a name="15">: FVARIABLE ( compiling -<name>- -- ; run-time -- addr) \ ANSI Floating </a></b></pre><p>Define a floating-point variable in the dictionary. The contents are undefined. ! </p><pre><b><a name="16">: FVALUE ( compiling -<name>- -- ; fs: r -- ; run-time FS: -- r ) \ W32F Floating extra </a></b></pre><p>Define a floating point value initialised from the FP stack. ! </p><pre><b><a name="17">: FTO \ W32F Floating extra ! </a></b></pre><p><b> Interpretation: ( -<fvalue>- -- FS: r -- ) <br /> Compilation: ( -<fvalue>- -- Run-time: FS: r -- ) </b> </p><p>Store r into -<fvalue>-. If -<fvalue>- is not defined with fvalue then memory may be corrupted; no checks are made so the user should take care. FTO should not be POSTPONEd. ! </p><pre><b><a name="18">: FCONSTANT ( -<name>- ; fs: r -- ) \ ANSI Floating </a></b></pre><p> <b> Interpretation: ( -<name>- ; fs: r -- ) </b> <br /> Define an FP constant. <br /> --- 87,117 ---- </p><a name="Sec#2"></a> <h3>Memory Access ! </h3><pre><b><a name="9">code F@ ( addr -- ; fs: -- r ) \ ANSI Floating </a></b></pre><p>Fetch a float. ! </p><pre><b><a name="10">code SF@ ( addr -- ; fs: -- r ) \ ANSI Floating ext </a></b></pre><p>Fetch a 32 bit (short) float. ! </p><pre><b><a name="11">code DF@ ( addr -- ; fs: -- r ) \ ANSI Floating ext </a></b></pre><p>Fetch a 64 bit (double) float. ! </p><pre><b><a name="12">code F! ( addr -- ; fs: r -- ) \ ANSI Floating </a></b></pre><p>Store a float. ! </p><pre><b><a name="13">code SF! ( addr -- ; fs: r -- ) \ ANSI Floating ext </a></b></pre><p>Store a 32 bit (short) float. ! </p><pre><b><a name="14">code DF! ( addr -- ; fs: r -- ) \ ANSI Floating ext </a></b></pre><p>Store a 64 bit (double) float. ! </p><pre><b><a name="15">code F+! ( addr -- ; fs: r -- ) \ W32F Floating extra </a></b></pre><p>Add the value to a float. ! </p><pre><b><a name="16">: F, ( fs: r -- ) \ W32F Floating extra ! </a></b></pre><p>Compile a float into the dictionary. ! </p><pre><b><a name="17">: FVARIABLE ( compiling -<name>- -- ; run-time -- addr) \ ANSI Floating </a></b></pre><p>Define a floating-point variable in the dictionary. The contents are undefined. ! </p><pre><b><a name="18">: FVALUE ( compiling -<name>- -- ; fs: r -- ; run-time FS: -- r ) \ W32F Floating extra </a></b></pre><p>Define a floating point value initialised from the FP stack. ! </p><pre><b><a name="19">: FTO \ W32F Floating extra ! </a></b></pre><p><b> Interpretation: ( -<fvalue>- -- fs: r -- ) <br /> Compilation: ( -<fvalue>- -- Run-time: FS: r -- ) </b> </p><p>Store r into -<fvalue>-. If -<fvalue>- is not defined with fvalue then memory may be corrupted; no checks are made so the user should take care. FTO should not be POSTPONEd. ! </p><pre><b><a name="20">: FCONSTANT ( -<name>- ; fs: r -- ) \ ANSI Floating </a></b></pre><p> <b> Interpretation: ( -<name>- ; fs: r -- ) </b> <br /> Define an FP constant. <br /> *************** *** 116,120 **** <b> Run-time: ( fs: -- r ) </b> <br /> Place r on the floating-point stack. ! </p><pre><b><a name="19">: FLITERAL ( Compilation fs: r -- ; Runtime fs: -- r ) \ ANSI Floating </a></b></pre><p> <b> Interpretation: </b> <br /> Interpretation semantics for this word are undefined. <br /> --- 120,124 ---- <b> Run-time: ( fs: -- r ) </b> <br /> Place r on the floating-point stack. ! </p><pre><b><a name="21">: FLITERAL ( Compilation fs: r -- ; Runtime fs: -- r ) \ ANSI Floating </a></b></pre><p> <b> Interpretation: </b> <br /> Interpretation semantics for this word are undefined. <br /> *************** *** 125,141 **** </p><a name="Sec#3"></a> <h3>FP Stack operations ! </h3><pre><b><a name="20">code FDROP ( fs: r -- ) \ ANSI Floating </a></b></pre><p>Remove r from the floating-point stack. ! </p><pre><b><a name="21">code FDUP ( fs: r -- r r ) \ ANSI Floating </a></b></pre><p>Duplicate the top entry on the floating-point stack. ! </p><pre><b><a name="22">code FSWAP ( fs: r1 r2 -- r2 r1 ) \ ANSI Floating </a></b></pre><p>Exchange the top 2 FP numbers. ! </p><pre><b><a name="23">code FOVER ( fs: r1 r2 -- r1 r2 r1 ) \ ANSI Floating </a></b></pre><p>Copy the 2nd FP stack number to the top of the FP stack. ! </p><pre><b><a name="24">code FROT ( fs: r1 r2 r3 -- r2 r3 r1 ) \ ANSI Floating </a></b></pre><p>Rotate the top 3 FP stack numbers. ! </p><pre><b><a name="25">code FPICK ( n -- ; fs: -- r ) \ W32F Floating extra </a></b></pre><p>Copy the n'th number from the FP stack. ! </p><pre><b><a name="26">: FNIP ( fs: r1 r2 -- r2 ) \ W32F Floating extra </a></b></pre><p>Remove the 2nd FP stack entry. </p><a name="Sec#4"></a> --- 129,145 ---- </p><a name="Sec#3"></a> <h3>FP Stack operations ! </h3><pre><b><a name="22">code FDROP ( fs: r -- ) \ ANSI Floating </a></b></pre><p>Remove r from the floating-point stack. ! </p><pre><b><a name="23">code FDUP ( fs: r -- r r ) \ ANSI Floating </a></b></pre><p>Duplicate the top entry on the floating-point stack. ! </p><pre><b><a name="24">code FSWAP ( fs: r1 r2 -- r2 r1 ) \ ANSI Floating </a></b></pre><p>Exchange the top 2 FP numbers. ! </p><pre><b><a name="25">code FOVER ( fs: r1 r2 -- r1 r2 r1 ) \ ANSI Floating </a></b></pre><p>Copy the 2nd FP stack number to the top of the FP stack. ! </p><pre><b><a name="26">code FROT ( fs: r1 r2 r3 -- r2 r3 r1 ) \ ANSI Floating </a></b></pre><p>Rotate the top 3 FP stack numbers. ! </p><pre><b><a name="27">code FPICK ( n -- ; fs: -- r ) \ W32F Floating extra </a></b></pre><p>Copy the n'th number from the FP stack. ! </p><pre><b><a name="28">: FNIP ( fs: r1 r2 -- r2 ) \ W32F Floating extra </a></b></pre><p>Remove the 2nd FP stack entry. </p><a name="Sec#4"></a> *************** *** 143,275 **** </h3><p>The following words can be used for pairs of FP numbers and are useful for dealing with complex numbers or 2-dimensional vectors on the FP stack. ! </p><pre><b><a name="27">code F2DROP ( fs: r1 r2 -- ) \ W32F Floating extra </a></b></pre><p>Remove the top 2 FP stack entries. ! </p><pre><b><a name="28">: F2DUP ( fs: r1 r2 -- r1 r2 r1 r2 ) \ W32F Floating extra </a></b></pre><p>Duplicate the top 2 FP stack entries. ! </p><pre><b><a name="29">: F2SWAP ( fs: r1 r2 r3 r4 -- r3 r4 r1 r2 ) \ W32F Floating extra </a></b></pre><p>Swap the top pair of floating-point numbers with the second pair. ! </p><pre><b><a name="30">: F2NIP ( fs: r1 r2 r3 r4 -- r3 r4 ) \ W32F Floating extra </a></b></pre><p>Remove the 2nd pair of FP stack entries. </p><a name="Sec#5"></a> <h3>FP Constants ! </h3><pre><b><a name="31">code fpi ( fs: -- r ) \ W32F Floating extra </a></b></pre><p>Push the value 3.141596... on to the FP stack. ! </p><pre><b><a name="32">code f0.0 ( fs: -- r ) \ W32F Floating extra </a></b></pre><p>Push plus zero on to the FP stack. ! </p><pre><b><a name="33">code f1.0 ( fs: -- r ) \ W32F Floating extra </a></b></pre><p>Push the value 1.0 on to the FP stack. ! </p><pre><b><a name="34">code fL2t ( fs: -- r ) \ W32F Floating extra </a></b></pre><p>Push the value of log base 2 of 10. ! </p><pre><b><a name="35">code fL2e ( fs: -- r ) \ W32F Floating extra </a></b></pre><p>Push the value of log base 2 of e. ! </p><pre><b><a name="36">code fLog2 ( fs: -- r ) \ W32F Floating extra </a></b></pre><p>Push the value of log base 10 of 2. ! </p><pre><b><a name="37">code fLn2 ( fs: -- r ) \ W32F Floating extra </a></b></pre><p>Push the value of ln 2 (the natural logarithm). ! </p><pre><b><a name="38"> fconstant finf ( fs: -- r ) \ W32F Floating extra </a></b></pre><p>Push plus infinity. ! </p><pre><b><a name="39">2e0 fconstant f2.0 ( fs: -- r ) \ W32F Floating extra </a></b></pre><p>Push floating-point 2.0. ! </p><pre><b><a name="40">10e0 fconstant f10.0 ( fs: -- r ) \ W32F Floating extra </a></b></pre><p>Push floating-point 10.0. ! </p><pre><b><a name="41">5e-1 fconstant f0.5 ( fs: -- r ) \ W32F Floating extra </a></b></pre><p>Push floating-point 0.5. ! </p><pre><b><a name="42"> f0.0 fconstant fbig ( fs: -- r ) \ W32F Floating extra </a></b></pre><p>Push the largest non-infinite floating-point number. ! </p><pre><b><a name="43"> f0.0 fconstant feps ( fs: -- r ) \ W32F Floating extra </a></b></pre><p>Push the smallest non-zero floating-point number. ! </p><pre><b><a name="44"> f1.0 fconstant fsmall ( fs: -- r ) \ W32F Floating extra </a></b></pre><p>Push the smallest non-denormalised floating-point number. </p><a name="Sec#6"></a> <h3>FP Variables ! </h3><pre><b><a name="45"> fvariable a2**63 ( -- addr ) \ W32F Floating extra </a></b></pre><p>Return the address of a float containing 2**63. ! </p><pre><b><a name="46"> fvariable sq2m1 ( -- addr ) \ W32F Floating extra </a></b></pre><p>Return the address of a float containing sqrt(2) - 1. ! </p><pre><b><a name="47"> fvariable sq2/2m1 ( -- addr ) \ W32F Floating extra </a></b></pre><p>Return the address of a float containing sqrt(2)/2 - 1. </p><a name="Sec#7"></a> <h3>Rounding functions ! </h3><pre><b><a name="48">code FLOOR ( fs: r1 -- r2 ) \ ANSI Floating </a></b></pre><p>Round r1 to an integral value using the round toward negative infinity rule, giving r2. ! </p><pre><b><a name="49">code FCEIL ( fs: r1 -- r2 ) \ W32F Floating extra </a></b></pre><p>Round r1 to an integral value using the round toward positive infinity rule, giving r2. ! </p><pre><b><a name="50">code FTRUNC ( fs: r1 -- r2 ) \ W32F Floating extra </a></b></pre><p>Round r1 to an integral value using the round toward zero rule, giving r2. ! </p><pre><b><a name="51">code FROUND ( fs: r1 -- r2 ) \ ANSI Floating </a></b></pre><p>Round r1 to an integral value using the round to nearest rule, giving r2. </p><a name="Sec#8"></a> <h3>Integer to float conversion ! </h3><pre><b><a name="52">code D>F ( d -- ; Fs: -- r ) \ ANSI Floating </a></b></pre><p>Convert double number to floating-point number. ! </p><pre><b><a name="53">code F>D ( -- d ; fs: r -- ) \ ANSI Floating </a></b></pre><p>Convert floating-point number to double number, by rounding towards zero. If the result would be too large to fit in a double number then <br /> -9223372036854775808 is returned. ! </p><pre><b><a name="54">code ZF>D ( -- d ; fs: r -- ) \ W32F Floating extra </a></b></pre><p>Convert floating-point number to double number, using the current rounding mode (rounding towards nearest unless changed by the user). If the result would be too large to fit in a double number then <br /> -9223372036854775808 is returned. ! </p><pre><b><a name="55">: s>f ( n -- ; fs: -- r ) \ W32F Floating extra </a></b></pre><p>Convert the single number n to floating point number r. ! </p><pre><b><a name="56">: f>s ( -- n ; fs: r -- ) \ W32F Floating extra </a></b></pre><p>Convert the floating point number r to single number n. ! </p><pre><b><a name="57">code FS>DS ( -- dfloat fs: r -- ) \ W32F Floating extra </a></b></pre><p>Move floating point number bits to the data stack as a 64-bit float. This function is for passing floats to DLLs. ! </p><pre><b><a name="58">code SFS>DS ( -- float ; fs: r -- ) \ W32F Floating extra </a></b></pre><p>Push the top of the float stack onto the data stack as a 32-bit float. This function is for passing floats to DLLs. </p><a name="Sec#9"></a> <h3>FP Comparison operators ! </h3><pre><b><a name="59">: F0= ( -- f ; fs: r -- ) \ ANSI Floating </a></b></pre><p>Return true if r equals ±0e0. Returns false for NAN. ! </p><pre><b><a name="60">: F0< ( -- f ; fs: r -- ) \ ANSI Floating </a></b></pre><p>Return true if r is less than ±0e0. Returns false for NAN. ! </p><pre><b><a name="61">: f0> ( -- f ; fs: r -- ) \ W32F Floating extra </a></b></pre><p>Return true if r is greater than ±0e0. Returns false for NAN. ! </p><pre><b><a name="62">: f= ( -- f ; fs: r1 r2 -- ) \ W32F Floating extra </a></b></pre><p>Return true if r1 equals r2. Returns false if either number is a NAN. ! </p><pre><b><a name="63">: F< ( -- f ; fs: r1 r2 -- ) \ ANSI Floating </a></b></pre><p>Return true if r1 is less than r2. Returns false if either number is a NAN. ! </p><pre><b><a name="64">: f> ( -- f ; fs: r1 r2 -- ) \ W32F Floating extra </a></b></pre><p>Return true if r1 is greater than r2. Returns false if either number is a NAN. ! </p><pre><b><a name="65">: f<= ( -- f ; fs: r1 r2 -- ) \ W32F Floating extra </a></b></pre><p>Return true if r1 is less than or equal to r2. Returns true if either number is a NAN. ! </p><pre><b><a name="66">: f>= ( -- f ; fs: r1 r2 -- ) \ W32F Floating extra </a></b></pre><p>Return true if r1 is greater than or equal to r2. Returns true if either number is a NAN. ! </p><pre><b><a name="67">: FMAX ( fs: r1 r2 -- r3 ) \ ANSI Floating </a></b></pre><p>Return r3 the maximum of r1 and r2. If r1 is a NAN then so is r3. If r2 is a NAN then r3=r1. ! </p><pre><b><a name="68">: FMIN ( fs: r1 r2 -- r3 ) \ ANSI Floating </a></b></pre><p>Return r3 the minimum of r1 and r2. If r1 is a NAN then so is r3. If r2 is a NAN then r3=r1. </p><a name="Sec#10"></a> <h3>Arithmetic operators ! </h3><pre><b><a name="69">code F+ ( fs: r1 r2 -- r3 ) \ ANSI Floating </a></b></pre><p>Add r1 to r2. ! </p><pre><b><a name="70">code F- ( fs: r1 r2 -- r3 ) \ ANSI Floating </a></b></pre><p>Subtract r2 from r1. ! </p><pre><b><a name="71">code F* ( fs: r1 r2 -- r3 ) \ ANSI Floating </a></b></pre><p>Multiply r1 by r2. ! </p><pre><b><a name="72">code F/ ( fs: r1 r2 -- r3 ) \ ANSI Floating </a></b></pre><p>Divide r1 by r2. ! </p><pre><b><a name="73">code FNEGATE ( fs: r1 -- r2 ) \ ANSI Floating </a></b></pre><p>Reverse the sign of r1. ! </p><pre><b><a name="74">: 1/f ( fs: r1 -- r2 ) \ W32F Floating extra </a></b></pre><p>r2 is the reciprocal of r1. ! </p><pre><b><a name="75">code f2* ( fs: r1 -- r2 ) \ W32F Floating extra </a></b></pre><p>Multiply by 2. ! </p><pre><b><a name="76">code f2/ ( fs: r1 -- r2 ) \ W32F Floating extra </a></b></pre><p>Divide by 2. ! </p><pre><b><a name="77">code FABS ( fs: r1 -- r2 ) \ ANSI Floating ext </a></b></pre><p>r2 is the absolute value of r1. ! </p><pre><b><a name="78">code FSQRT ( fs: r1 -- r2 ) \ ANSI Floating ext ! </a></b></pre><p>r2 is the positive square root of r1. ! </p><pre><b><a name="79">: F~ ( -- flag ; fs: r1 r2 r3 -- ) \ ANSI Floating ext </a></b></pre><p>If r3 is positive, flag is true if the absolute value of (r1 minus r2) is less than r3. If r3 is zero, flag is true if the implementation-dependent encoding of r1 and --- 147,279 ---- </h3><p>The following words can be used for pairs of FP numbers and are useful for dealing with complex numbers or 2-dimensional vectors on the FP stack. ! </p><pre><b><a name="29">code F2DROP ( fs: r1 r2 -- ) \ W32F Floating extra </a></b></pre><p>Remove the top 2 FP stack entries. ! </p><pre><b><a name="30">: F2DUP ( fs: r1 r2 -- r1 r2 r1 r2 ) \ W32F Floating extra </a></b></pre><p>Duplicate the top 2 FP stack entries. ! </p><pre><b><a name="31">: F2SWAP ( fs: r1 r2 r3 r4 -- r3 r4 r1 r2 ) \ W32F Floating extra </a></b></pre><p>Swap the top pair of floating-point numbers with the second pair. ! </p><pre><b><a name="32">: F2NIP ( fs: r1 r2 r3 r4 -- r3 r4 ) \ W32F Floating extra </a></b></pre><p>Remove the 2nd pair of FP stack entries. </p><a name="Sec#5"></a> <h3>FP Constants ! </h3><pre><b><a name="33">code fpi ( fs: -- r ) \ W32F Floating extra </a></b></pre><p>Push the value 3.141596... on to the FP stack. ! </p><pre><b><a name="34">code f0.0 ( fs: -- r ) \ W32F Floating extra </a></b></pre><p>Push plus zero on to the FP stack. ! </p><pre><b><a name="35">code f1.0 ( fs: -- r ) \ W32F Floating extra </a></b></pre><p>Push the value 1.0 on to the FP stack. ! </p><pre><b><a name="36">code fL2t ( fs: -- r ) \ W32F Floating extra </a></b></pre><p>Push the value of log base 2 of 10. ! </p><pre><b><a name="37">code fL2e ( fs: -- r ) \ W32F Floating extra </a></b></pre><p>Push the value of log base 2 of e. ! </p><pre><b><a name="38">code fLog2 ( fs: -- r ) \ W32F Floating extra </a></b></pre><p>Push the value of log base 10 of 2. ! </p><pre><b><a name="39">code fLn2 ( fs: -- r ) \ W32F Floating extra </a></b></pre><p>Push the value of ln 2 (the natural logarithm). ! </p><pre><b><a name="40"> fconstant finf ( fs: -- r ) \ W32F Floating extra </a></b></pre><p>Push plus infinity. ! </p><pre><b><a name="41">2e0 fconstant f2.0 ( fs: -- r ) \ W32F Floating extra </a></b></pre><p>Push floating-point 2.0. ! </p><pre><b><a name="42">10e0 fconstant f10.0 ( fs: -- r ) \ W32F Floating extra </a></b></pre><p>Push floating-point 10.0. ! </p><pre><b><a name="43">5e-1 fconstant f0.5 ( fs: -- r ) \ W32F Floating extra </a></b></pre><p>Push floating-point 0.5. ! </p><pre><b><a name="44"> f0.0 fconstant fbig ( fs: -- r ) \ W32F Floating extra </a></b></pre><p>Push the largest non-infinite floating-point number. ! </p><pre><b><a name="45"> f0.0 fconstant feps ( fs: -- r ) \ W32F Floating extra </a></b></pre><p>Push the smallest non-zero floating-point number. ! </p><pre><b><a name="46"> f1.0 fconstant fsmall ( fs: -- r ) \ W32F Floating extra </a></b></pre><p>Push the smallest non-denormalised floating-point number. </p><a name="Sec#6"></a> <h3>FP Variables ! </h3><pre><b><a name="47"> fvariable a2**63 ( -- addr ) \ W32F Floating extra </a></b></pre><p>Return the address of a float containing 2**63. ! </p><pre><b><a name="48"> fvariable sq2m1 ( -- addr ) \ W32F Floating extra </a></b></pre><p>Return the address of a float containing sqrt(2) - 1. ! </p><pre><b><a name="49"> fvariable sq2/2m1 ( -- addr ) \ W32F Floating extra </a></b></pre><p>Return the address of a float containing sqrt(2)/2 - 1. </p><a name="Sec#7"></a> <h3>Rounding functions ! </h3><pre><b><a name="50">code FLOOR ( fs: r1 -- r2 ) \ ANSI Floating </a></b></pre><p>Round r1 to an integral value using the round toward negative infinity rule, giving r2. ! </p><pre><b><a name="51">code FCEIL ( fs: r1 -- r2 ) \ W32F Floating extra </a></b></pre><p>Round r1 to an integral value using the round toward positive infinity rule, giving r2. ! </p><pre><b><a name="52">code FTRUNC ( fs: r1 -- r2 ) \ W32F Floating extra </a></b></pre><p>Round r1 to an integral value using the round toward zero rule, giving r2. ! </p><pre><b><a name="53">code FROUND ( fs: r1 -- r2 ) \ ANSI Floating </a></b></pre><p>Round r1 to an integral value using the round to nearest rule, giving r2. </p><a name="Sec#8"></a> <h3>Integer to float conversion ! </h3><pre><b><a name="54">code D>F ( d -- ; Fs: -- r ) \ ANSI Floating </a></b></pre><p>Convert double number to floating-point number. ! </p><pre><b><a name="55">code F>D ( -- d ; fs: r -- ) \ ANSI Floating </a></b></pre><p>Convert floating-point number to double number, by rounding towards zero. If the result would be too large to fit in a double number then <br /> -9223372036854775808 is returned. ! </p><pre><b><a name="56">code ZF>D ( -- d ; fs: r -- ) \ W32F Floating extra </a></b></pre><p>Convert floating-point number to double number, using the current rounding mode (rounding towards nearest unless changed by the user). If the result would be too large to fit in a double number then <br /> -9223372036854775808 is returned. ! </p><pre><b><a name="57">: s>f ( n -- ; fs: -- r ) \ W32F Floating extra </a></b></pre><p>Convert the single number n to floating point number r. ! </p><pre><b><a name="58">: f>s ( -- n ; fs: r -- ) \ W32F Floating extra </a></b></pre><p>Convert the floating point number r to single number n. ! </p><pre><b><a name="59">code FS>DS ( -- dfloat fs: r -- ) \ W32F Floating extra </a></b></pre><p>Move floating point number bits to the data stack as a 64-bit float. This function is for passing floats to DLLs. ! </p><pre><b><a name="60">code SFS>DS ( -- float ; fs: r -- ) \ W32F Floating extra </a></b></pre><p>Push the top of the float stack onto the data stack as a 32-bit float. This function is for passing floats to DLLs. </p><a name="Sec#9"></a> <h3>FP Comparison operators ! </h3><pre><b><a name="61">: F0= ( -- f ; fs: r -- ) \ ANSI Floating </a></b></pre><p>Return true if r equals ±0e0. Returns false for NAN. ! </p><pre><b><a name="62">: F0< ( -- f ; fs: r -- ) \ ANSI Floating </a></b></pre><p>Return true if r is less than ±0e0. Returns false for NAN. ! </p><pre><b><a name="63">: f0> ( -- f ; fs: r -- ) \ W32F Floating extra </a></b></pre><p>Return true if r is greater than ±0e0. Returns false for NAN. ! </p><pre><b><a name="64">: f= ( -- f ; fs: r1 r2 -- ) \ W32F Floating extra </a></b></pre><p>Return true if r1 equals r2. Returns false if either number is a NAN. ! </p><pre><b><a name="65">: F< ( -- f ; fs: r1 r2 -- ) \ ANSI Floating </a></b></pre><p>Return true if r1 is less than r2. Returns false if either number is a NAN. ! </p><pre><b><a name="66">: f> ( -- f ; fs: r1 r2 -- ) \ W32F Floating extra </a></b></pre><p>Return true if r1 is greater than r2. Returns false if either number is a NAN. ! </p><pre><b><a name="67">: f<= ( -- f ; fs: r1 r2 -- ) \ W32F Floating extra </a></b></pre><p>Return true if r1 is less than or equal to r2. Returns true if either number is a NAN. ! </p><pre><b><a name="68">: f>= ( -- f ; fs: r1 r2 -- ) \ W32F Floating extra </a></b></pre><p>Return true if r1 is greater than or equal to r2. Returns true if either number is a NAN. ! </p><pre><b><a name="69">: FMAX ( fs: r1 r2 -- r3 ) \ ANSI Floating </a></b></pre><p>Return r3 the maximum of r1 and r2. If r1 is a NAN then so is r3. If r2 is a NAN then r3=r1. ! </p><pre><b><a name="70">: FMIN ( fs: r1 r2 -- r3 ) \ ANSI Floating </a></b></pre><p>Return r3 the minimum of r1 and r2. If r1 is a NAN then so is r3. If r2 is a NAN then r3=r1. </p><a name="Sec#10"></a> <h3>Arithmetic operators ! </h3><pre><b><a name="71">code F+ ( fs: r1 r2 -- r3 ) \ ANSI Floating </a></b></pre><p>Add r1 to r2. ! </p><pre><b><a name="72">code F- ( fs: r1 r2 -- r3 ) \ ANSI Floating </a></b></pre><p>Subtract r2 from r1. ! </p><pre><b><a name="73">code F* ( fs: r1 r2 -- r3 ) \ ANSI Floating </a></b></pre><p>Multiply r1 by r2. ! </p><pre><b><a name="74">code F/ ( fs: r1 r2 -- r3 ) \ ANSI Floating </a></b></pre><p>Divide r1 by r2. ! </p><pre><b><a name="75">code FNEGATE ( fs: r1 -- r2 ) \ ANSI Floating </a></b></pre><p>Reverse the sign of r1. ! </p><pre><b><a name="76">: 1/f ( fs: r1 -- r2 ) \ W32F Floating extra </a></b></pre><p>r2 is the reciprocal of r1. ! </p><pre><b><a name="77">code f2* ( fs: r1 -- r2 ) \ W32F Floating extra </a></b></pre><p>Multiply by 2. ! </p><pre><b><a name="78">code f2/ ( fs: r1 -- r2 ) \ W32F Floating extra </a></b></pre><p>Divide by 2. ! </p><pre><b><a name="79">code FABS ( fs: r1 -- r2 ) \ ANSI Floating ext </a></b></pre><p>r2 is the absolute value of r1. ! </p><pre><b><a name="80">code FSQRT ( fs: r1 -- r2 ) \ ANSI Floating ext ! </a></b></pre><p>r2 is the positive square root of r1. r2 is NAN for negative r1. ! </p><pre><b><a name="81">: F~ ( -- flag ; fs: r1 r2 r3 -- ) \ ANSI Floating ext </a></b></pre><p>If r3 is positive, flag is true if the absolute value of (r1 minus r2) is less than r3. If r3 is zero, flag is true if the implementation-dependent encoding of r1 and *************** *** 281,304 **** </p><a name="Sec#11"></a> <h3>Trigonometric functions ! </h3><pre><b><a name="80">: FSIN ( fs: r1 -- r2 ) \ ANSI Floating ext </a></b></pre><p>r2 is the sine of r1 in radians. ! </p><pre><b><a name="81">: FCOS ( fs: r1 -- r2 ) \ ANSI Floating ext </a></b></pre><p>r2 is the cosine of r1 in radians. ! </p><pre><b><a name="82">: FSINCOS ( fs: r1 -- r2 r3 ) \ ANSI Floating ext </a></b></pre><p>r2 is the sine and r3 the cosine of r1 in radians. This function is more efficient than calling FSIN and FCOS separately. ! </p><pre><b><a name="83">: FTAN ( fs: r1 -- r2 ) \ ANSI Floating ext </a></b></pre><p>r2 is the tangent of r1 in radians. </p><a name="Sec#12"></a> <h3>Inverse Trigonometric functions ! </h3><pre><b><a name="84">code FASIN ( fs: r1 -- r2 ) \ ANSI Floating ext </a></b></pre><p>r2 is the radian angle whose sine is r1. The result for |x| =< 1 is between ±pi/2. The result for |x| > 1 is NAN. ! </p><pre><b><a name="85">code FACOS ( fs: r1 -- r2 ) \ ANSI Floating ext </a></b></pre><p>r2 is the radian angle whose cosine is r1. The result for |x| =< 1 is between 0 and pi. The result for |x| > 1 is NAN ! </p><pre><b><a name="86">code FATAN ( fs: r1 -- r2 ) \ ANSI Floating ext </a></b></pre><p>r2 is the radian angle whose tangent is r1. The result is between ±pi/2. ! </p><pre><b><a name="87">code FATAN2 ( fs: r1 r2 -- r3 ) \ ANSI Floating ext </a></b></pre><p>r3 is the radian angle whose tangent is r1/r2. The result is between ±pi with the same sign as r2. If r1 and r2 are both zero then r3 is ±zero. --- 285,308 ---- </p><a name="Sec#11"></a> <h3>Trigonometric functions ! </h3><pre><b><a name="82">: FSIN ( fs: r1 -- r2 ) \ ANSI Floating ext </a></b></pre><p>r2 is the sine of r1 in radians. ! </p><pre><b><a name="83">: FCOS ( fs: r1 -- r2 ) \ ANSI Floating ext </a></b></pre><p>r2 is the cosine of r1 in radians. ! </p><pre><b><a name="84">: FSINCOS ( fs: r1 -- r2 r3 ) \ ANSI Floating ext </a></b></pre><p>r2 is the sine and r3 the cosine of r1 in radians. This function is more efficient than calling FSIN and FCOS separately. ! </p><pre><b><a name="85">: FTAN ( fs: r1 -- r2 ) \ ANSI Floating ext </a></b></pre><p>r2 is the tangent of r1 in radians. </p><a name="Sec#12"></a> <h3>Inverse Trigonometric functions ! </h3><pre><b><a name="86">code FASIN ( fs: r1 -- r2 ) \ ANSI Floating ext </a></b></pre><p>r2 is the radian angle whose sine is r1. The result for |x| =< 1 is between ±pi/2. The result for |x| > 1 is NAN. ! </p><pre><b><a name="87">code FACOS ( fs: r1 -- r2 ) \ ANSI Floating ext </a></b></pre><p>r2 is the radian angle whose cosine is r1. The result for |x| =< 1 is between 0 and pi. The result for |x| > 1 is NAN ! </p><pre><b><a name="88">code FATAN ( fs: r1 -- r2 ) \ ANSI Floating ext </a></b></pre><p>r2 is the radian angle whose tangent is r1. The result is between ±pi/2. ! </p><pre><b><a name="89">code FATAN2 ( fs: r1 r2 -- r3 ) \ ANSI Floating ext </a></b></pre><p>r3 is the radian angle whose tangent is r1/r2. The result is between ±pi with the same sign as r2. If r1 and r2 are both zero then r3 is ±zero. *************** *** 307,325 **** </p><a name="Sec#13"></a> <h3>Logarithmic functions ! </h3><pre><b><a name="88">code FLN ( fs: r1 -- r2 ) \ ANSI Floating ext </a></b></pre><p>r2 is the natural logarithm of r1. If r1 is ±0 then r2 is -infinity. If r1 is infinity then r2 is infinity. If r1 is less than zero then r2 is a NAN. ! </p><pre><b><a name="89">code FLNP1 ( fs: r1 -- r2 ) \ ANSI Floating ext </a></b></pre><p>r2 is the natural logarithm of the quantity r1 plus one. If r1 is -1.0 then r2 is -infinity. If r1 is infinity then r2 is infinity. If r1 is less than -1.0 then r2 is a NAN. ! </p><pre><b><a name="90">code FLOG ( fs: r1 -- r2 ) \ ANSI Floating ext </a></b></pre><p>r2 is the logarithm to base 10 of r1. If r1 is ±0 then r2 is -infinity. If r1 is infinity then r2 is infinity. If r1 is less than zero then r2 is a NAN. </p><a name="Sec#14"></a> <h3>Exponential functions ! </h3><pre><b><a name="91">code FEXP ( fs: r1 -- r2 ) \ ANSI Floating ext </a></b></pre><p>Raise e to the power r1, giving r2. ! </p><pre><b><a name="92">code FEXPM1 ( fs: r1 -- r2 ) \ ANSI Floating ext </a></b></pre><p>Raise e to the power r1 and subtract one, giving r2. </p><p>This function allows accurate computation when its arguments are close to zero, and --- 311,329 ---- </p><a name="Sec#13"></a> <h3>Logarithmic functions ! </h3><pre><b><a name="90">code FLN ( fs: r1 -- r2 ) \ ANSI Floating ext </a></b></pre><p>r2 is the natural logarithm of r1. If r1 is ±0 then r2 is -infinity. If r1 is infinity then r2 is infinity. If r1 is less than zero then r2 is a NAN. ! </p><pre><b><a name="91">code FLNP1 ( fs: r1 -- r2 ) \ ANSI Floating ext </a></b></pre><p>r2 is the natural logarithm of the quantity r1 plus one. If r1 is -1.0 then r2 is -infinity. If r1 is infinity then r2 is infinity. If r1 is less than -1.0 then r2 is a NAN. ! </p><pre><b><a name="92">code FLOG ( fs: r1 -- r2 ) \ ANSI Floating ext </a></b></pre><p>r2 is the logarithm to base 10 of r1. If r1 is ±0 then r2 is -infinity. If r1 is infinity then r2 is infinity. If r1 is less than zero then r2 is a NAN. </p><a name="Sec#14"></a> <h3>Exponential functions ! </h3><pre><b><a name="93">code FEXP ( fs: r1 -- r2 ) \ ANSI Floating ext </a></b></pre><p>Raise e to the power r1, giving r2. ! </p><pre><b><a name="94">code FEXPM1 ( fs: r1 -- r2 ) \ ANSI Floating ext </a></b></pre><p>Raise e to the power r1 and subtract one, giving r2. </p><p>This function allows accurate computation when its arguments are close to zero, and *************** *** 327,353 **** such as cosh(x) can be efficiently and accurately implemented by using FEXPM1; accuracy is lost in this function for small values of x if the word FEXP is used. ! </p><pre><b><a name="93">: f** ( fs: r1 r2 -- r3 ) \ ANSI Floating ext </a></b></pre><p>Raise r1 to the power r2, giving the product r3. ! </p><pre><b><a name="94">: FALOG ( fs: r1 -- r2 ) \ ANSI Floating ext </a></b></pre><p>Raise ten to the power r1, giving r2. </p><a name="Sec#15"></a> <h3>Hyperbolic functions ! </h3><pre><b><a name="95">: FSINH ( fs: r1 -- r2 ) \ ANSI Floating ext </a></b></pre><p>r2 is the hyperbolic sine of r1. ! </p><pre><b><a name="96">: FCOSH ( fs: r1 -- r2 ) \ ANSI Floating ext </a></b></pre><p>r2 is the hyperbolic cosine of r1. ! </p><pre><b><a name="97">: FTANH ( fs: r1 -- r2 ) \ ANSI Floating ext </a></b></pre><p>r2 is the hyperbolic tangent of r1, |r2| <= 1. </p><a name="Sec#16"></a> <h3>Inverse hyperbolic functions ! </h3><pre><b><a name="98">code FASINH ( fs: r1 -- r2 ) \ ANSI Floating ext </a></b></pre><p>r2 is the number whose hyperbolic sine is r1. ! </p><pre><b><a name="99">code FACOSH ( fs: r1 -- r2 ) \ ANSI ... [truncated message content] |