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

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

        <bdo id='Awdks'></bdo><ul id='Awdks'></ul>
    1. <tfoot id='Awdks'></tfoot>

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

      时间:2023-10-05

    2. <small id='Ydoyi'></small><noframes id='Ydoyi'>

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

              • <bdo id='Ydoyi'></bdo><ul id='Ydoyi'></ul>
                <tfoot id='Ydoyi'></tfoot>
                本文介绍了关于 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 中除以零的一些事情的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持html5模板网!

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

                相关文章

                最新文章

              • <i id='qtFvy'><tr id='qtFvy'><dt id='qtFvy'><q id='qtFvy'><span id='qtFvy'><b id='qtFvy'><form id='qtFvy'><ins id='qtFvy'></ins><ul id='qtFvy'></ul><sub id='qtFvy'></sub></form><legend id='qtFvy'></legend><bdo id='qtFvy'><pre id='qtFvy'><center id='qtFvy'></center></pre></bdo></b><th id='qtFvy'></th></span></q></dt></tr></i><div id='qtFvy'><tfoot id='qtFvy'></tfoot><dl id='qtFvy'><fieldset id='qtFvy'></fieldset></dl></div>
                    <bdo id='qtFvy'></bdo><ul id='qtFvy'></ul>
                1. <small id='qtFvy'></small><noframes id='qtFvy'>

                2. <tfoot id='qtFvy'></tfoot>
                  1. <legend id='qtFvy'><style id='qtFvy'><dir id='qtFvy'><q id='qtFvy'></q></dir></style></legend>