man(1) Manual page archive

     MPC(1)                                                     MPC(1)

          mpc - extended precision arithmetic code generator

          mpc [ file ... ]

          Mpc generates C functions from a simple language that oper-
          ates on extended precision integers using the mp(2) library.

          The language consists of a series of function definitions of
          the form:

               name ( parameter list ) { statements }

          All variables and parameters are extended precision integers
          and are passed by reference. Statements are separated by
          semicolon and the following statemens are defined:

               name = expression

               if ( condition ) { statements } else if ( condition ) {
               statements } else { statements }

               while ( condition ) { statements }


               name ( parameter list )

               mod ( modulus ) { statements }

          There is no distinction between input and output parameters,
          but conventionally, the outputs are put at the end of the
          parameter list and the language allows one to write

               F ( X, Y, Z ) as Y, Z = F ( X )

          Expressions are composed out of the following arithmetic

               +              addition.
               -              subtraction.
               *              multiplication.
               /              division, or multiplicative inverse when
                              enclosed in mod block.
               %              division remainder.
               ^              exponentiation.
               >>constant     right shift by a constant.

     MPC(1)                                                     MPC(1)

               <<constant     left shift by a constant.
               condition?a:b  pick a when condition is true, otherwise
                              b when false.

          Conditions can use the following operations:

               ==             equality.
               !=             inequality.
               >              bigger than.
               <              smaller than.
               !condition     negation.