PFE - Portable Forth Environment - pfe Forth Wordsets

PFE 0.33.71 Homepage SourceForge Download Documentation -Overview -The PFE Manual old manual / (book) -ChangeLog -Authors -License (LGPL) -Wordsets / (book) -Functions .. (book) -Dp of ANS Forth -The 4thTutor -Forthprimer.pdf - Old Wordsets - Old Words List Forth Links * Forth Repository * Taygeta Compilation * TinyBoot FirmWare * FiCL, Free Forth * Research Vienna * Research Bournemouth * zForth WebRing Other Links * Tektronix/MPT * Forth Org. (FIG) * Forth Inc. * MPE Ltd. Forths * SF Win32Forth * PD Win32Forth * Neil Bawd generated (C) Guido U. Draheim guidod@gmx.de | ## Complex floating point `R2P1``` => `"EXTENSIONS"` (no description) primitive code = [r2p1] `T2P1``` => `"EXTENSIONS"` (no description) primitive code = [t2p1] `LAMBDA/EPSILON``` => `"EXTENSIONS"` (no description) primitive code = [lambda_slash_epsilon] `Z@``( addr -- f: z )``` => `"EXTENSIONS"` primitive code = [p4_z_fetch] `Z!``( addr f: z -- )``` => `"EXTENSIONS"` primitive code = [p4_z_store] `X@``( zaddr -- f: x )``` => `"EXTENSIONS"` primitive code = [p4_x_fetch] `X!``( zaddr f: x -- )``` => `"EXTENSIONS"` primitive code = [p4_x_store] `Y@``( zaddr -- f: y )``` => `"EXTENSIONS"` primitive code = [p4_y_fetch] `Y!``( zaddr f: x -- )``` => `"EXTENSIONS"` primitive code = [p4_y_store] `Z.``(f: z -- )``` => `"EXTENSIONS"` Emit the complex number, including the sign of zero when `signbit()` is available. primitive code = [p4_z_dot] `ZS.``(f: z -- )``` => `"EXTENSIONS"` Emit the complex number in scientific notation, including the sign of zero when `signbit()` is available. primitive code = [p4_z_s_dot] `REAL``(f: x y -- x )``` => `"EXTENSIONS"` primitive code = [p4_real] `IMAG``(f: x y -- y )``` => `"EXTENSIONS"` primitive code = [p4_imag] `CONJG``(f: x y -- x -y )``` => `"EXTENSIONS"` primitive code = [p4_conjg] `ZDROP``(f: z -- )``` => `"EXTENSIONS"` primitive code = [p4_z_drop] `ZDUP``(f: z -- z z )``` => `"EXTENSIONS"` primitive code = [p4_z_dup] `ZSWAP``(f: z1 z2 -- z2 z1 )``` => `"EXTENSIONS"` primitive code = [p4_z_swap] `ZOVER``(f: z1 z2 -- z1 z2 z1 )``` => `"EXTENSIONS"` primitive code = [p4_z_over] `ZNIP``(f: z1 z2 -- z2 )``` => `"EXTENSIONS"` primitive code = [p4_z_nip] `ZTUCK``(f: z1 z2 -- z2 z1 z2 )``` => `"EXTENSIONS"` primitive code = [p4_z_tuck] `ZROT``(f: z1 z2 z3 -- z2 z3 z1 )``` => `"EXTENSIONS"` primitive code = [p4_z_rot] `-ZROT``(f: z1 z2 z3 -- z3 z1 z2 )``` => `"EXTENSIONS"` primitive code = [p4_minus_z_rot] `Z+``(f: z1 z2 -- z1+z2 )``` => `"EXTENSIONS"` primitive code = [p4_z_plus] `Z-``(f: z1 z2 -- z1-z2 )``` => `"EXTENSIONS"` primitive code = [p4_z_minus] `Z*``(f: x y u v -- x*u-y*v x*v+y*u )``` => `"EXTENSIONS"` Uses the algorithm followed by JVN: (x+iy)*(u+iv) = [(x+y)*u - y*(u+v)] + i[(x+y)*u + x*(v-u)] Requires 3 multiplications and 5 additions. primitive code = [p4_z_star] `Z/``(f: u+iv z -- u/z+iv/z )``` => `"EXTENSIONS"` Kahan-like algorithm *without* due attention to spurious over/underflows and zeros and infinities. primitive code = [p4_z_slash] `ZNEGATE``(f: z -- -z )``` => `"EXTENSIONS"` primitive code = [p4_z_negate] `Z2*``(f: z -- z*2 )``` => `"EXTENSIONS"` primitive code = [p4_z_two_star] `Z2/``(f: z -- z/2 )``` => `"EXTENSIONS"` primitive code = [p4_z_two_slash] `I*``(f: x y -- -y x )``` => `"EXTENSIONS"` primitive code = [p4_i_star] `-I*``(f: x y -- y -x )``` => `"EXTENSIONS"` primitive code = [p4_minus_i_star] `1/Z``(f: z -- 1/z )``` => `"EXTENSIONS"` Kahan algorithm *without* due attention to spurious over/underflows and zeros and infinities. primitive code = [p4_one_slash_z] `Z^2``(f: z -- z^2 )``` => `"EXTENSIONS"` Kahan algorithm without removal of any spurious NaN created by overflow. It deliberately uses (x-y)(x+y) instead of x^2-y^2 for the real part. primitive code = [p4_z_hat_two] `|Z|^2``(f: x y -- |z|^2 )``` => `"EXTENSIONS"` primitive code = [p4_z_abs_hat_two] `Z^N``( n f: z -- z^n )``` => `"EXTENSIONS"` primitive code = [p4_z_hat_n] `X+``(f: z a -- x+a y )``` => `"EXTENSIONS"` primitive code = [p4_x_plus] `X-``(f: z a -- x-a y )``` => `"EXTENSIONS"` primitive code = [p4_x_minus] `Y+``(f: z a -- x y+a )``` => `"EXTENSIONS"` primitive code = [p4_y_plus] `Y-``(f: z a -- x y-a )``` => `"EXTENSIONS"` primitive code = [p4_y_minus] `Z*F``(f: x y f -- x*f y*f )``` => `"EXTENSIONS"` primitive code = [p4_z_star_f] `Z/F``(f: x y f -- x/f y/f )``` => `"EXTENSIONS"` primitive code = [p4_z_slash_f] `F*Z``(f: f x y -- f*x f*y )``` => `"EXTENSIONS"` primitive code = [p4_f_star_z] `F/Z``(f: f z -- f/z )``` => `"EXTENSIONS"` Kahan algorithm *without* due attention to spurious over/underflows and zeros and infinities. primitive code = [p4_f_slash_z] `Z*I*F``(f: z f -- z*if )``` => `"EXTENSIONS"` primitive code = [p4_z_star_i_star_f] `-I*Z/F``(f: z f -- z/[if] )``` => `"EXTENSIONS"` primitive code = [p4_minus_i_star_z_slash_f] `I*F*Z``(f: f z -- if*z )``` => `"EXTENSIONS"` primitive code = [p4_i_star_f_star_z] `I*F/Z``(f: f z -- [0+if]/z )``` => `"EXTENSIONS"` Kahan algorithm *without* due attention to spurious over/underflows and zeros and infinities. primitive code = [p4_i_star_f_slash_z] `Z*>REAL``(f: z1 z2 -- Re[z1*z2] )``` => `"EXTENSIONS"` Compute the real part of the complex product without computing the imaginary part. Recommended by Kahan to avoid gratuitous overflow or underflow signals from the unnecessary part. primitive code = [p4_z_star_to_real] `Z*>IMAG``(f: z1 z2 -- Im[z1*z2] )``` => `"EXTENSIONS"` Compute the imaginary part of the complex product without computing the real part. primitive code = [p4_z_star_to_imag] `|Z|``(f: x y -- |z| )``` => `"EXTENSIONS"` primitive code = [p4_z_abs] `ZBOX``(f: z -- box[z] )``` => `"EXTENSIONS"` Defined *only* for zero and infinite arguments. This difffers from Kahan's `CBOX` [p. 198] by conserving signs when only one of x or y is infinite, consistent with the other cases, and with its use in his `ARG` [p. 199]. primitive code = [p4_z_box] `ARG``(f: z -- principal.arg[z] )``` => `"EXTENSIONS"` primitive code = [p4_arg] `>POLAR``(f: x y -- r theta )``` => `"EXTENSIONS"` Convert the complex number z to its polar representation, where theta is the principal argument. primitive code = [p4_to_polar] `POLAR>``(f: r theta -- x y )``` => `"EXTENSIONS"` primitive code = [p4_polar_from] `ZSSQS``(f: z -- rho s: k )``` => `"EXTENSIONS"` Compute rho = |(x+iy)/2^k|^2, scaled to avoid overflow or underflow, and leave the scaling integer k. Kahan, p. 200. primitive code = [p4_z_ssqs] `ZSQRT``(f: z -- sqrt[z] )``` => `"EXTENSIONS"` Compute the principal branch of the square root, with Re sqrt[z] >= 0. Kahan, p. 201. primitive code = [p4_z_sqrt] `ZLN``(f: z -- ln|z|+i*theta )``` => `"EXTENSIONS"` Compute the principal branch of the complex natural logarithm. The angle theta is the principal argument. This code uses Kahan's algorithm for the scaled logarithm `CLOGS(z,J)` = ln(z*2^J), with J=0 and blind choices of the threshholds T0, T1, and T2. Namely, T0 = 1/sqrt(2), T1 = 5/4, and T2 = 3; primitive code = [p4_z_ln] `ZEXP``(f: z -- exp[z] )``` => `"EXTENSIONS"` primitive code = [p4_z_exp] `Z^``(f: x y u v -- [x+iy]^[u+iv] )``` => `"EXTENSIONS"` Compute in terms of the principal argument of x+iy. primitive code = [p4_z_hat] `ZCOSH``(f: z -- cosh[z] )``` => `"EXTENSIONS"` primitive code = [p4_z_cosh] `ZSINH``(f: z -- sinh[z] )``` => `"EXTENSIONS"` primitive code = [p4_z_sinh] `ZTANH``(f: z -- tanh[z] )``` => `"EXTENSIONS"` Kahan, p. 204, including his divide by zero signal suppression for infinite values of `tan()`. To quote the very informative "=>'man math'" on our Darwin system about IEEE 754: "Divide-by-Zero is signaled only when a function takes exactly infinite values at finite operands." primitive code = [p4_z_tanh] `ZCOTH``(f: z -- 1/tanh[z] )``` => `"EXTENSIONS"` primitive code = [p4_z_coth] `ZCOS``(f: z -- cosh[i*z] )``` => `"EXTENSIONS"` primitive code = [p4_z_cos] `ZSIN``(f: z -- -i*sinh[i*z] )``` => `"EXTENSIONS"` primitive code = [p4_z_sin] `ZTAN``(f: z -- -i*tanh[i*z] )``` => `"EXTENSIONS"` primitive code = [p4_z_tan] `ZCOT``(f: z -- -i*coth[-i*z] )``` => `"EXTENSIONS"` primitive code = [p4_z_cot] `ZACOS``(f: z -- u+iv=acos[z] )``` => `"EXTENSIONS"` Kahan, p.202. primitive code = [p4_z_acos] `ZACOSH``(f: z -- u+iv=acosh[z] )``` => `"EXTENSIONS"` Kahan, p.203. primitive code = [p4_z_acosh] `ZASIN``(f: z -- u+iv=asin[z] )``` => `"EXTENSIONS"` Kahan, p.203. primitive code = [p4_z_asin] `ZASINH``(f: z -- -i*asin[i*z] )``` => `"EXTENSIONS"` Kahan, p. 203, couth. primitive code = [p4_z_asinh] `ZATANH``(f: z -- u+iv=atanh[z] )``` => `"EXTENSIONS"` Kahan, p. 203. primitive code = [p4_z_atanh] `ZATAN``(f: z -- -i*atanh[i*z] )``` => `"EXTENSIONS"` Kahan, p. 204, couth. primitive code = [p4_z_atan] `ZLITERAL``` => `"EXTENSIONS"` (no description) compiling word = [p4_z_literal]