| www.delorie.com/archives/browse.cgi | search |
| From: | "Tim Nicholson" <T DOT J DOT Nicholson AT btinternet DOT com> |
| Newsgroups: | comp.os.msdos.djgpp |
| Subject: | Re: exp() doesn't work ! |
| Date: | Tue, 22 May 2001 19:51:16 +0100 |
| Organization: | Skyforce avionics Limited |
| Lines: | 29 |
| Message-ID: | <9eeci7$10v$1@plutonium.btinternet.com> |
| References: | <F6E7432DD437D511AD92009027C3AAC466B52F AT headoffice DOT umgeni DOT co DOT za> <3B0A660A DOT 7D064520 AT ma DOT tum DOT de> |
| NNTP-Posting-Host: | host213-122-243-212.btinternet.com |
| X-Priority: | 3 |
| X-MSMail-Priority: | Normal |
| X-Newsreader: | Microsoft Outlook Express 5.00.2919.6600 |
| X-MimeOLE: | Produced By Microsoft MimeOLE V5.00.2919.6600 |
| To: | djgpp AT delorie DOT com |
| DJ-Gateway: | from newsgroup comp.os.msdos.djgpp |
| Reply-To: | djgpp AT delorie DOT com |
Good trick
Your code does not even take the exponent of s, What you got was just the
un-initialised value of s!!!
> #include <stdio.h>
> #include <stdlib.h>
> #include <math.h>
>
> int main() file://int argc, char **argv)
> {
> double s;
>
> printf("%40.20g\n",s);
> exit(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
"Waldemar Schultz" <schultz AT ma DOT tum DOT de> wrote in message
news:3B0A660A DOT 7D064520 AT ma DOT tum DOT de...
| webmaster | delorie software privacy |
| Copyright © 2019 by DJ Delorie | Updated Jul 2019 |