Valerie Meunier

Valerie Meunier

  • NA
  • 693
  • 83k

float gives different number of decimal

Sep 8 2021 1:23 PM

Hi,

 Console.Write("Input numeric value: ");
        float g1 = Convert.ToSingle(Console.ReadLine());

        Console.WriteLine(g1);

When i input 10,1457854, i get 10,14579

When i input 100,1457854, i get 100,1458

When i input 1000,1457854, i get 1000,146

How come and how to get always 4 decimals?

Thanks

 


Answers (3)