Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Error 83 error C2398: conversion from 'double' to 'float' requires a narrowing conversion

I have found many posts about this error but I could find how to overcome it. This is the code where the error is triggered:

void main(){
    float f{1.3};
}

Why in the initialize-list no casting happened like any other variable? For example, this works smoothly:

float f = 1.3;
like image 564
Humam Helfawi Avatar asked Nov 09 '15 09:11

Humam Helfawi


1 Answers

This is maybe a bug or something. Use this instead:

float f;
f=1.3;
like image 92
user7695214 Avatar answered Oct 22 '22 15:10

user7695214