Valerie Meunier

Valerie Meunier

  • 970
  • 693
  • 72.6k

Why does this not work with float?

Dec 4 2021 1:03 PM

Hi

Hi

this code gives an error (cannot implicitely convert double to float.

 float pm100, m100=10,56F;

  pm100 = Math.Round(1000 + (10 - m100)*100,0);

I know the solution:  pm100 = Convert.ToSingle(Math.Round(1000 + (10 - m100)*100,0));

But why can't Math.Round work with float?

Thanks


Answers (2)