C9109005: Multiplication of Constant Floats Returns a Double

ID Number: Q76505

5.10 6.00 6.00a 6.00ax | 5.10 6.00 6.00a

MS-DOS | OS/2

buglist5.10 buglist6.00 buglist6.00a buglist6.00ax fixlist7.00

Summary:

PROBLEM ID: C9109005

SYMPTOMS

When using Microsoft C Compiler version 5.1, 6.0, 6.0a, or 6.0ax,

multiplying floating-point constants returns a double value, which

causes the warnings listed below.

For C 6.0, 6.0a, 6.0ax

----------------------

warning C4136: conversion between different floating types

For C 5.1

---------

warning C4051: data conversion

RESOLUTION

To work around the problem, do one of the following:

- Place one of the floating-point constants into a temporary

variable and use it for the multiplication.

-or-

- Cast the result to a float.

STATUS

Microsoft has confirmed this to be a problem in C versions 5.1,

6.0, 6.0a, and 6.0ax. This problem was corrected in C/C++ version

7.0.

More Information:

Sample Code

-----------

/* Compile options needed: /W3

*/

void main(void)

{

float x;

x=1.234f*5.678f;

}

Additional reference words: 5.10 6.00 6.00a 6.00ax