README.md

    Math Processor Unit Library (libmpu)

    libmpu is a library of arithmetic functions for integer, real, and complex numbers of increased digit capacity.

    Limitations:

    Arithmetic functions up to 65536 bits.

    Trigonometric functions up to 16384 bits.

    How to Build:

    Clone the repository:

     git clone https://git.radix-linux.su/libs/libmpu.git libmpu
    

    Bootstrap sources:

     cd libmpu
    
     ./bootstrap
    
     cd ../
    

    Build the MPU library:

     mkdir build
    
     cd build
    
     ../libmpu/configure \
       --prefix=/usr \
       --libdir=/usr/lib64 \
       --enable-static=no
    
     make
     make install
    
     cd ../
    

    Usage:

    Create directory:

     mkdir -p tests/atan2
    
     cd tests/atan2
    

    Create Makefile:

     CC = gcc
    
     CFLAGS  = `mpu-config cflags`
     LDFLAGS = `mpu-config --ldflags`
     LIBS    = `mpu-config --libs` -lpthread
    
     SOURCES = main.c
     OBJECTS = main.o
    
     all: main
    
     .SUFFIXES:
     .SUFFIXES: .o .c
     %.o : %.c
             $(CC) $(CFLAGS) -c -o $@ $<
    
     main: $(OBJECTS)
             $(CC) $(LDFLAGS) -o main $(OBJECTS) $(LIBS)
    
     clean:
             rm -f main *.o
    

    Create simple source code (main.c):

     #include <libmpu.h>
     #include <stdio.h>
    
     int main( void )
     {
       int  rc = 0;
    
       __mpu_init();
       __mpu_extra_warnings = 1;
    
       {
         mpu_real16384_t r, d;
         int             nb = NB_R16384;
         __mpu_char8_t   s[6000]; /* size can be obtained by _real_max_string( NB_R16384 ) function */
    
         ascii_to_real( r, "1.0", nb ); /* evaluate the R variable */
         ascii_to_real( d, "1.0", nb ); /* evaluate the D variable */
    
         r_atan2( r, r, d, nb );     /* arc tangent function of R / D and place result to the R variable */
         real_to_ascii( s, r, _real_mant_digs(nb), 'E', 0, 0, nb ); /* convert R value to ASCII string S */
         printf( "s = %s\n\nrc = %d;\n", s, rc );
       }
    
       __mpu_free_context();
    
       return( rc );
     }
    

    Build the main binary:

     make
    

    Run the main program:

     ./main
     s = 7.853981633974483096156608458198757210492923498437764552437361480769541015715522496570087063355292669955370216283205766617734611523876455579313398520321202793625710256754846302763899111557372387325954911072027439164833615321189120584466957913178004772864121417308650871526135816620533484018150622853184311467516515788970437203802302407073135229288410919731475900028326326372051166303460367379853779023582643175914398979882730465293454831529482762796370186155949906873918379714381812228069845457529872824584183406101641607715053487365988061842976755449652359256926348042940732941880961687046169173512830001420317863158902069464428356894474022934092946803671102253062383575366373963427626980699223147308855049890280322554902160086045399534074436928274901296768028374999995932445124877649329332040240796487561148638367270756606305770633361712588154827970427525007844596882216468833020953551542944172868258995633726071888671827898907159705884468984379894454644451330428067016532504819691527989773041050497345238143002663714658197164840383454569920575754880088254632422489434056498534728124304438208697828788937143106135376739877073832792154319639722687745954386593662348298137651002319254177847524622060032145904008909269150261775454857388990497366919593623620638449436817117760118836615520116710647673728233284192572472880261880405142415060145095375483778133456075088969100618741183159785498181510674806991955886954090023354304103049811465787575715457436389266874596263736471467317489227318026993773257388302913362468006889900591201663747799704586994383915924518566356319656379546043936682227444431984500204117650040363122980433043036930875353604933921370403402893381380333689354623671096308309768485358336369406042156297458923713905248048055460681375635642219179476236504133667012471568081979465214460959569919941703635252384709465902376700160562813012793482462240210321221567364010604913212555526652965766860696555097987362617809284467402390910929793218669411643934906034727164581614989533476195068975248664410197378173670995881489274564556551306223519316798695671206503692477256600340986093638262670508740631129373499128578574522976648127343054241153789274645968526494714899432438747325404384821170345671709672356935389979639813114884898577624931311702114968184111739621634591840556565247811520128109710976128110341374406951994289228589994250324040223604237171389621015883555180564571221620396140071265042106848630668669197238130346306374886666819559966141490290887215576443641245088984086420435810281287690173698627741490235063072199277232864172842168071872351400253758271544821702302186902294562346472524287274189963153413874454732824462054207497371806647012143910035676193887830949103628809365585911357146111988164669552627853386839348807783567915255339923840578607381212342967775364413508975699836009355018276446347655495968619521196224208303614284671879858766075546132977621202513426536701687298195477994849880153549158571886101609362809295480449995977539798904536687856728099372352267966235579903919863020237866375563079009704825355234405344639891597344467707597674480193366805456406499153753553757670096119336373006513536664813003743607126831296665005331085220476776215829336624128634764490671402513770266646992495408936840960131428647757242660350277428015701097599398789192894251050844674840018076396907940898554682812867801332320479565465314668303947996037122072911176523938176739305229391779180727745422728820043376678187145805717958802338491431280270894787842470522861052516877583667775785316777842477164629099578754925412877921292859414404587889127212274974649955968363820829088769119796339733065463724080332332724642660511688147677288703541374648654092950677454985774811222393928207226480808315243249280211083933163723455977983149365916826459010357034707580095622593974631093604257283191404523443361007676867302800478255082595049405275275112323303790210611214909417459738071711957808881645532862394214315608360473259921606560852693306744507018297288602752611705813179050263163068027915099166393273136777639463440866705163277474131729655141192328142646589155046395251823401649691215294776133372125865284144216883123604170099066449469296390211382413531663521326535861079646692437864153517001750594694147836004281873676051405576347486403285177817501019636833174847703636661614701993177066707658582146964245763089522332664393516988642909438135505287389403953500625315571485325541178877448148077476991368440313794141878393794574166136947936252824903722576159986783240526835109379739339903647254847428277947607445714118758007996728785071770214976200273530368053294869119431556035637136350830392963265355720343962607658304379574496655592930397901929173136871847466637373625286635157108415984475099423164180365963266840241428022951909581791604068722200196731400725571180260079302965205104750105741542799094480334393778739875391512407965736816368410631E-1
    
     rc = 0;
    

    Enjoy.

    Описание

    libmpu - Math Processor Unit Library (mirror).

    Конвейеры
    0 успешных
    0 с ошибкой