Share September 2005: Project of the Month

MinGW - Minimalist GNU for Windows

Tracker: Bugs

5 Can't assign hex value to a double (with -ansi) - ID: 2476917
Last Update: Comment added ( dannysmith )

Hi,

I'm using gcc version 3.4.5 (mingw special) with version 3.15.1 of the
mingw runtime package - on Windows XP and Windows Vista.

The following is as I expect:

######################
C:\_32\c>type bug.c
#include <stdio.h>
#include <stdlib.h>

int main(void) {
double a = 0x123.1P-02;
printf("%f\n", a);
return 0;
}

C:\_32\c>gcc -o bug.exe bug.c

C:\_32\c>bug
72.765625

C:\_32\c>
######################

But if I try to compile the same source using the -ansi switch, the program
fails to build:

######################
C:\_32\c>gcc -ansi -o bug.exe bug.c
bug.c:5:16: exponent has no digits

C:\_32\c>
######################

I'm not exactly sure how MinGW is supposed to react to doubles being
assigned a hex value, but the differing behaviour looks buggy to me.
(Apologies if I'm wrong about that.)

Cheers,
Rob


Sisyphus ( sisyphus_ ) - 2008-12-30 10:11

5

Closed

Works For Me

Nobody/Anonymous

gcc

None

Public


Comment ( 1 )

Date: 2008-12-31 03:24
Sender: dannysmith

-ansi switch enforces only C89 standard. hex float was introduced with
ISO C99.
Do this:
gcc -std=c99 -o bug.exe bug.c



Attached File

No Files Currently Attached

Changes ( 4 )

Field Old Value Date By
status_id Open 2008-12-31 03:24 dannysmith
resolution_id None 2008-12-31 03:24 dannysmith
category_id mingw runtime 2008-12-31 03:24 dannysmith
close_date - 2008-12-31 03:24 dannysmith