www.delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp/1996/08/12/06:45:17

Xref: news2.mv.net comp.os.msdos.djgpp:7104
From: Thomas Demmer <demmer AT LSTM DOT Ruhr-UNI-Bochum DOT De>
Newsgroups: comp.os.msdos.djgpp
Subject: Re: problem with libm.a "pow" function (and comment on ran())
Date: Mon, 12 Aug 1996 09:26:05 +0100
Organization: Lehrstuhl fuer Stroemungsmechanik
Lines: 56
Message-ID: <320EEA9D.794B@LSTM.Ruhr-UNI-Bochum.De>
References: <320E4A9F DOT 6E8 AT pobox DOT oleane DOT com>
NNTP-Posting-Host: bvb.lstm.ruhr-uni-bochum.de
Mime-Version: 1.0
To: djgpp AT delorie DOT com
DJ-Gateway: from newsgroup comp.os.msdos.djgpp

Francois Charton wrote:
> 
> I posted something last week on FPU exceptions compiling povray 3.0 with
> -lm.
> I tried since to isolate the bug (if it is one)
> Here is a small program :
> 
> MYPROG.C
> #include <math.h>
> 
> void main(void)
> {
> int i;
> for(i=1;i<1000000;i++) pow(i/1000000.0,90.0);
> }
> 
> /* EOF */
> 
> When I compile it with  :
> gcc -o myprog myprog.c
> (I link the libc.a pow function), everything works great
> 
> but if I say
> gcc -o myprog myprog.c -lm
> I get (at i==257) a Floating Point exception error
> 
> This is pretty strange as my program only calculate power 90 of values
> strictly between 0 and 1, so the result HAVE to be betweeen 0 and 1, and
> there can be no overflow.
Are you sure this is _numeric_ over/underflow?
libm had a problem with Coprocessor stack underflow that caused
unexpected crashes.
Try the libm from

ftp://ftp.lstm.ruhr-uni-bochum.de/pub/djgpp

I just tried you program and it runs fine. Without -O and -O2.

Sorry, but I haven't seen your posting last week (Or it did not ring
a bell).

-- 
Ciao
Tom

*************************************************************
* Thomas Demmer                                             *
* Lehrstuhl fuer Stroemungsmechanik                         *
* Ruhr-Uni-Bochum                                           *
* Universitaetsstr. 150                                     *
* D-44780  Bochum                                           *
* Tel: +49 234 700 6434                                     *
* Fax: +49 234 709 4162                                     *
* Voice/Fax Box: +49 2561 91371 2056                        *
* http://www.lstm.ruhr-uni-bochum.de/~demmer                *
*************************************************************

- Raw text -


  webmaster     delorie software   privacy  
  Copyright © 2019   by DJ Delorie     Updated Jul 2019