From: George H. <geo...@us...> - 2006-02-06 15:05:31
|
Update of /cvsroot/win32forth/win32forth/doc In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv20001/win32forth/doc Modified Files: p-float.htm Log Message: gah: More documenting of float.f (still work in progress). Index: p-float.htm =================================================================== RCS file: /cvsroot/win32forth/win32forth/doc/p-float.htm,v retrieving revision 1.9 retrieving revision 1.10 diff -C2 -d -r1.9 -r1.10 *** p-float.htm 4 Feb 2006 16:12:24 -0000 1.9 --- p-float.htm 6 Feb 2006 15:05:20 -0000 1.10 *************** *** 29,33 **** while indeterminate results produce NANs. </p><h2>Glossary ! </h2><pre><b><a name="0">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. --- 29,59 ---- while indeterminate results produce NANs. </p><h2>Glossary ! </h2><h3>Loading and saving FPU registers ! </h3><p>The following words are for examining, saving, restoring and changing the state of the ! x87 FPU. They are not normally needed by applications although they can be useful for ! dealing with legacy code, which requires different rounding modes, precision, or ! exception handling. <br /> ! Since the default error handler resets the control word then applications that use ! other settings will need to CATCH all exceptions or modify the error handler. <br /> ! NOTE if programs unmask exceptions then they need to handle their own errors. ! For information on the settings and writng exception handlers refer to the INTEL ! 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">\- B/FLOAT 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">B/FLOAT aligned cell / 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. *************** *** 36,58 **** other floating-point words. </p><h3>Memory Access ! </h3><pre><b><a name="1">code F@ ( addr -- ) ( FS: -- r ) \ ANSI Floating </a></b></pre><p>Fetch a float. ! </p><pre><b><a name="2">code SF@ ( addr -- ) ( FS: -- r ) \ ANSI Floating ext </a></b></pre><p>Fetch a 32 bit (short) float. ! </p><pre><b><a name="3">code DF@ ( addr -- ) ( FS: -- r ) \ ANSI Floating ext </a></b></pre><p>Fetch a 64 bit (double) float. ! </p><pre><b><a name="4">code F! ( addr -- ) ( fs: r -- ) \ ANSI Floating </a></b></pre><p>Store a float. ! </p><pre><b><a name="5">code SF! ( addr -- ) ( fs: r -- ) \ ANSI Floating ext </a></b></pre><p>Store a 32 bit (short) float. ! </p><pre><b><a name="6">code DF! ( addr -- ) ( fs: r -- ) \ ANSI Floating ext </a></b></pre><p>Store a 64 bit (double) float. ! </p><pre><b><a name="7">code F+! ( addr -- ) ( fs: r -- ) \ W32F Floating extra </a></b></pre><p>Add the value to a float. ! </p><pre><b><a name="8">: 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="9">: 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="10">: FTO \ W32F Floating extra </a></b></pre><p><b> Interpreting: ( -<fvalue>- -- FS: r -- ) <br /> Compiling: ( -<fvalue>- -- Run-time: FS: r -- ) </b> --- 62,84 ---- other floating-point words. </p><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="A">code DF@ ( addr -- ; fs: -- r ) \ ANSI Floating ext </a></b></pre><p>Fetch a 64 bit (double) float. ! </p><pre><b><a name="B">code F! ( addr -- ; fs: r -- ) \ ANSI Floating </a></b></pre><p>Store a float. ! </p><pre><b><a name="C">code SF! ( addr -- ; fs: r -- ) \ ANSI Floating ext </a></b></pre><p>Store a 32 bit (short) float. ! </p><pre><b><a name="D">code DF! ( addr -- ; fs: r -- ) \ ANSI Floating ext </a></b></pre><p>Store a 64 bit (double) float. ! </p><pre><b><a name="E">code F+! ( addr -- ; fs: r -- ) \ W32F Floating extra </a></b></pre><p>Add the value to a float. ! </p><pre><b><a name="F">: 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="10">: 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="11">: FTO \ W32F Floating extra </a></b></pre><p><b> Interpreting: ( -<fvalue>- -- FS: r -- ) <br /> Compiling: ( -<fvalue>- -- Run-time: FS: r -- ) </b> *************** *** 60,228 **** be corrupted; no checks are made so the user should take care. FTO should not be POSTPONEd. ! </p><pre><b><a name="11">: FCONSTANT \ ANSI Floating ! </a></b></pre><p> <b> Interpretation: ( -<name>- ) ( F: r -- ) </b> <br /> Define an FP constant. <br /> <b> Compilation: </b> <br /> Append the run-time semantics given below to the current definition. <br /> ! <b> Run-time: ( F: -- r ) </b> <br /> Place r on the floating-point stack. ! </p><pre><b><a name="12">: FLITERAL ( fs: r -- ) \ ANSI Floating </a></b></pre><p> <b> Interpretation: </b> <br /> Interpretation semantics for this word are undefined. <br /> ! <b> Compilation: ( F: r -- ) </b> <br /> Append the run-time semantics given below to the current definition. <br /> ! <b> Run-time: ( F: -- r ) </b> <br /> Place r on the floating-point stack. </p><h3>Stack operations ! </h3><pre><b><a name="13">code FDROP ( fs: r -- ) \ ANSI Floating </a></b></pre><p>Remove r from the floating-point stack. ! </p><pre><b><a name="14">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="15">code FSWAP ( fs: r1 r2 -- r2 r1 ) \ ANSI Floating </a></b></pre><p>Exchange the top 2 FP numbers. ! </p><pre><b><a name="16">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="17">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="18">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="19">: FNIP ( fs: r1 r2 -- r2 ) \ W32F Floating extra </a></b></pre><p>Remove the 2nd FP stack entry. </p><h3>FP Stack operations on pairs of entries </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="20">code F2DROP ( fs: r1 r2 -- ) \ W32F Floating extra </a></b></pre><p>Remove the top 2 FP stack entries. ! </p><pre><b><a name="21">: 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="22">: F2SWAP ( fs: r1 r2 r3 r4 -- r3 r4 r2 r1 ) \ W32F Floating extra </a></b></pre><p>Swap the top pair of floating-point numbers with the second pair. ! </p><pre><b><a name="23">: F2NIP ( fs: r1 r2 r3 r4 -- r3 r4 ) \ W32F Floating extra </a></b></pre><p>Remove the 2nd pair of FP stack entries. </p><h3>Constants ! </h3><pre><b><a name="24">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="25">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="26">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="27">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="28">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="29">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="30">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="31"> f0.0 fconstant finf ( FS: -- r ) \ W32F Floating extra </a></b></pre><p>Push plus infinity. ! </p><pre><b><a name="32"> f1.0 fconstant f2.0 ( FS: -- r ) \ W32F Floating extra </a></b></pre><p>Push floating-point 2.0. ! </p><pre><b><a name="33"> f0.0 fconstant f10.0 ( FS: -- r ) \ W32F Floating extra </a></b></pre><p>Push floating-point 10.0. ! </p><pre><b><a name="34"> f1.0 fconstant f0.5 ( FS: -- r ) \ W32F Floating extra </a></b></pre><p>Push floating-point 0.5. ! </p><pre><b><a name="35"> 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="36"> 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="37"> f1.0 fconstant fsmall ( FS: -- r ) \ W32F Floating extra </a></b></pre><p>Push the smallest non-denormalised floating-point number. </p><h3>Variables ! </h3><pre><b><a name="38"> 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="39"> 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="40"> fvariable sq2/2m1 ( -- addr ) \ W32F Floating extra </a></b></pre><p>Return the address of a float containing sqrt(2)/2 - 1. ! </p><h3>Rounding Modes ! </h3><pre><b><a name="41">code FLOOR ( fs: f1 -- fs: f2 ) \ 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="42">code FCEIL ( fs: f1 -- fs: f2 ) \ 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="43">code FTRUNC ( fs: f1 -- fs: f2 ) \ 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="44">code FROUND ( fs: f1 -- fs: f2 ) \ ANSI Floating </a></b></pre><p>Round r1 to an integral value using the round to nearest rule, giving r2. </p><h3>Integer to float conversion ! </h3><pre><b><a name="45">code D>F ( d -- ) ( F: -- r ) \ ANSI Floating </a></b></pre><p>Convert double number to floating-point number. ! </p><pre><b><a name="46">code F>D ( -- d ) ( fs: r -- ) \ ANSI Floating </a></b></pre><p>Convert floating-point number to double number. If the result would be too large to fit in a double number then <br /> -9223372036854775808 is returned. ! </p><pre><b><a name="47">: 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="48">: 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="49">code FS>DS ( -- d ) ( f: 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="50">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><h3>Comparison operators ! </h3><pre><b><a name="51">: 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="52">: 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="53">: 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="54">: 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="55">: 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="56">: 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="57">: 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="58">: 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="59">: 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="60">: 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><h3>Arithmetic operators ! </h3><pre><b><a name="61">code F+ ( fs: r1 r2 -- r3 ) \ ANSI Floating </a></b></pre><p>Add r1 to r2. ! </p><pre><b><a name="62">code F- ( fs: r1 r2 -- r3 ) \ ANSI Floating </a></b></pre><p>Subtract r2 from r1. ! </p><pre><b><a name="63">code F* ( fs: r1 r2 -- r3 ) \ ANSI Floating </a></b></pre><p>Multiply r1 by r2. ! </p><pre><b><a name="64">code F/ ( fs: r1 r2 -- r3 ) \ ANSI Floating </a></b></pre><p>Divide r1 by r2. ! </p><pre><b><a name="65">code FNEGATE ( fs: r1 -- r2 ) \ ANSI Floating </a></b></pre><p>Reverse the sign of r1. ! </p><pre><b><a name="66">code f2/ ( fs: r1 -- r2 ) \ W32F Floating extra </a></b></pre><p>Multiply by 2. ! </p><pre><b><a name="67">code f2* ( fs: r1 -- r2 ) \ W32F Floating extra </a></b></pre><p>Divide by 2. ! </p><pre><b><a name="68">: 1/f ( fs: r1 -- r2 ) \ W32F Floating extra ! </a></b></pre><p>r2 is the reciprocal of r1. </p><h3>Trigonometric functions ! </h3><pre><b><a name="69">: FSIN ( f: r1 -- r2 ) \ ANSI Floating ext </a></b></pre><p>r2 is the sine of r1 in radians. ! </p><pre><b><a name="70">: FCOS ( f: r1 -- r2 ) \ ANSI Floating ext </a></b></pre><p>r2 is the cosine of r1 in radians. ! </p><pre><b><a name="71">: FSINCOS ( f: 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="72">: FTAN ( f: r1 -- r2 ) \ ANSI Floating ext </a></b></pre><p>r2 is the tangent of r1 in radians. </p><h3>Inverse Trigonometric functions ! </h3><pre><b><a name="73">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="74">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="75">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="76">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. --- 86,258 ---- be corrupted; no checks are made so the user should take care. FTO should not be POSTPONEd. ! </p><pre><b><a name="12">: FCONSTANT ( -<name>- ; fs: r -- ) \ ANSI Floating ! </a></b></pre><p> <b> Interpretation: ( -<name>- ; fs: r -- ) </b> <br /> Define an FP constant. <br /> <b> Compilation: </b> <br /> Append the run-time semantics given below to the current definition. <br /> ! <b> Run-time: ( fs: -- r ) </b> <br /> Place r on the floating-point stack. ! </p><pre><b><a name="13">: 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 /> ! <b> Compilation: ( fs: r -- ) </b> <br /> Append the run-time semantics given below to the current definition. <br /> ! <b> Run-time: ( fs: -- r ) </b> <br /> Place r on the floating-point stack. </p><h3>Stack operations ! </h3><pre><b><a name="14">code FDROP ( fs: r -- ) \ ANSI Floating </a></b></pre><p>Remove r from the floating-point stack. ! </p><pre><b><a name="15">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="16">code FSWAP ( fs: r1 r2 -- r2 r1 ) \ ANSI Floating </a></b></pre><p>Exchange the top 2 FP numbers. ! </p><pre><b><a name="17">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="18">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="19">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="1A">: FNIP ( fs: r1 r2 -- r2 ) \ W32F Floating extra </a></b></pre><p>Remove the 2nd FP stack entry. </p><h3>FP Stack operations on pairs of entries </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="1B">code F2DROP ( fs: r1 r2 -- ) \ W32F Floating extra </a></b></pre><p>Remove the top 2 FP stack entries. ! </p><pre><b><a name="1C">: 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="1D">: F2SWAP ( fs: r1 r2 r3 r4 -- r3 r4 r2 r1 ) \ W32F Floating extra </a></b></pre><p>Swap the top pair of floating-point numbers with the second pair. ! </p><pre><b><a name="1E">: F2NIP ( fs: r1 r2 r3 r4 -- r3 r4 ) \ W32F Floating extra </a></b></pre><p>Remove the 2nd pair of FP stack entries. </p><h3>Constants ! </h3><pre><b><a name="1F">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="20">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="21">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="22">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="23">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="24">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="25">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="26"> f0.0 fconstant finf ( FS: -- r ) \ W32F Floating extra </a></b></pre><p>Push plus infinity. ! </p><pre><b><a name="27"> f1.0 fconstant f2.0 ( FS: -- r ) \ W32F Floating extra </a></b></pre><p>Push floating-point 2.0. ! </p><pre><b><a name="28"> f0.0 fconstant f10.0 ( FS: -- r ) \ W32F Floating extra </a></b></pre><p>Push floating-point 10.0. ! </p><pre><b><a name="29"> f1.0 fconstant f0.5 ( FS: -- r ) \ W32F Floating extra </a></b></pre><p>Push floating-point 0.5. ! </p><pre><b><a name="2A"> 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="2B"> 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="2C"> f1.0 fconstant fsmall ( FS: -- r ) \ W32F Floating extra </a></b></pre><p>Push the smallest non-denormalised floating-point number. </p><h3>Variables ! </h3><pre><b><a name="2D"> 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="2E"> 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="2F"> fvariable sq2/2m1 ( -- addr ) \ W32F Floating extra </a></b></pre><p>Return the address of a float containing sqrt(2)/2 - 1. ! </p><h3>Rounding functions ! </h3><pre><b><a name="30">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="31">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="32">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="33">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><h3>Integer to float conversion ! </h3><pre><b><a name="34">code D>F ( d -- ; Fs: -- r ) \ ANSI Floating </a></b></pre><p>Convert double number to floating-point number. ! </p><pre><b><a name="35">code F>D ( -- d ; fs: r -- ) \ ANSI Floating </a></b></pre><p>Convert floating-point number to double number. If the result would be too large to fit in a double number then <br /> -9223372036854775808 is returned. ! </p><pre><b><a name="36">: 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="37">: 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="38">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="39">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><h3>Comparison operators ! </h3><pre><b><a name="3A">: 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="3B">: 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="3C">: 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="3D">: 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="3E">: 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="3F">: 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="40">: 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="41">: 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="42">: 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="43">: 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><h3>Arithmetic operators ! </h3><pre><b><a name="44">code F+ ( fs: r1 r2 -- r3 ) \ ANSI Floating </a></b></pre><p>Add r1 to r2. ! </p><pre><b><a name="45">code F- ( fs: r1 r2 -- r3 ) \ ANSI Floating </a></b></pre><p>Subtract r2 from r1. ! </p><pre><b><a name="46">code F* ( fs: r1 r2 -- r3 ) \ ANSI Floating </a></b></pre><p>Multiply r1 by r2. ! </p><pre><b><a name="47">code F/ ( fs: r1 r2 -- r3 ) \ ANSI Floating </a></b></pre><p>Divide r1 by r2. ! </p><pre><b><a name="48">code FNEGATE ( fs: r1 -- r2 ) \ ANSI Floating </a></b></pre><p>Reverse the sign of r1. ! </p><pre><b><a name="49">: 1/f ( fs: r1 -- r2 ) \ W32F Floating extra ! </a></b></pre><p>r2 is the reciprocal of r1. ! </p><pre><b><a name="4A">code f2/ ( fs: r1 -- r2 ) \ W32F Floating extra </a></b></pre><p>Multiply by 2. ! </p><pre><b><a name="4B">code f2* ( fs: r1 -- r2 ) \ W32F Floating extra </a></b></pre><p>Divide by 2. ! </p><pre><b><a name="4C">code FABS ( fs: r1 -- r2 ) \ ANSI Floating ext ! </a></b></pre><p>r2 is the absolute value of r1. ! </p><pre><b><a name="4D">code FSQRT ( fs: r1 -- r2 ) \ ANSI Floating ext ! </a></b></pre><p>r2 is the positive square root of r1. </p><h3>Trigonometric functions ! </h3><pre><b><a name="4E">: FSIN ( fs: r1 -- r2 ) \ ANSI Floating ext </a></b></pre><p>r2 is the sine of r1 in radians. ! </p><pre><b><a name="4F">: FCOS ( fs: r1 -- r2 ) \ ANSI Floating ext </a></b></pre><p>r2 is the cosine of r1 in radians. ! </p><pre><b><a name="50">: 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="51">: FTAN ( fs: r1 -- r2 ) \ ANSI Floating ext </a></b></pre><p>r2 is the tangent of r1 in radians. </p><h3>Inverse Trigonometric functions ! </h3><pre><b><a name="52">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="53">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="54">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="55">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. *************** *** 230,263 **** polar coordinates. </p><h3>Logarithmic functions ! </h3><pre><b><a name="77">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="78">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><h3>Exponential functions ! </h3><h3>Hyperbolic functions ! </h3><pre><b><a name="79">: FSINH ( f: r1 -- r2 ) \ ANSI Floating ext </a></b></pre><p>r2 is the hyperbolic sine of r1. ! </p><pre><b><a name="80">: FCOSH ( f: r1 -- r2 ) \ ANSI Floating ext </a></b></pre><p>r2 is the hyperbolic cosine of r1. ! </p><pre><b><a name="81">: FTANH ( f: r1 -- r2 ) \ ANSI Floating ext </a></b></pre><p>r2 is the hyperbolic tangent of r1, |r2| <= 1. </p><h3>Inverse hyperbolic functions ! </h3><pre><b><a name="82">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="83">code FACOSH ( fs: r1 -- r2 ) \ ANSI Floating ext </a></b></pre><p>r2 is the number whose hyperbolic cosine is r1. If r1 < 1.0 then r2 is a NAN. ! </p><pre><b><a name="84">: FATANH ( f: r1 -- r2 ) \ ANSI Floating ext </a></b></pre><p>r2 is the number whose hyperbolic tangent is r1. IF |r1| > 1.0 then r2 is a NAN. ! </p><h3>Output conversion. ! </h3><pre><b><a name="85">: PRECISION ( -- u ) \ ANSI Floating ext </a></b></pre><p>Return the number of significant digits currently used by (F.), (FE.), (FS.), F., FE., or FS. as u. ! </p><pre><b><a name="86">: SET-PRECISION ( u -- ) \ ANSI Floating ext </a></b></pre><p>Set the number of significant digits currently used by (F.), (FE.), (FS.), F., FE., or FS. to u. ! </p><pre><b><a name="87">: min-precision ( u -- ) \ W32F Floating extra </a></b></pre><p>Set the number of significant digits currently used by (F.), (FE.), (FS.), F., FE., or FS. to u if it is greater than the present setting. --- 260,353 ---- polar coordinates. </p><h3>Logarithmic functions ! </h3><pre><b><a name="56">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="57">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="58">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><h3>Exponential functions ! </h3><pre><b><a name="59">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="5A">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 ! provides a useful base for the standard exponential functions. Hyperbolic functions ! 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="5B">: f** ( fs: r1 r2 -- r3 ) \ ANSI Floating ext ! </a></b></pre><p>Raise r1 to the power r2, giving the product r3. ! </p><h3>Hyperbolic functions ! </h3><pre><b><a name="5C">: FSINH ( fs: r1 -- r2 ) \ ANSI Floating ext </a></b></pre><p>r2 is the hyperbolic sine of r1. ! </p><pre><b><a name="5D">: FCOSH ( fs: r1 -- r2 ) \ ANSI Floating ext </a></b></pre><p>r2 is the hyperbolic cosine of r1. ! </p><pre><b><a name="5E">: FTANH ( fs: r1 -- r2 ) \ ANSI Floating ext </a></b></pre><p>r2 is the hyperbolic tangent of r1, |r2| <= 1. </p><h3>Inverse hyperbolic functions ! </h3><pre><b><a name="5F">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="60">code FACOSH ( fs: r1 -- r2 ) \ ANSI Floating ext </a></b></pre><p>r2 is the number whose hyperbolic cosine is r1. If r1 < 1.0 then r2 is a NAN. ! </p><pre><b><a name="61">: FATANH ( fs: r1 -- r2 ) \ ANSI Floating ext </a></b></pre><p>r2 is the number whose hyperbolic tangent is r1. IF |r1| > 1.0 then r2 is a NAN. ! </p><pre><b><a name="62">: REPRESENT ( addr u -- n flag1 flag2 ; fs: r -- ) \ ANSI Floating ! </a></b></pre><p>At c-addr, place the character-string external representation of the significand of ! the floating-point number r. Return the decimal-base exponent as n, the sign as flag1 ! and valid result as flag2. The character string shall consist of the u most significant ! digits of the significand represented as a decimal fraction with the implied decimal ! point to the left of the first digit, and the first digit zero only if all digits ! are zero. The significand is rounded to u digits following the round to nearest ! rule; n is adjusted, if necessary, to correspond to the rounded magnitude of the ! significand. If flag2 is true then r was in the implementation-defined range of ! floating-point numbers. If flag1 is true then r is negative. <br /> ! An ambiguous condition exists if the value of BASE is not decimal ten. <br /> ! When flag2 is false, n is 7FFFFFFF and flag1 is the sign. The contents of c-addr are ! the first u characters of either NAN or Infinity, padded with spaces if necessary. ! </p><h3>Input of Floating Poin... [truncated message content] |