The OpenNET Project / Index page

[ новости /+++ | форум | теги | ]

Интерактивная система просмотра системных руководств (man-ов)

 ТемаНаборКатегория 
 
 [Cписок руководств | Печать]

libmp (3)
  • libmp (3) ( Solaris man: Библиотечные вызовы )
  • >> libmp (3) ( FreeBSD man: Библиотечные вызовы )

  • BSD mandoc
     

    NAME

    
    
    libmp
    
     - traditional BSD multiple precision integer arithmetic library
    
     
    

    SYNOPSIS

       #include <mp.h>

    Function prototypes are given in the main body of the text.

    Applications using this interface must be linked with -l mp (this library) and -l crypto (crypto(3) )  

    DESCRIPTION

    Bf -symbolic This interface is obsolete in favor of the crypto(3) Vt BIGNUM library. Ef

    is the traditional BSD multiple precision integer arithmetic library. It has a number of problems, and is unsuitable for use in any programs where reliability is a concern. It is provided here for compatibility only.

    These routines perform arithmetic on integers of arbitrary precision stored using the defined type Vt MINT . Pointers to Vt MINT are initialized using itom ();
    or xtom (,);
    and must be recycled with mfree ();
    when they are no longer needed. Routines which store a result in one of their arguments expect that the latter has also been initialized prior to being passed to it. The following routines are defined and implemented:

    MINT * Ns itom (short n ;);

    MINT * Ns xtom (const char *s ;);

    char * Ns mtox (const MINT *mp ;);

    void mfree (MINT *mp ;);

    itom ();
    returns an Vt MINT with the value of Fa n . xtom ();
    returns an Vt MINT with the value of Fa s , which is treated to be in hexadecimal. The return values from itom ();
    and xtom ();
    must be released with mfree ();
    when they are no longer needed. mtox ();
    returns a null-terminated hexadecimal string having the value of Fa mp ; its return value must be released with free ();
    (free(3) ) when it is no longer needed.

    void madd (const MINT *mp1 const MINT *mp2 MINT *rmp ;);

    void msub (const MINT *mp1 const MINT *mp2 MINT *rmp ;);

    void mult (const MINT *mp1 const MINT *mp2 MINT *rmp ;);

    madd (,);
    msub (,);
    and mult ();
    store the sum, difference, or product, respectively, of Fa mp1 and Fa mp2 in Fa rmp .

    void mdiv (const MINT *nmp const MINT *dmp MINT *qmp MINT *rmp ;);

    void sdiv (const MINT *nmp short d MINT *qmp short *ro ;);

    mdiv ();
    computes the quotient and remainder of Fa nmp and Fa dmp and stores the result in Fa qmp and Fa rmp , respectively. sdiv ();
    is similar to mdiv ();
    except the divisor Fa ( dmp or Fa d ) and remainder Fa ( rmp or Fa ro ) are ordinary integers.

    void pow (const MINT *bmp const MINT *emp const MINT *mmp MINT *rmp ;);

    void rpow (const MINT *bmp short e MINT *rmp ;);

    rpow ();
    computes the result of Fa bmp raised to the Fa emp Ns th power and reduced modulo Fa mmp ; the result is stored in Fa rmp . pow ();
    computes the result of Fa bmp raised to the Fa e Ns th power and stores the result in Fa rmp .

    void min (MINT *mp ;);

    void mout (const MINT *mp ;);

    min ();
    reads a line from standard input, tries to interpret it as a decimal number, and if successful, stores the result in Fa mp . mout ();
    prints the value, in decimal, of Fa mp to standard output (without a trailing newline).

    void gcd (const MINT *mp1 const MINT *mp2 MINT *rmp ;);

    gcd ();
    computes the greatest common divisor of Fa mp1 and Fa mp2 and stores the result in Fa rmp .

    int mcmp (const MINT *mp1 const MINT *mp2 ;);

    Fa mcmp compares the values of Fa mp1 and Fa mp2 and returns 0 if the two values are equal, a value greater than 0 if Fa mp1 is greater than Fa mp2 , and a value less than 0 if Fa mp2 is greater than Fa mp1 .

    void move (const MINT *smp MINT *tmp ;);

    move ();
    copies the value of Fa smp to Fa tmp (both values must be initialized).

    void msqrt (const MINT *nmp MINT *xmp MINT *rmp ;);

    msqrt ();
    computes the square root and remainder of Fa nmp and stores them in Fa xmp and Fa rmp , respectively.
     

    IMPLEMENTATION NOTES

    This version of is implemented in terms of the crypto(3) Vt BIGNUM library.  

    DIAGNOSTICS

    Running out of memory or illegal operations result in error messages on standard error and a call to abort(3).  

    SEE ALSO

    abort(3), bn(3), crypto(3), free(3), malloc(3), math(3)  

    HISTORY

    A library appeared in BSD 4.3 Fx 2.2 shipped with a implemented in terms of libgmp This implementation appeared in Fx 5.0 .  

    BUGS

    The pow ();
    routine exists in both libmp and libm with incompatible semantics.

    Errors are reported via output to standard error and abnormal program termination instead of via return values. The application cannot control this behavior.

    It is not clear whether the string returned by mtox ();
    may be written to by the caller. This implementation allows it, but others may not. Ideally, mtox ();
    would take a pointer to a buffer to fill in.

    It is not clear whether using the same variable as both source and destination in a single invocation is permitted. Some of the calls in this implementation allow this, while others do not.


     

    Index

    NAME
    SYNOPSIS
    DESCRIPTION
    IMPLEMENTATION NOTES
    DIAGNOSTICS
    SEE ALSO
    HISTORY
    BUGS


    Поиск по тексту MAN-ов: 




    Партнёры:
    PostgresPro
    Inferno Solutions
    Hosting by Hoster.ru
    Хостинг:

    Закладки на сайте
    Проследить за страницей
    Created 1996-2024 by Maxim Chirkov
    Добавить, Поддержать, Вебмастеру