Double to string conversion without scientific notation

前端 未结 17 1518
無奈伤痛
無奈伤痛 2020-11-22 15:33

How to convert a double into a floating-point string representation without scientific notation in the .NET Framework?

\"Small\" samples (effective numbers may be of

17条回答
  •  暗喜
    暗喜 (楼主)
    2020-11-22 15:56

    In the old days when we had to write our own formatters, we'd isolate the mantissa and exponent and format them separately.

    In this article by Jon Skeet (https://csharpindepth.com/articles/FloatingPoint) he provides a link to his DoubleConverter.cs routine that should do exactly what you want. Skeet also refers to this at extracting mantissa and exponent from double in c#.

提交回复
热议问题