<tfoot id='7SHUr'></tfoot>

    1. <small id='7SHUr'></small><noframes id='7SHUr'>

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

      1. 关于 C 中除以零的一些事情

        时间:2023-07-02

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

        <legend id='gIQF4'><style id='gIQF4'><dir id='gIQF4'><q id='gIQF4'></q></dir></style></legend>

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

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

                <i id='gIQF4'><tr id='gIQF4'><dt id='gIQF4'><q id='gIQF4'><span id='gIQF4'><b id='gIQF4'><form id='gIQF4'><ins id='gIQF4'></ins><ul id='gIQF4'></ul><sub id='gIQF4'></sub></form><legend id='gIQF4'></legend><bdo id='gIQF4'><pre id='gIQF4'><center id='gIQF4'></center></pre></bdo></b><th id='gIQF4'></th></span></q></dt></tr></i><div id='gIQF4'><tfoot id='gIQF4'></tfoot><dl id='gIQF4'><fieldset id='gIQF4'></fieldset></dl></div>
                  本文介绍了关于 C 中除以零的一些事情的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着跟版网的小编来一起学习吧!

                  问题描述

                  可能的重复:
                  返回值 1.#INF000

                  我一直认为除以 0 会导致编译后的程序崩溃

                  I always thought division by 0 would result in a compiled program crashing

                  但是我今天发现(使用 VC++ 2010 Express)除以 0 给出了一个叫做 1.#INF000 的东西,它应该是正无穷大

                  However I discovered today (using VC++ 2010 Express) that division by 0 gives something called 1.#INF000 and it is supposed to be positive infinity

                  当它被传递给一个函数时,它被传递为 -1.#IND000

                  When it was passed to a function, it got passed as -1.#IND000

                  这是怎么回事?

                  在 google 上搜索 1.#INF000 和 -1.#IND000 也没有提供任何明确的解释

                  Searching 1.#INF000 and -1.#IND000 on google do not provide any clear explanations either

                  它只是 VC++ 特有的东西吗?

                  Is it just something specific to VC++ ?

                  推荐答案

                  浮点数除以零与整数除以零的行为不同.

                  Floating point division by zero behaves differently than integer division by zero.

                  IEEE 浮点标准区分+inf 和-inf,而整数不能存储无穷大.整数除以零会导致未定义的行为.浮点除以零由浮点标准定义,结果为 +inf 或 -inf.

                  The IEEE floating point standard differentiates between +inf and -inf, while integers cannot store infinity. Integer division by zero results in undefined behaviour. Floating point division by zero is defined by the floating point standard and results in +inf or -inf.

                  正如 Luchian 所指出的,C++ 实现不需要遵循 IEEE 浮点标准.如果您使用的实现不遵循 IEEE 浮点标准,则浮点除以零的结果未定义.

                  As pointed out by Luchian, C++ implementations are not required to follow the IEEE Floating point standard. If the implementation you use doesn't follow the IEEE Floating point standard the result of floating point division by zero is undefined.

                  这篇关于关于 C 中除以零的一些事情的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持跟版网!

                  上一篇:我怎么能合理地重载放置运算符 new? 下一篇:C++:Setenv().Visual Studio 中的未定义标识符

                  相关文章

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

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

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