eGospodarka.pl
eGospodarka.pl poleca

  • Data: 2013-07-24 22:04:56
    Temat: gsl
    Od: Adam Majewski <a...@o...pl> szukaj wiadomości tego autora
    [ pokaż wszystkie nagłówki ]

    Witam,


    Napisałem drobny program w c z użyciem gsl, oblicz silnię(100).
    Wynik wydaje się dobry ale ten błąd obliczeń ? Jak to interpretować ?
    #include <stdio.h>
    #include <gsl/gsl_errno.h>
    #include <gsl/gsl_sf.h>


    // gcc -I/usr/include/gsl/ -L/usr/local/lib/ -lgsl -lgslcblas -lm f.c
    // gcc -I/usr/include/gsl/ -L/usr/lib/ -lgsl -lgslcblas -lm f.c
    // factorial
    //
    http://www.gnu.org/software/gsl/manual/html_node/Spe
    cial-Function-Usage.html#Special-Function-Usage
    // The error-handling function
    //
    http://www.gnu.org/software/gsl/manual/html_node/Spe
    cial-Functions-Examples.html#Special-Functions-Examp
    les
    /*




    */

    int main(void)
    {
    unsigned int n = 100;
    int status;
    gsl_sf_result result;

    status = gsl_sf_fact_e (n, &result);


    printf("status = %s\n", gsl_strerror(status));
    printf("factorial( %2d ) = %f\n", n,result.val);
    printf("+/- % .18f\n",result.err);

    return 0;
    }


    ./a.out
    status = success
    factorial( 100 ) =
    9332621544394415096564670479595388257840097037318409
    8831012889540582227238570431295066113089288327277825
    8496640065242705545359762897193828521818658959597240
    32.000000
    +/-
    4144516527479786869998377376409676501474209436767641
    6602380879768122591161803228174716423865792481641279
    576393802186138583881092629521428905984.000000000000
    000000



    TIA

    Adam


Podziel się

Poleć ten post znajomemu poleć

Wydrukuj ten post drukuj


Następne wpisy z tego wątku

Najnowsze wątki z tej grupy


Najnowsze wątki

Szukaj w grupach

Eksperci egospodarka.pl

1 1 1

Wpisz nazwę miasta, dla którego chcesz znaleźć jednostkę ZUS.

Wzory dokumentów

Bezpłatne wzory dokumentów i formularzy.
Wyszukaj i pobierz za darmo: