ftp.delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp/2002/04/23/23:15:19

X-Authentication-Warning: delorie.com: mailnull set sender to djgpp-bounces using -f
From: NoEmailAds AT execpc DOT com (Chris Giese)
Newsgroups: comp.os.msdos.djgpp
Subject: Re: djgpp, nasm and floats
Date: Wed, 24 Apr 2002 02:57:59 GMT
Organization: PROPULSION GROUP
References: <4 DOT 3 DOT 2 DOT 7 DOT 2 DOT 20020422131623 DOT 00bd4110 AT mail DOT ciudad DOT com DOT ar>
X-Newsreader: Forte Free Agent 1.11/32.235
Lines: 36
Message-ID: <3cc62030$0$1417$272ea4a1@news.execpc.com>
NNTP-Posting-Host: ab74de73.news.execpc.com
X-Trace: DXC=WgoJecZJZRK\HUh2f[3=MLnc8dR=bW AT 2B0ICGTaT\BlM=EV;d7?Dn`M5A>0>f_hmHGmo[EQkYRng AT o30aDDF3;oL
X-Complaints-To: abuse AT execpc DOT com
To: djgpp AT delorie DOT com
DJ-Gateway: from newsgroup comp.os.msdos.djgpp
Reply-To: djgpp AT delorie DOT com

"R. Grela" <rgrela AT ciudad DOT com DOT ar> wrote:

>global _atest
>
>section .data
>    p dd 0.2
>
>section .text
>_atest:
>     mov eax, [p]
>     ret
>
>and receiving as float (I've tryed with double too)
>extern "C" float atest();
>void main() { float f = atest();  cout << f << endl; }
>
>and I get -NaN
>
>Any idea?

info gcc

seach for "calling convention"

`-mno-fp-ret-in-387'
     Do not use the FPU registers for return values of functions.

     The usual calling convention has functions return values of types
     `float' and `double' in an FPU register, even if there is no FPU.
     The idea is that the operating system should emulate an FPU.

     The option `-mno-fp-ret-in-387' causes such values to be returned
     in ordinary CPU registers instead.

Just compile with this option and re-link, then your code should work.

- Raw text -


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