From: George H. <geo...@us...> - 2006-02-21 11:04:02
|
Update of /cvsroot/win32forth/win32forth/doc In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv15442/win32forth/doc Modified Files: p-float.htm Log Message: gah: More Dexing (still work in progress) optimizations and bug fixes Index: p-float.htm =================================================================== RCS file: /cvsroot/win32forth/win32forth/doc/p-float.htm,v retrieving revision 1.16 retrieving revision 1.17 diff -C2 -d -r1.16 -r1.17 *** p-float.htm 20 Feb 2006 12:32:44 -0000 1.16 --- p-float.htm 21 Feb 2006 11:03:54 -0000 1.17 *************** *** 104,109 **** </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> Interpreting: ( -<fvalue>- -- FS: r -- ) <br /> ! Compiling: ( -<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 --- 104,109 ---- </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 *************** *** 147,151 **** </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 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="30">: F2NIP ( fs: r1 r2 r3 r4 -- r3 r4 ) \ W32F Floating extra --- 147,151 ---- </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 *************** *** 271,296 **** </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><a name="Sec#11"></a> <h3>Trigonometric functions ! </h3><pre><b><a name="79">: FSIN ( fs: r1 -- r2 ) \ ANSI Floating ext </a></b></pre><p>r2 is the sine of r1 in radians. ! </p><pre><b><a name="80">: FCOS ( fs: r1 -- r2 ) \ ANSI Floating ext </a></b></pre><p>r2 is the cosine of r1 in radians. ! </p><pre><b><a name="81">: 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="82">: 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="83">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="84">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="85">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="86">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. --- 271,304 ---- </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 + r2 are exactly identical (positive and negative zero are unequal). + If r3 is negative, flag is true if the absolute value of (r1 minus r2) is less than the + absolute value of r3 times the sum of the absolute values of r1 and r2. + </p><p>This provides the three types of floating point equality in common use -- close in + absolute terms, exact equality as represented, and relatively close. </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. *************** *** 299,317 **** </p><a name="Sec#13"></a> <h3>Logarithmic functions ! </h3><pre><b><a name="87">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="88">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="89">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="90">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="91">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 --- 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 *************** *** 319,350 **** 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="92">: 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="93">: 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="94">: FSINH ( fs: r1 -- r2 ) \ ANSI Floating ext </a></b></pre><p>r2 is the hyperbolic sine of r1. ! </p><pre><b><a name="95">: FCOSH ( fs: r1 -- r2 ) \ ANSI Floating ext </a></b></pre><p>r2 is the hyperbolic cosine of r1. ! </p><pre><b><a name="96">: 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="97">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="98">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="99">: 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="100">: 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 - r2 are exactly identical (positive and negative zero are unequal). - If r3 is negative, flag is true if the absolute value of (r1 minus r2) is less than the - absolute value of r3 times the sum of the absolute values of r1 and r2. - </p><p>This provides the three types of floating point equality in common use -- close in - absolute terms, exact equality as represented, and relatively close. </p><a name="Sec#17"></a> <h3>Input of Floating Point numbers --- 327,350 ---- 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 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="100">: 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><a name="Sec#17"></a> <h3>Input of Floating Point numbers *************** *** 365,386 **** <sign-form> := { + | - } <e-char> := { D | d | E | e } ! </pre><pre><b><a name="102">: f# ( "fp no." -- ; fs: -- r ) \ W32F Floating extra ! </a></b></pre><p>An attempt is made to convert the space delimited string following F# to internal floating-point representation. If the string represents a valid floating-point ! number in the syntax below, its value r and true are returned. If the string does not represent a valid floating-point number an error is thrown. <br /> F# used at the end of a line is treated as a special case representing zero. <br /> If interpreting the FP number is placed on the FP stack, while it is compiled as ! an Fliteral if compiling. ! </p><pre>The syntax of a convertible string := <significand>[<exponent>] ! ! <significand> := [<sign>]{<digits>[.<digits0>] | ! .<digits> } ! <exponent> := <marker><digits0> ! <marker> := {<e-form> | <sign-form>} ! <e-form> := <e-char>[<sign-form>] ! <sign-form> := { + | - } ! <e-char> := { D | d | E | e } ! </pre><a name="Sec#18"></a> <h3>Output conversion </h3><pre><b><a name="103">: REPRESENT ( addr u -- n flag1 flag2 ; fs: r -- ) \ ANSI Floating --- 365,379 ---- <sign-form> := { + | - } <e-char> := { D | d | E | e } ! </pre><pre><b><a name="102">: f# ( Interpretation: "fp no." -- ; fs: -- r ) \ W32F Floating extra ! </a></b></pre><p><b> ( Compilation: "fp no." -- ; run-time: fs: -- r ) </b> ! </p><p>An attempt is made to convert the space delimited string following F# to internal floating-point representation. If the string represents a valid floating-point ! number in the syntax below, its value r is returned. If the string does not represent a valid floating-point number an error is thrown. <br /> F# used at the end of a line is treated as a special case representing zero. <br /> If interpreting the FP number is placed on the FP stack, while it is compiled as ! an Fliteral if compiling. <br /> ! The syntax of a convertible string is the same as <b> >FLOAT </b>. ! </p><a name="Sec#18"></a> <h3>Output conversion </h3><pre><b><a name="103">: REPRESENT ( addr u -- n flag1 flag2 ; fs: r -- ) \ ANSI Floating |