Need to display the values in the floating point format as well as in exponential format
if the value is greater or equal to 0.01 and less than or equal to 1000
display in the expotential format else display in the floating format
For eg : 3.230000000 is displayed as 3.23
0.00001 is displayed as 1E-05
But the problem with my code if number given is 1 then the number is displayed as 1.00.
if (dValue >= 0.01|| dValue <= 1000.0)
return (string.Format("{0:0.##E+00}", dValue));
else
return (string.Format("{0:F2}", dValue));
Please let me know how to check the number does not contain decimal values
Round the number to two decimal places and to an integer, and see if the results are “close enough”:
The thing to note here is that (as always with floating point numbers) the comparison between the two rounded results should not be an equality comparison.