久久久久久久av_日韩在线中文_看一级毛片视频_日本精品二区_成人深夜福利视频_武道仙尊动漫在线观看

  • <small id='DbTuJ'></small><noframes id='DbTuJ'>

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

        為什么Java除以0.0時不拋出異常?

        Why doesn#39;t Java throw an Exception when dividing by 0.0?(為什么Java除以0.0時不拋出異常?)

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

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

              • <bdo id='pau8s'></bdo><ul id='pau8s'></ul>
                    <tbody id='pau8s'></tbody>
                  本文介紹了為什么Java除以0.0時不拋出異常?的處理方法,對大家解決問題具有一定的參考價值,需要的朋友們下面隨著小編來一起學習吧!

                  問題描述

                  我有代碼來計算兩個數字之間的百分比差異 - (oldNum - newNum)/oldNum * 100; - 其中兩個數字都是 doubles.我希望在 oldNum 為 0 的情況下必須添加某種檢查/異常處理.但是,當我對 oldNum 和 newNum 的值都為 0.0 進行測試運行時,執行繼續進行,就好像什么都沒發生并且沒有引發錯誤一樣.使用 ints 運行此代碼肯定會導致算術除零異常.為什么Java在涉及到doubles時會忽略它?

                  I have code to calculate the percentage difference between 2 numbers - (oldNum - newNum) / oldNum * 100; - where both of the numbers are doubles. I expected to have to add some sort of checking / exception handling in case oldNum is 0. However, when I did a test run with values of 0.0 for both oldNum and newNum, execution continued as if nothing had happened and no error was thrown. Running this code with ints would definitely cause an arithmetic division-by-zero exception. Why does Java ignore it when it comes to doubles?

                  推薦答案

                  除以零的結果在數學上是undefined,可以用float/double表示(如NaN - 不是一個數字),但它在任何基本意義上都沒有錯.

                  The result of division by zero is, mathematically speaking, undefined, which can be expressed with a float/double (as NaN - not a number), it isn't, however, wrong in any fundamental sense.

                  由于整數必須包含特定的數值,因此在處理它們時必須在除以零時引發錯誤.

                  As an integer must hold a specific numerical value, an error must be thrown on division by zero when dealing with them.

                  這篇關于為什么Java除以0.0時不拋出異常?的文章就介紹到這了,希望我們推薦的答案對大家有所幫助,也希望大家多多支持html5模板網!

                  【網站聲明】本站部分內容來源于互聯網,旨在幫助大家更快的解決問題,如果有圖片或者內容侵犯了您的權益,請聯系我們刪除處理,感謝您的支持!

                  相關文檔推薦

                  How can I detect integer overflow on 32 bits int?(如何檢測 32 位 int 上的整數溢出?)
                  Local variables before return statements, does it matter?(return 語句之前的局部變量,這有關系嗎?)
                  How to convert Integer to int?(如何將整數轉換為整數?)
                  How do I create an int array with randomly shuffled numbers in a given range(如何在給定范圍內創建一個隨機打亂數字的 int 數組)
                  Inconsistent behavior on java#39;s ==(java的行為不一致==)
                  Why is Java able to store 0xff000000 as an int?(為什么 Java 能夠將 0xff000000 存儲為 int?)

                  1. <i id='VEcU8'><tr id='VEcU8'><dt id='VEcU8'><q id='VEcU8'><span id='VEcU8'><b id='VEcU8'><form id='VEcU8'><ins id='VEcU8'></ins><ul id='VEcU8'></ul><sub id='VEcU8'></sub></form><legend id='VEcU8'></legend><bdo id='VEcU8'><pre id='VEcU8'><center id='VEcU8'></center></pre></bdo></b><th id='VEcU8'></th></span></q></dt></tr></i><div class="qwawimqqmiuu" id='VEcU8'><tfoot id='VEcU8'></tfoot><dl id='VEcU8'><fieldset id='VEcU8'></fieldset></dl></div>

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

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

                        • <legend id='VEcU8'><style id='VEcU8'><dir id='VEcU8'><q id='VEcU8'></q></dir></style></legend>
                            <bdo id='VEcU8'></bdo><ul id='VEcU8'></ul>
                            主站蜘蛛池模板: 成人av一区 | 国产一区在线视频 | 亚洲成人中文字幕 | 91高清免费| 亚洲日韩中文字幕一区 | 国产精品日日夜夜 | 日韩欧美在线视频 | 男人天堂网址 | 日韩精品一区二区三区视频播放 | 精品一区二区三区在线视频 | 91麻豆精品国产91久久久久久久久 | 一级毛片在线播放 | 中文字幕视频在线观看 | 一级在线观看 | 国产精品视频一区二区三区, | 九九久视频 | 亚洲综合激情 | 懂色中文一区二区三区在线视频 | 国产精品久久久久久av公交车 | 亚洲一区播放 | 久久99网| 精品久久久久久久久久久久 | 天天看天天爽 | 中文字幕一区在线观看视频 | 欧美日韩亚洲在线 | 黄色成人亚洲 | 91婷婷韩国欧美一区二区 | 91精品国产91久久久久久最新 | 成人在线观看免费视频 | 国产精品国产a | 亚洲精品免费观看 | 91久久精品国产 | 成年人网站免费视频 | 日韩一区二区在线播放 | 亚洲一区二区精品视频 | 中文字幕乱码一区二区三区 | 国产成人免费视频网站高清观看视频 | 日韩成人在线免费观看 | 久久久久久国产精品免费 | 午夜精品一区二区三区免费视频 | 黄色免费看 |