delorie.com/archives/browse.cgi | search |
From: | "Alexei A. Frounze" <dummy_addressee AT hotmail DOT com> |
Newsgroups: | comp.os.msdos.djgpp |
Subject: | Re: exp() doesn't work ! |
Date: | Tue, 22 May 2001 14:37:53 -0400 |
Organization: | Global Crossing Telecommunications |
Lines: | 28 |
Message-ID: | <9eebip$1kqm$1@node21.cwnet.roc.gblx.net> |
References: | <F6E7432DD437D511AD92009027C3AAC466B52F AT headoffice DOT umgeni DOT co DOT za> <3B0A660A DOT 7D064520 AT ma DOT tum DOT de> <3B0A7EBF DOT 677B5E6B AT ma DOT tum DOT de> |
NNTP-Posting-Host: | 209-130-131-128.nas2.roc.gblx.net |
X-Trace: | node21.cwnet.roc.gblx.net 990556570 54102 209.130.131.128 (22 May 2001 18:36:10 GMT) |
X-Complaints-To: | abuse AT gblx DOT net |
NNTP-Posting-Date: | Tue, 22 May 2001 18:36:10 +0000 (UTC) |
X-Priority: | 3 |
X-MSMail-Priority: | Normal |
X-Newsreader: | Microsoft Outlook Express 5.50.4133.2400 |
X-MimeOLE: | Produced By Microsoft MimeOLE V5.50.4133.2400 |
To: | djgpp AT delorie DOT com |
DJ-Gateway: | from newsgroup comp.os.msdos.djgpp |
Reply-To: | djgpp AT delorie DOT com |
#include <stdio.h> #include <stdlib.h> #include <math.h> int main() //int argc, char **argv) { double s; s = exp (1e-15); printf("%40.20g\n",s); exit(EXIT_SUCCESS); } gives approx 1 + 1e-15 as expected from the expansion: e^x = 1 + x + x^/2 + x^3/6 + ... everything is correct, just make sure that those small numbers can still be represented by double type and their contribution in your formulas counts, is not lost because of their small value. Good Luck -- Alexei A. Frounze alexfru [AT] chat [DOT] ru http://alexfru.chat.ru http://members.xoom.com/alexfru/ http://welcome.to/pmode/
webmaster | delorie software privacy |
Copyright © 2019 by DJ Delorie | Updated Jul 2019 |