eGospodarka.pl
eGospodarka.pl poleca

  • Path: news-archive.icm.edu.pl!agh.edu.pl!news.agh.edu.pl!news.cyf-kr.edu.pl!news.nask
    .pl!news.nask.org.pl!newsfeed.pionier.net.pl!news.dialog.net.pl!not-for-mail
    From: Adam Majewski <a...@o...pl>
    Newsgroups: pl.comp.programming
    Subject: gsl
    Date: Wed, 24 Jul 2013 22:04:56 +0200
    Organization: Dialog Net
    Lines: 56
    Message-ID: <kspc14$60h$1@news.dialog.net.pl>
    NNTP-Posting-Host: dynamic-78-8-72-88.ssp.dialog.net.pl
    Mime-Version: 1.0
    Content-Type: text/plain; charset=UTF-8; format=flowed
    Content-Transfer-Encoding: 8bit
    X-Trace: news.dialog.net.pl 1374696292 6161 78.8.72.88 (24 Jul 2013 20:04:52 GMT)
    X-Complaints-To: a...@d...net.pl
    NNTP-Posting-Date: Wed, 24 Jul 2013 20:04:52 +0000 (UTC)
    User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:16.0) Gecko/20121011
    Thunderbird/16.0.1
    Xref: news-archive.icm.edu.pl pl.comp.programming:204197
    [ ukryj 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: