Single Digit After Decimal - Javascript and C#

Viewed 96

I am trying to round a decimal "94.545". I am getting a different result in C#.Net and Javascript. The following code i am using.

C#:

string.Format("{0:0.0}", Convert.ToDouble("94.545")); --> Result 94.6
string.Format("{0:0.0}", Convert.ToDouble("90.769")); --> Result 90.8

Javascript:

parseFloat('94.545').toFixed(1); --> Result 94.5
parseFloat('90.769').toFixed(1); --> Result 90.8

The first value '94.545' is creating issue. I am getting different results between c# and javascript.

I have tried different things, i am getting the same response.

0 Answers
Related