* how to compile with "-fsoft-float"
@ 1999-09-01 4:00 siemel naran
1999-09-02 4:00 ` Alex Rhomberg
0 siblings, 1 reply; 6+ messages in thread
From: siemel naran @ 1999-09-01 4:00 UTC (permalink / raw)
I'd like to turn floating point exceptions off.
For example, +1.0/zero() should give +infinity.
I tried
g++ --pedantic -msoft-float float.cc
but there are some link time errors
// float.cc
#include <iostream.h>
inline double zero() { return 0.0; }
int main()
{
cout << 1.0/zero() << '\n';
}
/tmp/ccSgCt3F.o: In function `main':
float.cc(.text+0x38): undefined reference to `__divdf3'
float.cc(.text+0x3c): undefined reference to `__divdf3'
collect2: ld returned 1 exit status
--
------------
siemel naran
------------
^ permalink raw reply [flat|nested] 6+ messages in thread* Re: how to compile with "-fsoft-float" 1999-09-01 4:00 how to compile with "-fsoft-float" siemel naran @ 1999-09-02 4:00 ` Alex Rhomberg 1999-09-02 4:00 ` siemel naran 1999-09-02 4:00 ` siemel naran 0 siblings, 2 replies; 6+ messages in thread From: Alex Rhomberg @ 1999-09-02 4:00 UTC (permalink / raw) To: sbnaran siemel naran wrote: > > I'd like to turn floating point exceptions off. > For example, +1.0/zero() should give +infinity. > > I tried > g++ --pedantic -msoft-float float.cc > but there are some link time errors Use the -miee flag: forrest:~% g++ -mieee float.cc forrest:~% ./a.out inf -- _________________________________________________________________ / \ | Alex Rhomberg Tel: +41 1 632 49 18 | | Institut fuer Elektronik Fax: +41 1 632 12 10 | | ETH Zuerich Zentrale: +41 1 632 11 11 | | Gloriastrasse 35 | | 8092 Zuerich email: rhomberg@ife.ee.ethz.ch | \_________________________________________________________________/ ^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: how to compile with "-fsoft-float" 1999-09-02 4:00 ` Alex Rhomberg @ 1999-09-02 4:00 ` siemel naran 1999-09-02 4:00 ` siemel naran 1 sibling, 0 replies; 6+ messages in thread From: siemel naran @ 1999-09-02 4:00 UTC (permalink / raw) On Thu, 02 Sep 1999 09:23:53 +0200, Alex Rhomberg >siemel naran wrote: >> I'd like to turn floating point exceptions off. >> For example, +1.0/zero() should give +infinity. >Use the -miee flag: Thanks, I tried this, and it works. Can you please tell me what this flag means? Does it mean to turn ieee math on? IOW, does ieee specify that there be no floating point exceptions -- eg, 1.0/zero() is infinity, -1.0/zero() is -infinity, 1.0*nan() is nan, nan()==nan() is false, small()*small() is zero? Also, why is this flag not documented in the gcc man page? Are there any other flags that might be of relevance to me? Thanks. -- ------------ siemel naran ------------ ^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: how to compile with "-fsoft-float" 1999-09-02 4:00 ` Alex Rhomberg 1999-09-02 4:00 ` siemel naran @ 1999-09-02 4:00 ` siemel naran 1999-09-08 4:00 ` Emile van bergen 1 sibling, 1 reply; 6+ messages in thread From: siemel naran @ 1999-09-02 4:00 UTC (permalink / raw) On Thu, 02 Sep 1999 09:23:53 +0200, Alex Rhomberg >siemel naran wrote: >> I'd like to turn floating point exceptions off. >> For example, +1.0/zero() should give +infinity. >Use the -miee flag: Thanks, I tried this, and it works. Can you please tell me what this flag means? Does it mean to turn ieee math on? IOW, does ieee specify that there be no floating point exceptions -- eg, 1.0/zero() is infinity, -1.0/zero() is -infinity, 1.0*nan() is nan, nan()==nan() is false, small()*small() is zero? Also, why is this flag not documented in the gcc man page? Are there any other flags that might be of relevance to me? Thanks. -- ------------ siemel naran ------------ ^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: how to compile with "-fsoft-float" 1999-09-02 4:00 ` siemel naran @ 1999-09-08 4:00 ` Emile van bergen 1999-09-09 4:00 ` Jeff Sturm 0 siblings, 1 reply; 6+ messages in thread From: Emile van bergen @ 1999-09-08 4:00 UTC (permalink / raw) On 2 Sep 1999, siemel naran wrote: > On Thu, 02 Sep 1999 09:23:53 +0200, Alex Rhomberg > >siemel naran wrote: > > >> I'd like to turn floating point exceptions off. > >> For example, +1.0/zero() should give +infinity. > > >Use the -miee flag: > > Thanks, I tried this, and it works. > > Can you please tell me what this flag means? Does it mean to turn ieee > math on? IOW, does ieee specify that there be no floating point > exceptions -- eg, 1.0/zero() is infinity, -1.0/zero() is -infinity, > 1.0*nan() is nan, nan()==nan() is false, small()*small() is zero? > > Also, why is this flag not documented in the gcc man page? Are there > any other flags that might be of relevance to me? It's not exactly a flag. -mfoo tells the linker to link against libfoo.a (statically) / libfoo.so (dynamically). So you probably have a working libieee somewhere on your system, that contained the missing functions from your previous post. How its prog. interface works, I don't know. Was never too much into math anyway; my programs contain mostly just the old integer arithmetic... ;-). -- M.vr.gr. / Best regards, Emile van Bergen (e-mail address: emile@n293.ede.telekabel.euronet.nl) This e-mail message is 100% electronically degradeable and produced on a GNU/Linux system. ~ ~ :wq ^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: how to compile with "-fsoft-float" 1999-09-08 4:00 ` Emile van bergen @ 1999-09-09 4:00 ` Jeff Sturm 0 siblings, 0 replies; 6+ messages in thread From: Jeff Sturm @ 1999-09-09 4:00 UTC (permalink / raw) This is incorrect. The -mieee switch is a compiler option; it changes the code generated by gcc. The Alpha by itself is not fully IEEE conformant. It will generate a fp trap on NaN, Inf, underflow, etc. The -mieee flag causes gcc to insert trap barriers in the code, so the kernel can recover from traps and emulate the IEEE behavior in software. It also incurs a performance penalty, so unless you need strict IEEE behavior you are better off avoiding it. Jeff On Wed, 8 Sep 1999, Emile van bergen wrote: > > Also, why is this flag not documented in the gcc man page? Are there > > any other flags that might be of relevance to me? > > It's not exactly a flag. -mfoo tells the linker to link against libfoo.a > (statically) / libfoo.so (dynamically). ^ permalink raw reply [flat|nested] 6+ messages in thread
end of thread, other threads:[~1999-09-09 4:00 UTC | newest] Thread overview: 6+ messages (download: mbox.gz follow: Atom feed -- links below jump to the message on this page -- 1999-09-01 4:00 how to compile with "-fsoft-float" siemel naran 1999-09-02 4:00 ` Alex Rhomberg 1999-09-02 4:00 ` siemel naran 1999-09-02 4:00 ` siemel naran 1999-09-08 4:00 ` Emile van bergen 1999-09-09 4:00 ` Jeff Sturm
This is a public inbox, see mirroring instructions for how to clone and mirror all data and code used for this inbox