I get this g++ warning when I use the -Wconversion flag. Anybody know how to write this "correctly" ?
a.cpp:15: warning: conversion to ‘float’ alters ‘double’ constant value
#include <iostream>
using namespace std;
float VAR1(float VAR2)
{
int VAR3 = (int)(VAR2 * 1.045 * 1.55); // Result must be an int
float VAR4 = (float)(VAR3 + 0.95); // Result must be float ending in .95
return VAR4; // Return a float ending in .95
}
int main(void)
{
printf("%.2f", VAR1(25.95)); // printf a float ending in .95
return 0;
}