Mail Archives: djgpp/2001/05/22/11:00:05
Waldemar Schultz schrieb:
>
> Scott Sinclair schrieb:
> >
> > Hi
> >
> > I hope I'm just being stupid :) but the following code:
> >
> > //////////////////////////////
> > double x, y;
> >
> > y = some_sensibly_small_number;
> >
> > x = exp(y);
> > /////////////////////////////
> >
> > does NOT set x equal to e^y ???? I am using the libraries suplied with DJGPP
> > version 2.03.
> > Unfortunately I can't follow the assembler code in the exp.s source file (is
> > this assembler ?), so I can't fix the error and rebuild my libraries.
> > Help ????:)
> >
> > cheers
> >
> > Scott
>
> #include <stdio.h>
> #include <stdlib.h>
> #include <math.h>
>
> int main() //int argc, char **argv)
> {
> double s;
>
s=exp(3e-15);
^^^^^^^^^^^^^
oops sorry, I was too eager cleaning the snippet
> printf("%40.20g\n",s);
> return EXIT_SUCCESS;
> }
>
> prints 1.0000000000000031086
>
> what did you expect ? e^0.0 == 1.0 !
>
> --
> Gruss Waldemar Schultz. schultz AT ma DOT tum DOT de
> Technische Universität München, Zentrum Mathematik M1, D 80290 München
> Tel: +49 (0)89 2892 8226 FAX: +49 (0)89 2892 8228
sorry for inconvenience.
--
Gruss Waldemar Schultz. schultz AT ma DOT tum DOT de
Technische Universität München, Zentrum Mathematik M1, D 80290 München
Tel: +49 (0)89 2892 8226 FAX: +49 (0)89 2892 8228
- Raw text -