• <legend id='8XjZf'><style id='8XjZf'><dir id='8XjZf'><q id='8XjZf'></q></dir></style></legend>

      <i id='8XjZf'><tr id='8XjZf'><dt id='8XjZf'><q id='8XjZf'><span id='8XjZf'><b id='8XjZf'><form id='8XjZf'><ins id='8XjZf'></ins><ul id='8XjZf'></ul><sub id='8XjZf'></sub></form><legend id='8XjZf'></legend><bdo id='8XjZf'><pre id='8XjZf'><center id='8XjZf'></center></pre></bdo></b><th id='8XjZf'></th></span></q></dt></tr></i><div id='8XjZf'><tfoot id='8XjZf'></tfoot><dl id='8XjZf'><fieldset id='8XjZf'></fieldset></dl></div>

      <small id='8XjZf'></small><noframes id='8XjZf'>

      <tfoot id='8XjZf'></tfoot>

      • <bdo id='8XjZf'></bdo><ul id='8XjZf'></ul>

        32 位到 16 位浮点转换

        时间:2023-09-17
        <i id='qMyii'><tr id='qMyii'><dt id='qMyii'><q id='qMyii'><span id='qMyii'><b id='qMyii'><form id='qMyii'><ins id='qMyii'></ins><ul id='qMyii'></ul><sub id='qMyii'></sub></form><legend id='qMyii'></legend><bdo id='qMyii'><pre id='qMyii'><center id='qMyii'></center></pre></bdo></b><th id='qMyii'></th></span></q></dt></tr></i><div id='qMyii'><tfoot id='qMyii'></tfoot><dl id='qMyii'><fieldset id='qMyii'></fieldset></dl></div>

          <tfoot id='qMyii'></tfoot>
            <tbody id='qMyii'></tbody>

            <small id='qMyii'></small><noframes id='qMyii'>

            <legend id='qMyii'><style id='qMyii'><dir id='qMyii'><q id='qMyii'></q></dir></style></legend>
              <bdo id='qMyii'></bdo><ul id='qMyii'></ul>

                • 本文介绍了32 位到 16 位浮点转换的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

                  问题描述

                  我需要一个跨平台的库/算法来在 32 位和 16 位浮点数之间进行转换.我不需要用 16 位数字进行数学运算;我只需要减小 32 位浮点数的大小,以便它们可以通过网络发送.我正在使用 C++.

                  I need a cross-platform library/algorithm that will convert between 32-bit and 16-bit floating point numbers. I don't need to perform math with the 16-bit numbers; I just need to decrease the size of the 32-bit floats so they can be sent over the network. I am working in C++.

                  我知道我会损失多少精度,但这对我的应用程序来说没问题.

                  I understand how much precision I would be losing, but that's OK for my application.

                  IEEE 16 位格式会很棒.

                  The IEEE 16-bit format would be great.

                  推荐答案

                  std::frexp 从普通浮点数或双精度数中提取有效数和指数——然后您需要决定如何处理太大而无法放入半精度浮点数(饱和...?),进行相应调整,并将半精度数放在一起.这篇文章有 C 源代码向您展示如何执行转换.

                  std::frexp extracts the significand and exponent from normal floats or doubles -- then you need to decide what to do with exponents that are too large to fit in a half-precision float (saturate...?), adjust accordingly, and put the half-precision number together. This article has C source code to show you how to perform the conversion.

                  这篇关于32 位到 16 位浮点转换的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持html5模板网!

                  上一篇:最佳 C/C++ 网络库 下一篇:Boost::Asio : io_service.run() vs poll() 或者我如何在 m

                  相关文章

                  最新文章

                  <tfoot id='hkr7u'></tfoot>

                  <small id='hkr7u'></small><noframes id='hkr7u'>

                      <bdo id='hkr7u'></bdo><ul id='hkr7u'></ul>

                    <legend id='hkr7u'><style id='hkr7u'><dir id='hkr7u'><q id='hkr7u'></q></dir></style></legend>
                      <i id='hkr7u'><tr id='hkr7u'><dt id='hkr7u'><q id='hkr7u'><span id='hkr7u'><b id='hkr7u'><form id='hkr7u'><ins id='hkr7u'></ins><ul id='hkr7u'></ul><sub id='hkr7u'></sub></form><legend id='hkr7u'></legend><bdo id='hkr7u'><pre id='hkr7u'><center id='hkr7u'></center></pre></bdo></b><th id='hkr7u'></th></span></q></dt></tr></i><div id='hkr7u'><tfoot id='hkr7u'></tfoot><dl id='hkr7u'><fieldset id='hkr7u'></fieldset></dl></div>