我正在尝试将原始二进制数据从线程上下文转换为人类可读的格式,并且在尝试转换时出现空的情况四精度浮点 http://en.wikipedia.org/wiki/Quadruple-precision_floating-point_format#IEEE_754_quadruple-precision_binary_floating-point_format%3a_binary128将值转换为 C# 中可读的格式。
Ultimately, I'd like to display it in standard scientific notation, e.g. 1.234567×1089. I'm not worried about loss of precision in the process - I just want a reasonable idea of what the value is.
我的第一个想法是通过提高指数来手动计算双精度值,但当然在许多情况下我会超过最大值。我不介意失去精度,但根本无法显示它是不可接受的。
我可以使用某种简单的数学技巧来实现此目的吗?
您可以安装一个第三方库来处理这个问题。例如它看起来像QPFloat http://sourceforge.net/projects/qpfloat/给你一个新的struct
called System.Quadruple
这会覆盖ToString
,所以你可以尝试一下。
(我想知道.NET什么时候会支持类似的东西System.Quadruple
.)
本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系:hwhale#tublm.com(使用前将#替换为@)