home *** CD-ROM | disk | FTP | other *** search
/ The C Users' Group Library 1994 August / wc-cdrom-cusersgrouplibrary-1994-08.iso / vol_200 / 247_02 / manual2.doc < prev    next >
Text File  |  1989-04-19  |  61KB  |  2,641 lines

  1.                       Appendix III - MIRACL routines
  2.  
  3.  
  4.       Note: In these routines a big parameter can also be used wherever a
  5.             flash is specified, but not visa-versa. Further information may
  6.             be gleaned from the (lightly) commented source code.
  7.  
  8.  
  9.       Function:      void absol(x,y)                          absol     
  10.                      flash x,y;
  11.  
  12.       Module:        bncore.c
  13.  
  14.       Description:   Gives absolute value of a big or flash number.
  15.  
  16.       Parameters:    Two big/flash variables x and y. On exit y=abs(x).
  17.  
  18.       Return value:  None
  19.  
  20.       Restrictions:  None
  21.  
  22.       See also:      negate
  23.  
  24.  
  25.  
  26.       Function:      void add(x,y,z)                          add       
  27.                      big x,y,z;
  28.  
  29.       Module:        bnarth0.c
  30.  
  31.       Description:   Adds two big numbers.
  32.  
  33.       Parameters:    Three big numbers x, y and z. On exit z=x+y.
  34.  
  35.       Return value:  None
  36.  
  37.       Restrictions:  None
  38.  
  39.       See also:      subtract, incr, decr.
  40.  
  41.       Example:       add(x,x,x);
  42.  
  43.                      This doubles the value of x.
  44.  
  45.  
  46.  
  47.  
  48.  
  49.  
  50.  
  51.  
  52.  
  53.  
  54.  
  55.  
  56.  
  57.  
  58.  
  59.  
  60.  
  61.  
  62.  
  63.  
  64.  
  65.  
  66.  
  67.  
  68.       Function:      void bigdig(x,n,b)                          bigdig       
  69.                      big x;
  70.                      int n,b;
  71.  
  72.       Module:        bnrand.c
  73.  
  74.       Description:   Generates a big random number of given length.
  75.  
  76.       Parameters:    A big number x and two integers n and b. On exit x
  77.                      contains a big random number n digits long to base b.
  78.  
  79.       Return value:  None
  80.  
  81.       Restrictions:  None
  82.  
  83.       See also:      bigrand
  84.  
  85.       Example:       bigdig(x,100,10);
  86.  
  87.                      This generates a 100 decimal digit random number x
  88.  
  89.  
  90.  
  91.       Function:      void bigrand(w,x)                          bigrand     
  92.                      big w,x;
  93.  
  94.       Module:        bnrand.c
  95.  
  96.       Description:   Generates a big random number.
  97.  
  98.       Parameters:    Two big numbers w and x. On exit x is a big random number
  99.                      in the range 1<x<w.
  100.  
  101.       Return value:  None
  102.  
  103.       Restrictions:  None
  104.  
  105.       See also:      bigdig
  106.  
  107.  
  108.  
  109.       Function:      int brand()                         brand  
  110.  
  111.       Module:        bncore.c
  112.  
  113.       Description:   Generates random integer number
  114.  
  115.       Parameters:    None
  116.  
  117.       Return Value:  A random integer number
  118.  
  119.       Restrictions:  First use must be preceded by an initial call to irand.
  120.  
  121.       See also:      irand, bigrand, bigdig, frand.
  122.  
  123.  
  124.  
  125.  
  126.  
  127.  
  128.  
  129.  
  130.  
  131.  
  132.  
  133.  
  134.  
  135.  
  136.       Function:      void build(x,gener)                          build         
  137.                      flash x;
  138.                      int (*gener)();
  139.  
  140.       Module:        bnbuild.c
  141.  
  142.       Description:   Uses supplied generator of regular continued fraction
  143.                      expansion to build up a flash number, rounded if
  144.                      necessary.
  145.  
  146.       Parameters:    The flash number created, and the generator function.
  147.  
  148.       Return value:  None
  149.  
  150.       Restrictions:  None
  151.  
  152.       See also:      round, froot, fexp, ftan
  153.  
  154.       Example:       int phi(w,n)
  155.                      flash w;
  156.                      int n;
  157.                      { /* rcf generator for golden ratio */
  158.                           return 1;
  159.                      }
  160.  
  161.                       .
  162.                       .
  163.                      build(x,phi);
  164.                       .
  165.  
  166.                      This will calculate the golden ratio in x - very quickly!
  167.  
  168.  
  169.  
  170.  
  171.  
  172.  
  173.  
  174.  
  175.  
  176.  
  177.  
  178.  
  179.  
  180.  
  181.  
  182.  
  183.  
  184.  
  185.  
  186.  
  187.  
  188.  
  189.  
  190.  
  191.  
  192.  
  193.  
  194.  
  195.  
  196.  
  197.  
  198.  
  199.  
  200.  
  201.       Function:      int cinnum(x,f)                         cinnum     
  202.                      flash x;
  203.                      FILE *f;
  204.  
  205.       Module:        bnio2.c
  206.  
  207.       Description:   Inputs a flash number from the keyboard, a file or a
  208.                      string, using as number base the current value of the
  209.                      global variable IOBASE. Flash numbers can be entered
  210.                      using either a slash '/' to indicate numerator and
  211.                      denominator, or with a radix point.
  212.  
  213.       Parameters:    A big/flash number x and a file descriptor f. For
  214.                      input from the keyboard specify f as stdin, otherwise
  215.                      as the descriptor of some other opened file. To input
  216.                      from a string copy the string to the global character
  217.                      array IBUFF before calling cinnum. In this case the
  218.                      file descriptor will be ignored and input taken from
  219.                      IBUFF instead. To force input of a fixed number of
  220.                      bytes, set global INPLEN to the required number,
  221.                      just before calling cinnum.
  222.  
  223.       Return value:  The number of input characters.
  224.  
  225.       Restrictions:  None
  226.  
  227.       See also:      innum, otnum, cotnum
  228.  
  229.       Example:       char* chex="AF1298065BFE4C96DB723A";
  230.                               .
  231.                          IOBASE=16;
  232.                          strcpy(IBUFF,chex);
  233.                          cinnum(x,stdin);
  234.  
  235.                      This will input the large hex number chex into the
  236.                      big variable x.
  237.  
  238.                          IOBASE=256;
  239.                          INPLEN=25;
  240.                          cinnum(x,fp);
  241.  
  242.                      This will input 25 bytes from the file associated with
  243.                      fp, and convert them into a big positive number x.
  244.  
  245.  
  246.  
  247.  
  248.  
  249.  
  250.  
  251.  
  252.  
  253.  
  254.  
  255.  
  256.  
  257.  
  258.  
  259.  
  260.  
  261.  
  262.  
  263.  
  264.  
  265.  
  266.       Function:      int compare(x,y)                         compare     
  267.                      big x,y;
  268.  
  269.       Module:        bncore.c
  270.  
  271.       Description:   Compares two big numbers.
  272.  
  273.       Parameters:    Two big numbers x and y.
  274.  
  275.       Return value:  Returns +1 if x>y, returns 0 if x=y, returns -1 if x<y.
  276.  
  277.       Restrictions:  None
  278.  
  279.       See also:      fcomp
  280.  
  281.  
  282.  
  283.       Function:      void convert(n,x)                          convert     
  284.                      int n;
  285.                      big x;
  286.  
  287.       Module:        bncore.c
  288.  
  289.       Description:   Convert an integer number to big number format.
  290.  
  291.       Parameters:    An integer n and a big number x.
  292.  
  293.       Return value:  None
  294.  
  295.       Restrictions:  None
  296.  
  297.       See also:      fconv, lconv, dconv
  298.  
  299.  
  300.  
  301.       Function:      void copy(x,y)                          copy     
  302.                      flash x,y;
  303.  
  304.       Module:        bncore.c
  305.  
  306.       Description:   Copies a big or flash number to another.
  307.  
  308.       Parameters:    Two big or flash numbers x and y. On exit y=x. Note
  309.                      that if x and y are the same variable, no operation is
  310.                      performed.
  311.  
  312.       Return value:  None
  313.  
  314.       Restrictions:  None
  315.  
  316.       See also:      -
  317.  
  318.  
  319.  
  320.  
  321.  
  322.  
  323.  
  324.  
  325.  
  326.  
  327.  
  328.  
  329.  
  330.  
  331.  
  332.  
  333.       Function:      int cotnum(x,f)                         cotnum     
  334.                      flash x;
  335.                      FILE *f;
  336.  
  337.       Module:        bnio2.c
  338.  
  339.       Description:   Output a big or flash number to the screen or to a file,
  340.                      using as number base the value currently assigned to the
  341.                      global variable IOBASE. A flash number will be converted
  342.                      to radix-point representation if the global variable
  343.                      POINT=ON. Otherwise it will be output as a fraction. If
  344.                      the global variable WRAP=ON, numbers too large to be
  345.                      represented on one line are 'wrapped around' onto the
  346.                      next line.
  347.  
  348.       Parameters:    A big/flash number x and a file descriptor f. If f is
  349.                      stdout then output will be to the screen, otherwise to
  350.                      the file opened with descriptor f.
  351.  
  352.       Return value:  Number of output characters.
  353.  
  354.       Restrictions:  None
  355.  
  356.       See also:      innum, cinnum, otnum.
  357.  
  358.       Example:       IOBASE=256
  359.                      cotnum(x,fp);
  360.  
  361.                      This outputs x (in pure binary) as a byte array, to the
  362.                      file associated with fp.
  363.  
  364.  
  365.  
  366.  
  367.  
  368.  
  369.  
  370.  
  371.  
  372.  
  373.  
  374.  
  375.  
  376.  
  377.  
  378.  
  379.  
  380.  
  381.  
  382.  
  383.  
  384.  
  385.  
  386.  
  387.  
  388.  
  389.  
  390.  
  391.  
  392.  
  393.  
  394.  
  395.  
  396.  
  397.  
  398.       Function:      void dconv(d,x)                          dconv     
  399.                      double d;
  400.                      flash x;
  401.  
  402.       Module:        bnflash.c
  403.  
  404.       Description:   Converts a double to flash format.
  405.  
  406.       Parameters:    A double d and a flash variable x. On exit x will
  407.                      contain the flash equivalent of d.
  408.  
  409.       Return value:  None
  410.  
  411.       Restrictions:  None
  412.  
  413.       See also:      fdsize, lconv, convert,fconv
  414.  
  415.  
  416.  
  417.       Function:      void decr(x,n,z)                          decr       
  418.                      big x,z;
  419.                      int n;
  420.  
  421.       Module:        bnarth0.c
  422.  
  423.       Description:   Decrement a big number by an integer amount.
  424.  
  425.       Parameters:    Big numbers x and z, and integer n. On exit z=x-n.
  426.  
  427.       Return value:  None
  428.  
  429.       Restrictions:  None
  430.  
  431.       See also:      add, subtract, incr.
  432.  
  433.       Example:       decr(x,2,x);  /* This decrements x by 2. */
  434.  
  435.  
  436.  
  437.       Function:      void denom(x,y)                          denom     
  438.                      flash x;
  439.                      big y;
  440.  
  441.       Module:        bncore.c
  442.  
  443.       Description:   Extract the denominator of a flash number into a big number
  444.  
  445.       Parameters:    A flash number x and a big number y. On exit y will contain
  446.                      the denominator of x.
  447.  
  448.       Return value:  None
  449.  
  450.       Restrictions:  None
  451.  
  452.       See also:      numer, fpack.
  453.  
  454.  
  455.  
  456.  
  457.  
  458.  
  459.  
  460.  
  461.  
  462.  
  463.  
  464.       Function:      void divide(x,y,z)                          divide       
  465.                      big x,y,z;
  466.  
  467.       Module:        bnarth2.c
  468.  
  469.       Description:   Divides one big number by another.
  470.  
  471.       Parameters:    Three big numbers x, y and z. On exit z=x/y; x=x mod y.
  472.                      The quotient only is returned if x and z are the same, the
  473.                      remainder only if y and z are the same.
  474.  
  475.       Return value:  None
  476.  
  477.       Restrictions:  Parameters x and y must be different, and y must be
  478.                      non-zero.
  479.  
  480.       See also:      multiply, mad
  481.  
  482.       Example:       divide(x,y,y);
  483.  
  484.                      This sets x equal to the remainder when x is divided by y.
  485.                      The quotient is not returned.
  486.  
  487.  
  488.  
  489.       Function:      void expb2(x,n)                          expb2     
  490.                      big x;
  491.                      int n;
  492.  
  493.       Module:        bnarth3.c
  494.  
  495.       Description:   Calculates 2 to the power of an integer.
  496.  
  497.       Parameters:    A big number x and an integer n. On exit x=2^n.
  498.  
  499.       Return value:  None
  500.  
  501.       Restrictions:  None
  502.  
  503.       See also:      logb2
  504.  
  505.       Example:       expb2(x,216091);
  506.                      decr(x,1,x);
  507.                      cotnum(x,stdout);
  508.  
  509.                      This calculates and prints out the largest known prime
  510.                      number (on a true 32-bit computer).
  511.  
  512.  
  513.  
  514.  
  515.  
  516.  
  517.  
  518.  
  519.  
  520.  
  521.  
  522.  
  523.  
  524.  
  525.  
  526.  
  527.  
  528.  
  529.  
  530.       Function:      int exsign(x)                         exsign   
  531.                      flash x;
  532.  
  533.       Module:        bncore.c
  534.  
  535.       Description:   Extracts the sign of a big/flash number.
  536.  
  537.       Parameters:    A big/flash number x.
  538.  
  539.       Return value:  The sign of x, i.e. -1 if x is negative, +1 if x is zero
  540.                      or positive.
  541.  
  542.       Restrictions:  None
  543.  
  544.       See also:      insign
  545.  
  546.  
  547.  
  548.       Function:      void facos(x,y)                          facos     
  549.                      flash x,y;
  550.  
  551.       Module:        bnflsh3.c
  552.  
  553.       Description:   Calculates arc-cosine of a flash number, using fasin.
  554.  
  555.       Parameters:    Two flash numbers x and y. On exit y=acos(x).
  556.  
  557.       Return value:  None
  558.  
  559.       Restrictions:  |x| must be less than or equal to 1.
  560.  
  561.       See also:      fatan, fasin
  562.  
  563.  
  564.  
  565.       Function:      void facosh(x,y)                          facosh     
  566.                      flash x,y;
  567.  
  568.       Module:        bnflsh4.c
  569.  
  570.       Description:   Calculates hyperbolic arc-cosine of a flash number.
  571.  
  572.       Parameters:    Two flash numbers x and y. On exit y=acosh(x).
  573.  
  574.       Return value:  None
  575.  
  576.       Restrictions:  |x| must be greater than or equal to 1.
  577.  
  578.       See also:      fatanh, fasinh
  579.  
  580.  
  581.  
  582.  
  583.  
  584.  
  585.  
  586.  
  587.  
  588.  
  589.  
  590.  
  591.  
  592.  
  593.  
  594.  
  595.  
  596.       Function:      void fadd(x,y,z)                          fadd       
  597.                      flash x,y,z;
  598.  
  599.       Module:        bnflash.c
  600.  
  601.       Description:   Add two flash numbers.
  602.  
  603.       Parameters:    Three flash numbers x, y and z. On exit z=x+y.
  604.  
  605.       Return value:  None
  606.  
  607.       Restrictions:  None
  608.  
  609.       See also:      fsub, fincr
  610.  
  611.  
  612.  
  613.       Function:      void fasin(x,y)                          fasin     
  614.                      flash x,y;
  615.  
  616.       Module:        bnflsh3.c
  617.  
  618.       Description:   Calculates arc-sin of a flash number, using fatan.
  619.  
  620.       Parameters:    Two flash numbers x and y. On exit y=asin(x).
  621.  
  622.       Return value:  None
  623.  
  624.       Restrictions:  |x| must be less than or equal to 1.
  625.  
  626.       See also:      facos, fatan
  627.  
  628.  
  629.  
  630.       Function:      void fasinh(x,y)                          fasinh     
  631.                      flash x,y;
  632.  
  633.       Module:        bnflsh4.c
  634.  
  635.       Description:   Calculates hyperbolic arc-sin of a flash number.
  636.  
  637.       Parameters:    Two flash numbers x and y. On exit y=asinh(x).
  638.  
  639.       Return value:  None
  640.  
  641.       Restrictions:  None
  642.  
  643.       See also:      facosh, fatanh
  644.  
  645.  
  646.  
  647.  
  648.  
  649.  
  650.  
  651.  
  652.  
  653.  
  654.  
  655.  
  656.  
  657.  
  658.  
  659.  
  660.  
  661.  
  662.       Function:      void fatan(x,y)                          fatan     
  663.                      flash x,y;
  664.  
  665.       Module:        bnflsh3.c
  666.  
  667.       Desciption:    Calculates the arc-tangent of a flash number, using
  668.                      O(n^2.5) method based on Newton's iteration.
  669.  
  670.       Parameters:    Two flash numbers x and y. On exit y=atan(x).
  671.  
  672.       Return value:  None
  673.  
  674.       Restrictions:  None
  675.  
  676.       See also:      fasin, facos
  677.  
  678.  
  679.       Function:      void fatanh(x,y)                          fatanh     
  680.                      flash x,y;
  681.  
  682.       Module:        bnflsh4.c
  683.  
  684.       Desciption:    Calculates the hyperbolic arc-tangent of a flash number.
  685.  
  686.       Parameters:    Two flash numbers x and y. On exit y=atanh(x).
  687.  
  688.       Return value:  None
  689.  
  690.       Restrictions:  x.x  must be less than 1
  691.  
  692.       See also:      fasinh, facosh
  693.  
  694.  
  695.  
  696.       Function:      int fcomp(x,y)                         fcomp     
  697.                      flash x,y;
  698.  
  699.       Module:        bnflash.c
  700.  
  701.       Description:   Compare two flash numbers.
  702.  
  703.       Parameters:    Two flash numbers x and y.
  704.  
  705.       Return value:  Returns -1 if y>x, +1 if x>y and 0 if x=y.
  706.  
  707.       Restrictions:  None
  708.  
  709.       See also:      compare
  710.  
  711.  
  712.  
  713.  
  714.  
  715.  
  716.  
  717.  
  718.  
  719.  
  720.  
  721.  
  722.  
  723.  
  724.  
  725.  
  726.  
  727.  
  728.       Function:      void fconv(n,d,x)                          fconv       
  729.                      int n,d;
  730.                      flash x;
  731.  
  732.       Module:        bnflash.c
  733.  
  734.       Description:   Convert a simple fraction to flash format.
  735.  
  736.       Parameters:    Integers n and d, and a flash number x. On exit x={n/d}
  737.  
  738.       Return value:  None
  739.  
  740.       Restrictions:  None
  741.  
  742.       See also:      convert, lconv, dconv
  743.  
  744.  
  745.  
  746.       Function:      void fcos(x,y)                          fcos     
  747.                      flash x,y;
  748.  
  749.       Module:        bnflsh3.c
  750.  
  751.       Description:   Calculates cosine of a given flash angle, using ftan.
  752.  
  753.       Parameters:    Two flash numbers x and y. On exit y=cos(x).
  754.  
  755.       Return value:  None
  756.  
  757.       Restrictions:  None
  758.  
  759.       See also:      fsin, ftan
  760.  
  761.  
  762.       Function:      void fcosh(x,y)                          fcosh     
  763.                      flash x,y;
  764.  
  765.       Module:        bnflsh4.c
  766.  
  767.       Description:   Calculates hyperbolic cosine of a given flash angle.
  768.  
  769.       Parameters:    Two flash numbers x and y. On exit y=cosh(x).
  770.  
  771.       Return value:  None
  772.  
  773.       Restrictions:  None
  774.  
  775.       See also:      fsinh, ftanh
  776.  
  777.  
  778.  
  779.  
  780.  
  781.  
  782.  
  783.  
  784.  
  785.  
  786.  
  787.  
  788.  
  789.  
  790.  
  791.  
  792.  
  793.  
  794.       Function:      void fdiv(x,y,z)                          fdiv       
  795.                      flash x,y,z;
  796.  
  797.       Module:        bnflash.c
  798.  
  799.       Description:   Divides two flash numbers.
  800.  
  801.       Parameters:    Three big numbers x,y and z. on exit z=x/y.
  802.  
  803.       Return value:  None
  804.  
  805.       Restrictions:  None
  806.  
  807.       See also:      fmul, fpmul
  808.  
  809.  
  810.  
  811.       Function:      double fdsize(x)                            fdsize   
  812.                      flash x;
  813.  
  814.       Module:        bndouble.c
  815.  
  816.       Description:   Converts a flash number to double format.
  817.  
  818.       Parameters:    A flash number x.
  819.  
  820.       Return value:  The value of the parameter x as a double.
  821.  
  822.       Restrictions:  The value of x must be less than BIGGEST. See mirdef.h
  823.  
  824.       See also:      dconv
  825.  
  826.  
  827.  
  828.       Function:      void fexp(x,y)                          fexp     
  829.                      flash x,y;
  830.  
  831.       Module:        bnflsh2.c
  832.  
  833.       Description:   Calculates the exponential of a flash number using
  834.                      O(n^2.5) method.
  835.  
  836.       Parameters:    Two flash numbers x and y. On exit y=exp(x).
  837.  
  838.       Return value:  None
  839.  
  840.       Restrictions:  None
  841.  
  842.       See also:      flog, fpowf
  843.  
  844.  
  845.  
  846.  
  847.  
  848.  
  849.  
  850.  
  851.  
  852.  
  853.  
  854.  
  855.  
  856.  
  857.  
  858.  
  859.  
  860.       Function:      void fincr(x,n,d,y)                          fincr         
  861.                      big x,y;
  862.                      int n,d;
  863.  
  864.       Module:        bnflash.c
  865.  
  866.       Description:   Add a simple fraction to a flash number.
  867.  
  868.       Parameters:    Two flash numbers x and y, and two integers n and d.
  869.                      On exit y=x+{n/d}.
  870.  
  871.       Return value:  None
  872.  
  873.       Restrictions:  None
  874.  
  875.       See also:      fadd, fsub
  876.  
  877.       Example:       fincr(x,-2,3,x);
  878.                      This subtracts two-thirds from the value of x.
  879.  
  880.  
  881.       Function:      void flog(x,y)                          flog     
  882.                      flash x,y;
  883.  
  884.       Module:        bnflsh2.c
  885.  
  886.       Description:   Calculates the natural log of a flash number using
  887.                      O(n^2.5) method.
  888.  
  889.       Parameters:    Two flash numbers x and y. On exit y=log(x).
  890.  
  891.       Return value:  None
  892.  
  893.       Restrictions:  None
  894.  
  895.       See also:      fexp, fpowf
  896.  
  897.  
  898.       Function:      void flop(x,y,op,z)                          flop          
  899.                      flash x,y,z;
  900.                      int *op;
  901.  
  902.       Module:        bnflash.c
  903.  
  904.       Description:   Perform primitive flash operation. Used internally.
  905.  
  906.       Parameters:    Three flash numbers x,y and z. On exit z=Fn(x,y),
  907.                      where the function performed depends on the
  908.                      parameter op. See source listing comments for more
  909.                      details.
  910.  
  911.       Restrictions:  None
  912.  
  913.       Return value:  None
  914.  
  915.       See also:      fadd, fsub, fmul, fdiv
  916.  
  917.  
  918.  
  919.  
  920.  
  921.  
  922.  
  923.  
  924.  
  925.  
  926.  
  927.       Function:      void fmul(x,y,z)                          fmul       
  928.                      flash x,y,z;
  929.  
  930.       Module:        bnflash.c
  931.  
  932.       Description:   Multiply two flash numbers.
  933.  
  934.       Parameters:    Three flash numbers x,y and z. On exit z=x*y.
  935.  
  936.       Return value:  None
  937.  
  938.       Restrictions:  None
  939.  
  940.       See also:      fpmul, fdiv
  941.  
  942.  
  943.       Function:      void fpack(n,d,x)                          fpack       
  944.                      flash x;
  945.                      big n,d;
  946.  
  947.       Module:        bncore.c
  948.  
  949.       Description:   Forms a flash number from big numerator and denominator.
  950.  
  951.       Parameters:    A flash number x and two big numbers n and d. On exit
  952.                      x={n/d}.
  953.  
  954.       Return value:  None
  955.  
  956.       Restrictions:  The denominator must be non-zero. Flash variable x and big
  957.                      variable d must be distinct. The resulting flash variable
  958.                      must not be too big for the representation.
  959.  
  960.       See also:      numer, denom.
  961.  
  962.  
  963.       Function:      void fpi(x)                          fpi   
  964.                      flash x;
  965.  
  966.       Module:        bnpi.c
  967.  
  968.       Description:   Calculates pi using Guass-Legendre O(n².log(n)) method.
  969.                      Note that on subsequent calls to this routine, pi is
  970.                      immediately available, as it is stored internally.
  971.  
  972.       Parameters:    A flash number x. On exit x=pi.
  973.  
  974.       Return value:  None
  975.  
  976.       Restrictions:  None.
  977.  
  978.       See also:      fsin, fcos, ftan
  979.  
  980.  
  981.  
  982.  
  983.  
  984.  
  985.  
  986.  
  987.  
  988.  
  989.  
  990.  
  991.  
  992.       Function:      void fpower(x,n,y)                          fpower       
  993.                      flash x,y;
  994.                      int n;
  995.  
  996.       Module:        bnflsh1.c
  997.  
  998.       Description:   Raises a flash number to an integer power.
  999.  
  1000.       Parameters:    Flash variables x and y, and an integer n. On exit
  1001.                      y=x^n.
  1002.  
  1003.       Return value:  None
  1004.  
  1005.       Restrictions:  None
  1006.  
  1007.       See also:      froot
  1008.  
  1009.  
  1010.       Function:      void fpmul(x,n,d,y)                          fpmul         
  1011.                      flash x,y;
  1012.                      int n,d;
  1013.  
  1014.       Module:        bnflash.c
  1015.  
  1016.       Description:   Multiplies a flash number by a simple fraction.
  1017.  
  1018.       Parameters:    Two flash numbers x and y, and two integers n and d.
  1019.                      On exit y=x.{n/d}
  1020.  
  1021.       Return value:  None
  1022.  
  1023.       Restrictions:  None
  1024.  
  1025.       See also:      fmul, fdiv
  1026.  
  1027.  
  1028.       Function:      void fpowf(x,y,z)                          fpowf       
  1029.                      flash x,y,z;
  1030.  
  1031.       Module:        bnflsh2.c
  1032.  
  1033.       Description:   Raises a flash number to a flash power.
  1034.  
  1035.       Parameters:    Three flash numbers x, y and z. On exit z=x^y
  1036.  
  1037.       Return value:  None
  1038.  
  1039.       Restrictions:  None
  1040.  
  1041.       See also:      fexp, flog
  1042.  
  1043.  
  1044.  
  1045.  
  1046.  
  1047.  
  1048.  
  1049.  
  1050.  
  1051.  
  1052.  
  1053.  
  1054.  
  1055.  
  1056.  
  1057.  
  1058.       Function:      void frand(x)                          frand   
  1059.                      flash x;
  1060.  
  1061.       Module:        bnrand.c
  1062.  
  1063.       Description:   Generates a random flash number.
  1064.  
  1065.       Parameters:    A big number x. On exit x contains a flash random number
  1066.                      in the range 0<x<1.
  1067.  
  1068.       Return value:  None
  1069.  
  1070.       Restrictions:  None
  1071.  
  1072.       See also:      bigrand, bigdig
  1073.  
  1074.  
  1075.       Function:      void frecip(x,y)                          frecip     
  1076.                      flash x,y;
  1077.  
  1078.       Module:        bnflash.c
  1079.  
  1080.       Description:   Calculates reciprocal of a flash number.
  1081.  
  1082.       Parameters:    Two flash numbers x and y. On exit y=1/x.
  1083.  
  1084.       Return value:  None
  1085.  
  1086.       Restrictions:  None
  1087.  
  1088.       See also:      fdiv, fmul
  1089.  
  1090.  
  1091.       Function:      bool froot(x,m,y)                          froot       
  1092.                      flash x,y;
  1093.                      int m;
  1094.  
  1095.       Module:        bnflsh1.c
  1096.  
  1097.       Description:   Calculates m-th root of a flash number using Newton's
  1098.                      O(n²) method.
  1099.  
  1100.       Parameters:    Flash numbers x and y, and an integer m. On exit y is
  1101.                      the m-th root of x.
  1102.  
  1103.       Return value:  TRUE for exact root, otherwise FALSE
  1104.  
  1105.       Restrictions:  None
  1106.  
  1107.       See also:      fpower
  1108.  
  1109.  
  1110.  
  1111.  
  1112.  
  1113.  
  1114.  
  1115.  
  1116.  
  1117.  
  1118.  
  1119.  
  1120.  
  1121.  
  1122.  
  1123.  
  1124.       Function:      void fsin(x,y)                          fsin     
  1125.                      flash x,y;
  1126.  
  1127.       Module:        bnflsh3.c
  1128.  
  1129.       Description:   Calculates sine of a given flash angle. Uses ftan.
  1130.  
  1131.       Parameters:    Two flash numbers x and y. On exit y=sin(x).
  1132.  
  1133.       Return value:  None
  1134.  
  1135.       Restrictions:  None
  1136.  
  1137.       See also:      fcos, ftan
  1138.  
  1139.  
  1140.       Function:      void fsinh(x,y)                          fsinh     
  1141.                      flash x,y;
  1142.  
  1143.       Module:        bnflsh4.c
  1144.  
  1145.       Description:   Calculates hyperbolic sine of a given flash angle.
  1146.  
  1147.       Parameters:    Two flash numbers x and y. On exit y=sinh(x).
  1148.  
  1149.       Return value:  None
  1150.  
  1151.       Restrictions:  None
  1152.  
  1153.       See also:      fcosh, ftanh
  1154.  
  1155.  
  1156.       Function:      void fsub(x,y,z)                          fsub       
  1157.                      flash x,y,z;
  1158.  
  1159.       Module:        bnflash.c
  1160.  
  1161.       Description:   Subtract two flash numbers.
  1162.  
  1163.       Parameters:    Three flash numbers x,y and z. On exit z=x-y.
  1164.  
  1165.       Return value:  None
  1166.  
  1167.       Restrictions:  None
  1168.  
  1169.       See also:      fadd, fincr
  1170.  
  1171.  
  1172.  
  1173.  
  1174.  
  1175.  
  1176.  
  1177.  
  1178.  
  1179.  
  1180.  
  1181.  
  1182.  
  1183.  
  1184.  
  1185.  
  1186.  
  1187.  
  1188.  
  1189.  
  1190.       Function:      void ftan(x,y)                          ftan     
  1191.                      flash x,y;
  1192.  
  1193.       Module:        bnflsh3.c
  1194.  
  1195.       Description:   Calculates the tan of a given flash angle, using an
  1196.                      O(n²√n) method.
  1197.  
  1198.       Parameters:    Two flash numbers x and y. On exit y=tan(x).
  1199.  
  1200.       Return value:  None
  1201.  
  1202.       Restrictions:  None
  1203.  
  1204.       See also:      fsin, fcos
  1205.  
  1206.  
  1207.       Function:      void ftanh(x,y)                          ftanh     
  1208.                      flash x,y;
  1209.  
  1210.       Module:        bnflsh4.c
  1211.  
  1212.       Description:   Calculates the hyperbolic tan of a given flash angle.
  1213.  
  1214.       Parameters:    Two flash numbers x and y. On exit y=tanh(x).
  1215.  
  1216.       Return value:  None
  1217.  
  1218.       Restrictions:  None
  1219.  
  1220.       See also:      fsinh, fcosh
  1221.  
  1222.  
  1223.       Function:      void ftrunc(x,y,z)                          ftrunc       
  1224.                      flash x,z;
  1225.                      big y;
  1226.  
  1227.       Module:        bnflash.c
  1228.  
  1229.       Description:   Seperates a flash number to a big number and a flash
  1230.                      remainder.
  1231.  
  1232.       Parameters:    Flash numbers x and z, and a big number y.
  1233.                      On exit y=int(x) and z = x-y (the fractional remainder).
  1234.                      if y is the same as z, only int(x) is returned.
  1235.  
  1236.       Return value:  None
  1237.  
  1238.       Restrictions:  None
  1239.  
  1240.  
  1241.  
  1242.  
  1243.  
  1244.  
  1245.  
  1246.  
  1247.  
  1248.  
  1249.  
  1250.  
  1251.  
  1252.  
  1253.  
  1254.  
  1255.  
  1256.       Function:      int gcd(x,y,z)                         gcd       
  1257.                      big x,y,z;
  1258.  
  1259.       Module:        bngcd.c
  1260.  
  1261.       Description:   Calculates the Greatest Common Divisor of two big numbers.
  1262.  
  1263.       Parameters:    Three big numbers x, y and z. On exit z=gcd(x,y)
  1264.  
  1265.       Return value:  GCD as integer, if possible, otherwise TOOBIG
  1266.  
  1267.       Restrictions:  None
  1268.  
  1269.       See also:      xgcd, round
  1270.  
  1271.  
  1272.       Function:      int getdig(x,i)                         getdig     
  1273.                      big x;
  1274.                      int i;
  1275.  
  1276.       Module:        bncore.c
  1277.  
  1278.       Description:   Extracts a digit from a big number.
  1279.  
  1280.       Parameters:    A big number x, and the required digit i.
  1281.  
  1282.       Return value:  The value of the requested digit.
  1283.  
  1284.       Restrictions:  Returns rubbish if required digit does not exist.
  1285.  
  1286.       See also:      putdig, numdig.
  1287.  
  1288.  
  1289.  
  1290.       Function:      int *gprime(n)                         *gprime   
  1291.                      int n;
  1292.  
  1293.       Module:        bnsmall.c
  1294.  
  1295.       Description:   Generates an array of all prime numbers up to a certain
  1296.                      limit, terminated by zero.
  1297.  
  1298.       Parameters:    A positive integer n indicating the maximum prime
  1299.                      number to be generated, or a negative integer
  1300.                      indicating that (-n) primes are to be generated.
  1301.  
  1302.       Return value:  A pointer to the prime number array.
  1303.  
  1304.       Restrictions:  None
  1305.  
  1306.       See also:      -
  1307.  
  1308.  
  1309.  
  1310.  
  1311.  
  1312.  
  1313.  
  1314.  
  1315.  
  1316.  
  1317.  
  1318.  
  1319.  
  1320.  
  1321.  
  1322.       Function:      int igcd(x,y)                         igcd     
  1323.                      int x,y;
  1324.  
  1325.       Module:        bncore.c
  1326.  
  1327.       Description:   Calculates the Greatest Common Divisor of two integers
  1328.                      using Euclids Method.
  1329.  
  1330.       Parameters:    Two integers x and y
  1331.  
  1332.       Return value:  The GCD of x and y
  1333.  
  1334.       See also:      gcd
  1335.  
  1336.  
  1337.  
  1338.       Function:      void incr(x,n,z)                          incr       
  1339.                      big x,z;
  1340.                      int n;
  1341.  
  1342.       Module:        bnarth0.c
  1343.  
  1344.       Description:   Increment a big variable.
  1345.  
  1346.       Parameters:    Big numbers x and z, and an integer n. On exit z=x+n.
  1347.  
  1348.       Return value:  None
  1349.  
  1350.       Restrictions:  None
  1351.  
  1352.       See also:      add, subtract, decr.
  1353.  
  1354.  
  1355.  
  1356.  
  1357.  
  1358.  
  1359.  
  1360.  
  1361.  
  1362.  
  1363.  
  1364.  
  1365.  
  1366.  
  1367.  
  1368.  
  1369.  
  1370.  
  1371.  
  1372.  
  1373.  
  1374.  
  1375.  
  1376.  
  1377.  
  1378.  
  1379.  
  1380.  
  1381.  
  1382.  
  1383.  
  1384.  
  1385.  
  1386.  
  1387.  
  1388.  
  1389.       Function:      int innum(x,f)                         innum     
  1390.                      flash x;
  1391.                      FILE *f;
  1392.  
  1393.       Module:        bnio1.c
  1394.  
  1395.       Description:   Inputs a big or flash number from a file, the keyboard
  1396.                      or a string. Flash numbers can be entered using either
  1397.                      a slash '/' to indicate numerator and denominator, or
  1398.                      with a radix point.
  1399.  
  1400.       Parameters:    A big/flash number x and a file descriptor f. For input
  1401.                      from the keyboard specify f as stdin, otherwise as the
  1402.                      descriptor of some other opened file. To input from a
  1403.                      string, copy the string to the global character array
  1404.                      IBUFF before calling innum. In this case the file
  1405.                      descriptor will be ignored, and input taken directly from
  1406.                      IBUFF.
  1407.  
  1408.       Return value:  The number of characters input.
  1409.  
  1410.       Restrictions:  The number base specified in mirsys must be less than
  1411.                      or equal to 256. If not use cinnum instead.
  1412.  
  1413.       See also:      otnum, cinnum, cotnum.
  1414.  
  1415.  
  1416.  
  1417.  
  1418.       Function:      void insign(s,x)                          insign     
  1419.                      int s;
  1420.                      flash x;
  1421.  
  1422.       Module:        bncore.c
  1423.  
  1424.       Description:   Forces a big/flash number to a particular sign.
  1425.  
  1426.       Parameters:    A big/flash number x, and the sign s that it is to take.
  1427.                      On exit x=s*abs(x).
  1428.  
  1429.       Return value:  None
  1430.  
  1431.       Restrictions:  None
  1432.  
  1433.       See also:      exsign.
  1434.  
  1435.       Example:       insign(PLUS,x);  /* force x to be positive */
  1436.  
  1437.  
  1438.  
  1439.  
  1440.  
  1441.  
  1442.  
  1443.  
  1444.  
  1445.  
  1446.  
  1447.  
  1448.  
  1449.  
  1450.  
  1451.  
  1452.  
  1453.  
  1454.       Function:      int inverse(x,y)                         inverse     
  1455.                      int x,y;
  1456.  
  1457.       Module:        bnsmall.c
  1458.  
  1459.       Description:   Calculates the inverse of an integer modulus a co-
  1460.                      prime integer
  1461.  
  1462.       Parameters:    An integer x and a co-prime integer y
  1463.  
  1464.       Return value:  1/x mod y
  1465.  
  1466.       Restrictions:  Return value is unpredictable if x and y are not co-
  1467.                      prime
  1468.  
  1469.       See also:      igcd, sqrmp
  1470.  
  1471.  
  1472.  
  1473.       Function:      void irand(seed)                          irand      
  1474.                      long seed;
  1475.  
  1476.       Module:        bncore.c
  1477.  
  1478.       Description:   Initializes random number system. Uses Knuth's subtractive
  1479.                      method. Long integer types are used internally to yield a
  1480.                      generator with maximum period.
  1481.  
  1482.       Parameters:    A long integer seed, which is used to start off the
  1483.                      random number generator.
  1484.  
  1485.       Return value:  None
  1486.  
  1487.       Restrictions:  None
  1488.  
  1489.       See also:      brand, bigrand, bigdig, frand.
  1490.  
  1491.  
  1492.       Function:      void lconv(ln,x)                          lconv      
  1493.                      long n;
  1494.                      big x;
  1495.  
  1496.       Module:        bncore.c
  1497.  
  1498.       Description:   Converts a long integer to big number format
  1499.  
  1500.       Parameters:    A long integer ln and a big number x
  1501.  
  1502.       Return value:  None
  1503.  
  1504.       Restrictions:  None
  1505.  
  1506.       See also:      convert, fconv, dconv
  1507.  
  1508.  
  1509.  
  1510.  
  1511.  
  1512.  
  1513.  
  1514.  
  1515.  
  1516.  
  1517.  
  1518.  
  1519.  
  1520.       Function:      int logb2(x)                         logb2   
  1521.                      big x;
  1522.  
  1523.       Module:        bnarth3.c
  1524.  
  1525.       Description:   Calculates the approximate integer log to the base 2 of
  1526.                      a big number (in fact the number of bits in it.)
  1527.  
  1528.       Parameters:    A big number x.
  1529.  
  1530.       Return value:  Number of bits in x
  1531.  
  1532.       Restrictions:  None
  1533.  
  1534.       See also:      expb2
  1535.  
  1536.  
  1537.  
  1538.       Function:      void mad(x,y,z,w,q,r)                          mad             
  1539.                      big x,y,z,w,q,r;
  1540.  
  1541.       Module:        bnarth2.c
  1542.  
  1543.       Description:   Multiply add and divide big numbers. The initial product
  1544.                      is stored in a double-length internal variable to avoid
  1545.                      the possibility of overflow at this stage.
  1546.  
  1547.       Parameters:    Six big numbers x,y,z,w,q and r. On exit q=(x*y+z)/w and
  1548.                      r contains the remainder. If w and q are not distinct
  1549.                      variables then only the remainder is returned; if q and r
  1550.                      are not distinct then only the quotient is returned. The
  1551.                      addition of z is not done if x and z (or y and z) are the
  1552.                      same.
  1553.  
  1554.       Return value:  None
  1555.  
  1556.       Restrictions:  Parameters w and r must be distinct. The value of w must
  1557.                      not be zero.
  1558.  
  1559.       See also:      multiply, divide.
  1560.  
  1561.       Example:       mad(x,x,x,w,x,x);
  1562.  
  1563.                      This sets x=(x*x)/w. The remainder is not returned.
  1564.  
  1565.  
  1566.  
  1567.  
  1568.  
  1569.  
  1570.  
  1571.  
  1572.  
  1573.  
  1574.  
  1575.  
  1576.  
  1577.  
  1578.  
  1579.  
  1580.  
  1581.  
  1582.  
  1583.  
  1584.  
  1585.  
  1586.       Function:      void mirsys(nd,nb)                          mirsys       
  1587.                      int nd,nb;
  1588.  
  1589.       Module:        bncore.c
  1590.  
  1591.       Description:   Initialize the MIRACL system as described below. Must
  1592.                      be called before attempting to use any other MIRACL
  1593.                      routines.
  1594.  
  1595.                      (1) The error tracing mechanism is initialised.
  1596.  
  1597.                      (2) the number of computer words to use for each
  1598.                          big/flash number is calculated from nd and nb.
  1599.  
  1600.                      (3) Sixteen big work variables (four of them double
  1601.                          length) are initialised.
  1602.  
  1603.                      (4) Certain global variables are given default initial
  1604.                          values.
  1605.  
  1606.                      (5) The random number generator is started by calling
  1607.                          irand(0L).
  1608.  
  1609.       Parameters:    The number of digits nd to use for each big/flash
  1610.                      variable and the number base nb. If nd is negative it
  1611.                      is taken as indicating the size of big/flash numbers
  1612.                      in 8-bit bytes.
  1613.  
  1614.       Return value:  None
  1615.  
  1616.       Restrictions:  The number base nb must be greater than 1 and less
  1617.                      than or equal to MAXBASE. The number of digits nd must
  1618.                      be less than a certain maximum, depending on the value
  1619.                      of BTS. (See mirdef.h).
  1620.  
  1621.       See also:      irand, mirvar.
  1622.  
  1623.  
  1624.       Example:       mirsys(500,10);
  1625.  
  1626.                      This initializes the MIRACL system to use 500 decimal
  1627.                      digits for each big or flash number.
  1628.  
  1629.  
  1630.  
  1631.  
  1632.  
  1633.  
  1634.  
  1635.  
  1636.  
  1637.  
  1638.  
  1639.  
  1640.  
  1641.  
  1642.  
  1643.  
  1644.  
  1645.  
  1646.  
  1647.  
  1648.  
  1649.  
  1650.  
  1651.  
  1652.       Function:      flash mirvar(iv)                           mirvar    
  1653.                      int iv;
  1654.  
  1655.       Module:        bncore.c
  1656.  
  1657.       Description:   Initialises a big/flash variable by reserving a suitable
  1658.                      number of memory locations for it.
  1659.  
  1660.       Parameters:    An integer initial value for the big/flash number.
  1661.  
  1662.       Return Value:  A pointer to the reserved locations.
  1663.  
  1664.       Restrictions:  None
  1665.  
  1666.       See also:      mirsys
  1667.  
  1668.       Example:       flash x;
  1669.                      x=mirvar(1);
  1670.  
  1671.                      Creates a flash variable x=1.
  1672.  
  1673.  
  1674.  
  1675.       Function:      void multiply(x,y,z)                          multiply       
  1676.                      big x,y,z;
  1677.  
  1678.       Module:        bnarth2.c
  1679.  
  1680.       Description:   Multiplies two big numbers
  1681.  
  1682.       Parameters:    Three big numbers x,y and z. On exit z=x.y
  1683.  
  1684.       Return value:  None
  1685.  
  1686.       Restrictions:  None
  1687.  
  1688.       See also:      divide, mad
  1689.  
  1690.  
  1691.  
  1692.       Function:      void negate(x,y)                          negate     
  1693.                      flash x,y;
  1694.  
  1695.       Module:        bncore.c
  1696.  
  1697.       Description:   Negates a big/flash number.
  1698.  
  1699.       Parameters:    Two big/flash numbers x and y. On exit y=-x.
  1700.  
  1701.       Return value:  None
  1702.  
  1703.       Restrictions:  None. Note that negate(x,x) is valid and sets x=-x.
  1704.  
  1705.       See also:      absol.
  1706.  
  1707.  
  1708.  
  1709.  
  1710.  
  1711.  
  1712.  
  1713.  
  1714.  
  1715.  
  1716.  
  1717.  
  1718.       Function:      int numdig(x)                         numdig   
  1719.                      big x;
  1720.  
  1721.       Module:        bncore.c
  1722.  
  1723.       Description:   Calculates the number of digits in a big number.
  1724.  
  1725.       Parameters:    A big number x.
  1726.  
  1727.       Return value:  The number of digits in x.
  1728.  
  1729.       Restrictions:  None
  1730.  
  1731.       See also:      getdig, putdig.
  1732.  
  1733.  
  1734.  
  1735.       Function:      void numer(x,y)                          numer     
  1736.                      flash x;
  1737.                      big y;
  1738.  
  1739.       Module:        bncore.c
  1740.  
  1741.       Description:   Extract the numerator of a flash number.
  1742.  
  1743.       Parameters:    A flash number x and a big number y. On exit y will contain
  1744.                      the numerator of x.
  1745.  
  1746.       Return value:  None
  1747.  
  1748.       Restrictions:  None
  1749.  
  1750.       See also:      denom, fpack.
  1751.  
  1752.  
  1753.       Function:      void nxprime(w,x)                          nxprime     
  1754.                      big w,x;
  1755.  
  1756.       Module:        bnprime.c
  1757.  
  1758.       Description:   Find next prime number.
  1759.  
  1760.       Parameters:    Two big numbers w and x. On exit x contains the next prime
  1761.                      number greater than w.
  1762.  
  1763.       Return value:  None
  1764.  
  1765.       Restrictions:  None
  1766.  
  1767.       See also:      prime
  1768.  
  1769.  
  1770.  
  1771.  
  1772.  
  1773.  
  1774.  
  1775.  
  1776.  
  1777.  
  1778.  
  1779.  
  1780.  
  1781.  
  1782.  
  1783.  
  1784.       Function:      int otnum(x,f)                         otnum     
  1785.                      flash x;
  1786.                      FILE *f;
  1787.  
  1788.       Module:        bnio1.c
  1789.  
  1790.       Description:   Output a big or flash number to the screen or to a file.
  1791.                      If STROUT=TRUE output is redirected to the global string
  1792.                      OBUFF[]. A flash number will be converted to radix-point
  1793.                      representation if the global variable POINT=ON. Otherwise
  1794.                      it will be output as a fraction. If the global variable
  1795.                      WRAP=ON numbers too large to be represented on one line
  1796.                      are 'wrapped around' onto the next line.
  1797.  
  1798.       Parameters:    A big/flash number x and a file descriptor f. If f is
  1799.                      stdout then output will be to the screen, otherwise to
  1800.                      the file opened with descriptor f.
  1801.  
  1802.       Return value:  Number of output characters.
  1803.  
  1804.       Restrictions:  The number base specified in mirsys must be less than or
  1805.                      equal to 256. If not, use cotnum instead.
  1806.  
  1807.       See also:      innum, cinnum, cotnum.
  1808.  
  1809.  
  1810.  
  1811.       Function:      void power(x,n,z,w)                          power         
  1812.                      int n;
  1813.                      big x,z,w;
  1814.  
  1815.       Module:        bnarth3.c
  1816.  
  1817.       Description:   Raise a big number to an integer power.
  1818.  
  1819.       Parameters:    Two big numbers x and z, and an integer n. On exit w=x^n
  1820.                      If w and z are distinct, then w=x^n mod z
  1821.  
  1822.       Return value:  None.
  1823.  
  1824.       Restrictions:  The value of n must be positive
  1825.  
  1826.       See also:      powmod, root
  1827.  
  1828.  
  1829.  
  1830.  
  1831.  
  1832.  
  1833.  
  1834.  
  1835.  
  1836.  
  1837.  
  1838.  
  1839.  
  1840.  
  1841.  
  1842.  
  1843.  
  1844.  
  1845.  
  1846.  
  1847.  
  1848.  
  1849.  
  1850.       Function:      void powmod(x,y,z,w)                          powmod         
  1851.                      big x,y,z,w;
  1852.  
  1853.       Module:        bnarth3.c
  1854.  
  1855.       Description:   Raise a big number to a big power modulus another big
  1856.                      number.
  1857.  
  1858.       Parameters:    Four big numbers x,y,z and w. On exit w=x^y mod z.
  1859.  
  1860.       Return value:  None
  1861.  
  1862.       Restrictions:  The value of y must be positive. The parameters w and z
  1863.                      must be distinct.
  1864.  
  1865.       See also:      power, root
  1866.  
  1867.  
  1868.  
  1869.       Function:      void premult(x,n,z)                          premult       
  1870.                      int n;
  1871.                      big x,z;
  1872.  
  1873.       Module:        bnarth1.c
  1874.  
  1875.       Description:   Multiplies a big number by an integer
  1876.  
  1877.       Parameters:    Two big numbers x and z, and an integer n. On exit z=n.x
  1878.  
  1879.       Return value:  None
  1880.  
  1881.       Restrictions:  None
  1882.  
  1883.       See also:      subdiv
  1884.  
  1885.  
  1886.       Function:      bool prime(x)                          prime   
  1887.                      big x;
  1888.  
  1889.       Module:        bnprime.c
  1890.  
  1891.       Description:   Tests whether or not a big number is prime using a
  1892.                      probabilistic primality test. The number is assumed
  1893.                      to be prime if it passes this test NTRY times, where
  1894.                      NTRY is a global variable with a default initialisation
  1895.                      in routine mirsys.
  1896.  
  1897.       Parameters:    A big number x.
  1898.  
  1899.       Return value:  Returns the boolean value TRUE if x is (almost certainly)
  1900.                      prime, otherwise FALSE.
  1901.  
  1902.       Restrictions:  None
  1903.  
  1904.       See also:      nxprime, strongp
  1905.  
  1906.  
  1907.  
  1908.  
  1909.  
  1910.  
  1911.  
  1912.  
  1913.  
  1914.  
  1915.  
  1916.       Function:      void putdig(n,x,i)                          putdig       
  1917.                      big x;
  1918.                      int i,n;
  1919.  
  1920.       Module:        bncore.c
  1921.  
  1922.       Description:   Set a digit of a big number to a given value
  1923.  
  1924.       Parameters:    A big number x, a digit number i, and its new value n.
  1925.  
  1926.       Return value:  None
  1927.  
  1928.       Restrictions:  The digit indicated must exist.
  1929.  
  1930.       See also:      getdig, numdig.
  1931.  
  1932.  
  1933.       Function:      bool root(x,n,z)                          root       
  1934.                      big x,z;
  1935.                      int n;
  1936.  
  1937.       Module:        bnarth3.c
  1938.  
  1939.       Description:   Extracts lower approximation to a root of a big number.
  1940.  
  1941.       Parameters:    Two big numbers x and z, and an integer n. On exit
  1942.                      z=x^(1/n).
  1943.  
  1944.       Return value:  Returns the boolean value TRUE if the root found is exact,
  1945.                      otherwise returns FALSE.
  1946.  
  1947.       Restrictions:  The value of n must be positive. If x is negative, then n
  1948.                      must be odd.
  1949.  
  1950.       See also:      power, powmod
  1951.  
  1952.  
  1953.  
  1954.       Function:      void round(n,d,x)                          round       
  1955.                      flash x;
  1956.                      big n,d;
  1957.  
  1958.       Module:        bnround.c
  1959.  
  1960.       Description:   Forms a rounded flash number from big numerator and
  1961.                      denominator. If rounding takes place the global variable
  1962.                      EXACT is set to FALSE. EXACT is initialised to TRUE in
  1963.                      routine mirsys. This routine is used internally by most
  1964.                      of the other flash arithmetic routines.
  1965.  
  1966.       Parameters:    A flash number x and two big numbers n and d. On exit
  1967.                      x=R{n/d}, that is the flash number {n/d} rounded if
  1968.                      necessary to fit the representation.
  1969.  
  1970.       Return value:  None
  1971.  
  1972.       Restrictions:  The denominator must be non-zero.
  1973.  
  1974.       See also:      gcd, xgcd, fpack.
  1975.  
  1976.  
  1977.  
  1978.  
  1979.  
  1980.  
  1981.  
  1982.       Function:      int size(x)                         size   
  1983.                      big x;
  1984.  
  1985.       Module:        bncore.c
  1986.  
  1987.       Description:   Tries to convert big number to simple integer format.
  1988.  
  1989.       Parameters:    A big number x.
  1990.  
  1991.       Return value:  The value of x as an integer. If this is not possible
  1992.                      (because x is too big) it returns the value plus or minus
  1993.                      TOOBIG.
  1994.  
  1995.       Restrictions:  None
  1996.  
  1997.       See also:      -
  1998.  
  1999.  
  2000.       Function:      int smul(x,y,z)                         smul       
  2001.                      int x,y,z;
  2002.  
  2003.       Module:        bnsmall.c
  2004.  
  2005.       Description:   Multiplies two integers mod a third
  2006.  
  2007.       Parameters:    Integers x, y and z
  2008.  
  2009.       Return value:  (x.y) mod z
  2010.  
  2011.       Restrictions:  None
  2012.  
  2013.       See also:      spmd
  2014.  
  2015.  
  2016.       Function:      int spmd(x,y,z)                         spmd       
  2017.                      int x,y,z;
  2018.  
  2019.       Module:        bnsmall.c
  2020.  
  2021.       Description:   Raises an integer to an integer power modulus a third
  2022.  
  2023.       Parameters:    Integers x, y, and z
  2024.  
  2025.       Return value:  x^y mod z
  2026.  
  2027.       Restrictions:  None
  2028.  
  2029.       See also:      smul
  2030.  
  2031.  
  2032.  
  2033.  
  2034.  
  2035.  
  2036.  
  2037.  
  2038.  
  2039.  
  2040.  
  2041.  
  2042.  
  2043.  
  2044.  
  2045.  
  2046.  
  2047.  
  2048.       Function:      int sqrmp(x,y)                         sqrmp     
  2049.                      int x,y;
  2050.  
  2051.       Module:        bnsmall.c
  2052.  
  2053.       Description:   Calculates the square root of an integer mod an integer
  2054.                      prime number
  2055.  
  2056.       Parameters:    An integer x and a prime number y
  2057.  
  2058.       Return value:  x^(1/2) mod y, or 0 if root does not exist
  2059.  
  2060.       Restrictions:  Return value unpredictable if y is not prime
  2061.  
  2062.       See also:      inverse
  2063.  
  2064.  
  2065.       Function:      void strongp(p,n)                          strongp     
  2066.                      big p;
  2067.                      int n;
  2068.  
  2069.       Module:        bnprime.c
  2070.  
  2071.       Description:   Generate a 'strong' prime number. Useful for Public Key
  2072.                      Cryptography programs.
  2073.  
  2074.       Parameters:    A big number p and an integer n. On exit p will contain
  2075.                      a 'strong' prime number at least n decimal digits long.
  2076.  
  2077.       Return value:  None
  2078.  
  2079.       Restrictions:  None. The prime p may be rather more than n digits long.
  2080.  
  2081.       See also:      prime, nxprime
  2082.  
  2083.  
  2084.  
  2085.       Function:      int subdiv(x,n,z)                         subdiv       
  2086.                      int n;
  2087.                      big x,z;
  2088.  
  2089.       Module:        bnarth1.c
  2090.  
  2091.       Description:   Divide a big number by an integer.
  2092.  
  2093.       Parameters:    Two big numbers x and z, and an integer n. On exit z=x/n.
  2094.  
  2095.       Return value:  The integer remainder.
  2096.  
  2097.       Restrictions:  The value of n must not be zero.
  2098.  
  2099.       See also:      premult
  2100.  
  2101.  
  2102.  
  2103.  
  2104.  
  2105.  
  2106.  
  2107.  
  2108.  
  2109.  
  2110.  
  2111.  
  2112.  
  2113.  
  2114.       Function:      void subtract(x,y,z)                          subtract       
  2115.                      big x,y,z;
  2116.  
  2117.       Module:        bnarth0.c
  2118.  
  2119.       Description:   Subtracts two big numbers.
  2120.  
  2121.       Parameters:    Three big numbers x, y and z. On exit z=x-y.
  2122.  
  2123.       Return value:  None
  2124.  
  2125.       Restrictions:  None
  2126.  
  2127.       See Also:      add, incr, decr.
  2128.  
  2129.  
  2130.  
  2131.       Function:      int xgcd(x,y,xd,yd,z)                         xgcd             
  2132.                      big x,y,xd,yd,z;
  2133.  
  2134.       Module:        bnxgcd.c
  2135.  
  2136.       Description:   Calculates extended Greatest Common Divisor of two big
  2137.                      numbers. Can also be used to calculate modular inverses.
  2138.                      Note that this routine is about 8 times slower than a
  2139.                      'mad' operation on numbers of similar size.
  2140.  
  2141.       Parameters:    Five big numbers x,y,xd,yd and z.
  2142.                      On exit z=gcd(x,y)=x.xd+y.yd
  2143.  
  2144.       Return value:  GCD as integer, if possible, otherwise TOOBIG
  2145.  
  2146.       Restrictions:  If xd and yd are not distinct, only xd is returned. The
  2147.                      GCD is only returned if z distinct from both xd and yd.
  2148.  
  2149.       See also:      gcd, round
  2150.  
  2151.       Example:       xgcd(x,p,x,x,x);  /* x = 1/x mod p  (p is prime) */
  2152.  
  2153.  
  2154.  
  2155.       Function:      void zero(x)                          zero   
  2156.                      flash x;
  2157.  
  2158.       Module:        bncore.c
  2159.  
  2160.       Description:   Sets a big or flash number to zero
  2161.  
  2162.       Parameters:    A big or flash number x.
  2163.  
  2164.       Return value:  None
  2165.  
  2166.       Restrictions:  None
  2167.  
  2168.       See also:      -
  2169.  
  2170.  
  2171.  
  2172.  
  2173.  
  2174.  
  2175.  
  2176.  
  2177.  
  2178.  
  2179.  
  2180.                       Appendix IV  - Example programs
  2181.  
  2182.  
  2183.       Note:  The programs described here are of an experimental nature, and
  2184.       in  many  cases  are  not  completely  'finished  off'.  For  further
  2185.       information read the comments associated with the appropriate  source
  2186.       file.
  2187.  
  2188.       Program:          hail.c                        hail.c
  2189.  
  2190.       This  program  allows you to investigate so-called hailstone numbers,
  2191.       as  described  by  Fred  Gruenberger   in   'Computer   Recreations',
  2192.       Scientific American,  April 1984.  The procedure is simple.  Starting
  2193.       with any number apply the following rules:
  2194.  
  2195.       (a) If it is odd, multiply it by 3 and add 1.
  2196.  
  2197.       (b) If it is even, divide it by 2.
  2198.  
  2199.       (c) Repeat the process,  until the number becomes equal to 1, in which
  2200.           case stop.
  2201.  
  2202.       It would appear that for  any  initial  number  this  process  always
  2203.       eventually terminates, although it has not been proved that this must
  2204.       happen,  or  that  the process can not get stuck in an infinite loop.
  2205.       What goes up,  it seems,  must come down.  Try  the  program  for  an
  2206.       initial value of 27. Then try it using much bigger numbers.
  2207.  
  2208.  
  2209.  
  2210.       Program:          palin.c                        palin.c
  2211.  
  2212.       This  programs  allows you to investigate palindromic reversals.  See
  2213.       'Computer Recreations'  by  Fred  Gruenberger,  Scientific  American,
  2214.       April 1984.  A palindromic number is one which reads the same in both
  2215.       directions.  Start with any number and apply the following rules.
  2216.  
  2217.       (a)  Add  the number to the number obtained by reversing the order of
  2218.           the digits. Make this the new number.
  2219.  
  2220.       (b) Stop the process when the new number is palindromic.
  2221.  
  2222.  
  2223.       It appears  that  for  most  initial  numbers  this  process  quickly
  2224.       terminates.  Try it for 89. Then try it for 196.
  2225.  
  2226.  
  2227.       Program:          brute.c                        brute.c
  2228.  
  2229.       This  program attempts to factorise a number by brute force division,
  2230.       using a table of small prime numbers. When  attempting a difficult
  2231.       factorisation it makes sense to try this approach first.
  2232.       Use  this  program to factorise 12345678901234567890.  Then try it on
  2233.       bigger random numbers.
  2234.  
  2235.  
  2236.  
  2237.  
  2238.  
  2239.  
  2240.  
  2241.  
  2242.  
  2243.  
  2244.  
  2245.  
  2246.       Program:          brent.c                        brent.c
  2247.  
  2248.       This program attempts to factorise a number using  the  Brent-Pollard
  2249.       method.  This  method  is  faster  at finding larger factors than the
  2250.       simple-minded brute  force  approach.  However  it  will  not  always
  2251.       succeed,  even  for  very simple factorisations.  Use it to factorise
  2252.       R17, that is 11111111111111111 (seventeen ones). Then try it on larger
  2253.       numbers that would not yield to the brute force approach.
  2254.  
  2255.  
  2256.       Program:          pollard.c                        pollard.c
  2257.  
  2258.       Another factoring program, which implements Pollard's (p-1) method,
  2259.       specialises in quickly finding a factor p of  a number  N  for  which
  2260.       (p-1) has itself only small factors. Phase 1 of this method will work
  2261.       if all these small factors are less  than  LIMIT1. If  Phase 1  fails
  2262.       then Phase 2 searches for just one  final  larger factor less  than
  2263.       LIMIT2. The constants LIMIT1 and LIMIT2 are set inside the program.
  2264.  
  2265.  
  2266.       Program:          williams.c                        williams.c
  2267.  
  2268.       This program is similar to Pollards method, but can find a factor p
  2269.       of N for which (p+1) has only small factors. Again two phases are
  2270.       used. In fact this method is sometimes a (p+1) method, and sometimes
  2271.       a (p-1) method, so several attempts are made to find the (p+1)
  2272.       condition. The algorithm is rather more complex than that used in
  2273.       Pollards method, and is somewhat slower.
  2274.  
  2275.  
  2276.       Program:          lenstra.c                        lenstra.c
  2277.  
  2278.       Recently Lenstra has discovered a new method of factorisation,
  2279.       generically similar to the Pollard and Williams methods, but
  2280.       potentially much more powerful. It works by randomly generating an
  2281.       Elliptic Curve, which can then be used to find a factor p of N, for
  2282.       which p+1-d has only small factors, where d depends on the particular
  2283.       curve chosen. If one curve fails then another can be tried, an option
  2284.       not possible with the Pollard/Williams methods. Again this is a two
  2285.       phase method, and although it has very good asymptotic behaviour, it
  2286.       is much slower than the pollard/williams for each iteration.
  2287.  
  2288.  
  2289.  
  2290.  
  2291.  
  2292.  
  2293.  
  2294.  
  2295.  
  2296.  
  2297.  
  2298.  
  2299.  
  2300.  
  2301.  
  2302.  
  2303.  
  2304.  
  2305.  
  2306.  
  2307.  
  2308.  
  2309.  
  2310.  
  2311.  
  2312.       Program:          qsieve.c                        qsieve.c
  2313.  
  2314.       This is a  very  sophisticated Pomerance-Silverman-Montgomery
  2315.       factoring  program.  Its  speciality  is factoring all numbers (up to
  2316.       about sixty digits long), irrespective of the size of the factors. If
  2317.       the number to be factored is N,  then the program actually works with
  2318.       a  number  k.N,  where  k is a small Knuth-Schroepel multiplier.  The
  2319.       program itself works out the best value of k to use. Internally,  the
  2320.       program uses a 'factor base' of small primes. The larger the number,
  2321.       the bigger will be  this  factor  base.  The  program  works  by
  2322.       accumulating information from a number of simpler factorisations. As
  2323.       it progresses with these it prints out 'working...n'.  When it thinks
  2324.       it has enough information it prints out 'trying',  but these tries
  2325.       may be premature and  may  not  succeed.  The program will always
  2326.       terminate before the number n in 'working...n' reaches the size of
  2327.       the factor base.
  2328.  
  2329.  
  2330.       This program uses much more memory than  any  of  the  other  example
  2331.       programs,  particularly when factoring bigger numbers.  The amount of
  2332.       memory that the program can take is limited by the values defined for
  2333.       MEM and MLF  at  the  beginning  of  the  program.  These  should  be
  2334.       increased  if possible,  or reduced if your computer has insufficient
  2335.       memory.
  2336.  
  2337.       Use qsieve to factor 10000000000000000000000000000000009 (thirty-
  2338.       five digits).
  2339.  
  2340.  
  2341.       Program:          mersenne.c                        mersenne.c
  2342.  
  2343.       This program generates all prime  numbers  of  the  form  2^n-1.  The
  2344.       largest  known  primes  have  always been of this form because of the
  2345.       efficiency of this Lucas-Lehmer test.
  2346.  
  2347.  
  2348.  
  2349.  
  2350.  
  2351.  
  2352.  
  2353.  
  2354.  
  2355.  
  2356.  
  2357.  
  2358.  
  2359.  
  2360.  
  2361.  
  2362.  
  2363.  
  2364.  
  2365.  
  2366.  
  2367.  
  2368.  
  2369.  
  2370.  
  2371.  
  2372.  
  2373.  
  2374.  
  2375.  
  2376.  
  2377.  
  2378.       Program:          rsakey.c                        rsakey.c
  2379.  
  2380.       Public  Key  Cryptography  is  a two key encipherment system with the
  2381.       very desirable feature that the encoding key  can  be  made  publicly
  2382.       available, without weakening the strength of the cipher. This program
  2383.       generates  the  'public'  encoding key and 'private' decoding key for
  2384.       the original Rivest-Shamir-Adleman PKS system.  These keys can take a
  2385.       long  time  to  generate,  as  they  are formed from very large prime
  2386.       numbers, which must be generated carefully for maximum security.
  2387.  
  2388.  
  2389.       The program prompts for 'Minimum size of keys in decimal digits'. The
  2390.       security of the system depends on the  difficulty  of  factoring  the
  2391.       encoding  'public'  key,  which is formed from two large primes.  The
  2392.       largest numbers which  can  be  routinely  factored  using  the  most
  2393.       powerful computers are 100 digits long (1988). So a minimum size of
  2394.       120 gives adequate security (for now!)
  2395.  
  2396.       After  this  program  has  run,  the  two  keys  are created in files
  2397.       PUBLIC.KEY and PRIVATE.KEY.
  2398.  
  2399.  
  2400.  
  2401.  
  2402.  
  2403.  
  2404.  
  2405.  
  2406.  
  2407.  
  2408.  
  2409.  
  2410.  
  2411.  
  2412.  
  2413.  
  2414.  
  2415.  
  2416.  
  2417.  
  2418.  
  2419.  
  2420.  
  2421.  
  2422.  
  2423.  
  2424.  
  2425.  
  2426.  
  2427.  
  2428.  
  2429.  
  2430.  
  2431.  
  2432.  
  2433.  
  2434.  
  2435.  
  2436.  
  2437.  
  2438.  
  2439.  
  2440.  
  2441.  
  2442.  
  2443.  
  2444.       Program:          encode.c                        encode.c
  2445.  
  2446.       Messages or files may be encoded with this program,  which  uses  the
  2447.       'public'  encoding  key  from  the file PUBLIC.KEY,  generated by the
  2448.       program 'rsakey',  which must have  been  run  prior  to  using  this
  2449.       program.  When run the user is  prompted  for  a  file  to  encipher.
  2450.       Either  give  the  name  of  a text file,  or press return to enter a
  2451.       message directly from the keyboard.  In the former case  the  encoded
  2452.       output  is sent to a file with the same name,  but with the extension
  2453.        .RSA.  In the latter case you are prompted for an  output  filename,
  2454.       which  must  be  given.  Text  entered  from  the  keyboard  must  be
  2455.       terminated by a CONTROL Z (end-of-file).  Type out the  encoded  file
  2456.       and be impressed by how indecipherable it looks
  2457.  
  2458.       Program:          decode.c                        decode.c
  2459.  
  2460.       Messages or files encoded using the RSA system may be  decoded  using
  2461.       this  program,  which  uses  the 'private' decoding key from the file
  2462.       PRIVATE.KEY generated by the program 'rsakey' which  must  have  been
  2463.       run at some stage prior to using this program.
  2464.  
  2465.       When  run,  the  user  is  prompted  for  the  name of the file to be
  2466.       decoded.  Type in the filename (without an extension  -  the  program
  2467.       will  assume  the extension .RSA) and press return.  Then the user is
  2468.       asked for an output filename.  Either  supply  a  filename  or  press
  2469.       return, in which case the decoded output will be sent straight to the
  2470.       screen.  A problem with the RSA system becomes immediately apparent -
  2471.       decoding takes a very long time! This is particularly true for larger
  2472.       key sizes and long messages.
  2473.  
  2474.  
  2475.  
  2476.  
  2477.  
  2478.  
  2479.  
  2480.  
  2481.  
  2482.  
  2483.  
  2484.  
  2485.  
  2486.  
  2487.  
  2488.  
  2489.  
  2490.  
  2491.  
  2492.  
  2493.  
  2494.  
  2495.  
  2496.  
  2497.  
  2498.  
  2499.  
  2500.  
  2501.  
  2502.  
  2503.  
  2504.  
  2505.  
  2506.  
  2507.  
  2508.  
  2509.  
  2510.       Program:          okakey.c                        okakey.c
  2511.  
  2512.       This  program  generates 'public' and 'private' keys for use with the
  2513.       Okamoto PKS system.  As with the RSA system the  keys  are  generated
  2514.       from  large  prime numbers carefully selected for certain properties,
  2515.       so this program takes a long time to run.  A key  length  of  150  is
  2516.       adequate.  The  two  keys  are  generated  into  files PUBLIC.KEY and
  2517.       PRIVATE.KEY.
  2518.  
  2519.  
  2520.       Program:          enciph.c                        enciph.c
  2521.  
  2522.       This program works in an identical fashion to the  program  'encode',
  2523.       although  in  this case the encoded file produced will be 1.35 times
  2524.       bigger than the original.
  2525.  
  2526.  
  2527.       Program:          deciph.c                        deciph.c
  2528.  
  2529.       This program works in an identical fashion to the  program  'decode'.
  2530.       However it has the advantage that it runs much more quickly.
  2531.  
  2532.       Note : The original version of this program was 'cracked' by the
  2533.       redoubtable Shamir. Okamoto (Electronics letters 30th July 1987, Vol.
  2534.       23 No. 16 pp814-815) responded with a modified algorithm which
  2535.       appears to be resistant to Shamirs method of attack. This improved
  2536.       version has now been implemented. Over to you Shamir...
  2537.  
  2538.  
  2539.       Program:          pi.c                        pi.c
  2540.  
  2541.       This  program  calculates  pi  using  a  Guass-Legendre  O(n².log(n))
  2542.       method.  (Is there a more efficient way to calculate pi for  moderate
  2543.       n?)  The  greater  the  precision  specified  in  the call to routine
  2544.       'mirsys', the more decimal place there will be in the answer (and the
  2545.       longer it will take).
  2546.  
  2547.  
  2548.       Program:          roots.c                        roots.c
  2549.  
  2550.       This program calculates the n-th  root  of  an  input  number,  using
  2551.       Newtons method. Try it to calculate the square root of two. Again the
  2552.       accuracy  obtained  depends  on  the  size  of  the  flash variables,
  2553.       specified in routine 'mirsys'.  The tendency of flash  arithmetic  to
  2554.       prefer  simple  numbers  can be illustrated by requesting,  say,  the
  2555.       square root of 7.  The program calculates this value and then squares
  2556.       it,  to give 7 again exactly.  On your  pocket  calculator  the  same
  2557.       result  will only be obtained if clever use is made of extra (hidden)
  2558.       guard digits.
  2559.  
  2560.  
  2561.       Program:          hilbert.c                        hilbert.c
  2562.  
  2563.       Traditionally the inversion of 'Hilbert' matrices is  regarded  as  a
  2564.       tough test for any system of arithmetic. This programs solves the set
  2565.       of linear equations H.x = b, where H is a Hilbert matrix and b is the
  2566.       vector  [1,1,1,1,....1],  using  the  classical  Guassian Elimination
  2567.       method.
  2568.  
  2569.  
  2570.  
  2571.  
  2572.  
  2573.  
  2574.  
  2575.  
  2576.       Program:          sample.c                        sample.c
  2577.  
  2578.       This program is the same as that used by Brent (1978) to  demonstrate
  2579.       some  of  the  capabilities  of his Fortran Multiprecision arithmetic
  2580.       package. It calculates pi, exp(pi*sqrt(163/9)) and exp(pi*sqrt(163)).
  2581.  
  2582.  
  2583.       Program:          ratcalc.c                        ratcalc.c
  2584.  
  2585.       As a comprehensive and useful demonstration of flash arithmetic  this
  2586.       program simulates a standard full-function scientific calculator. Its
  2587.       unique feature (besides its 36-digit accuracy) is its ability to work
  2588.       directly with fractions, and to handle mixed  calculations  involving
  2589.       both fractions and decimals. By using  this  program  the  user  will
  2590.       quickly  get  a feel for flash arithmetic and its capabilities.  Note
  2591.       that this program contains some non-portable  code  (screen  handling
  2592.       routines) that must be tailored to each individual  computer/terminal
  2593.       combination.
  2594.  
  2595.  
  2596.  
  2597.  
  2598.  
  2599.  
  2600.  
  2601.  
  2602.  
  2603.  
  2604.  
  2605.  
  2606.  
  2607.  
  2608.  
  2609.  
  2610.  
  2611.  
  2612.  
  2613.  
  2614.  
  2615.  
  2616.  
  2617.  
  2618.  
  2619.  
  2620.  
  2621.  
  2622.  
  2623.  
  2624.  
  2625.  
  2626.  
  2627.  
  2628.  
  2629.  
  2630.  
  2631.  
  2632.  
  2633.  
  2634.  
  2635.  
  2636.  
  2637.  
  2638.  
  2639.  
  2640.  
  2641.