delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp/2002/12/21/01:16:07

From: "Lars O. Hansen" <lars DOT o DOT hansen AT gmx DOT de>
Newsgroups: comp.os.msdos.djgpp
Subject: Re: C preprocessor not capable of floating point division ?
Date: Sat, 21 Dec 2002 07:14:10 +0100
Organization: 1&1 Internet AG
Lines: 31
Message-ID: <au10rd$igv$1@news.online.de>
References: <au0qd9$hkj$1 AT news DOT online DOT de> <Xns92EAF18D1776Casu1cornelledu AT 132 DOT 236 DOT 56 DOT 8> <au0s1n$hqn$1 AT news DOT online DOT de> <Xns92EAF41569BACasu1cornelledu AT 132 DOT 236 DOT 56 DOT 8>
NNTP-Posting-Host: p50838947.dip0.t-ipconnect.de
X-Trace: news.online.de 1040451245 18975 80.131.137.71 (21 Dec 2002 06:14:05 GMT)
X-Complaints-To: abuse AT online DOT de
NNTP-Posting-Date: 21 Dec 2002 06:14:05 GMT
X-Priority: 3
X-MSMail-Priority: Normal
X-Newsreader: Microsoft Outlook Express 6.00.2800.1106
X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2800.1106
To: djgpp AT delorie DOT com
DJ-Gateway: from newsgroup comp.os.msdos.djgpp
Reply-To: djgpp AT delorie DOT com

> if you change the code to:
>
> C:\Dload\misc>cat fff.c
> #define STH 8
>
> float a = 2.0/STH;
>
> then you'll get:
>
> C:\Dload\misc>gcc -S fff.c
>
> C:\Dload\misc>cat fff.s
>         .file   "fff.c"
> .globl _a
>         .section .data
>         .p2align 2
> _a:
>         .long   1048576000
>         .ident  "GCC: (GNU) 3.2.1"
>
> where 1048576000 is the float representation of 0.5.


yes, right; even better: #define STH 8.0 if there is a chance of STH being used in float
initializations; as I've just checked, this doesn't do ints any harm if used for their
initialization.


Lars


- Raw text -


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