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

為什么浮點數有符號零?

Why do floating-point numbers have signed zeros?(為什么浮點數有符號零?)
本文介紹了為什么浮點數有符號零?的處理方法,對大家解決問題具有一定的參考價值,需要的朋友們下面隨著小編來一起學習吧!

問題描述

為什么雙打有 -0+0?有什么背景和意義?

解決方案

-0 (通常)被視為 0 *******.當 negative 浮點數非常接近于零以至于它可以被認為是 0 時,它可能會導致(要清楚,我指的是 )

用數學術語:

這說明了 0-0 在計算意義上的一個顯著區別.

<小時>

這里有一些相關資源,其中一些已經提出.為了完整起見,我將它們包括在內:

  • 關于簽名零的維基百科文章
  • "每個計算機科學家都應該知道的浮點運算知識"(參見有符號零部分)
  • (PDF) "Much Ado About Nothing's Sign Bit" - 一篇有趣的論文由 W. Kahan 撰寫.

Why do doubles have -0 as well as +0? What is the background and significance?

解決方案

-0 is (generally) treated as 0 *******. It can result when a negative floating-point number is so close to zero that it can be considered 0 (to be clear, I'm referring to arithmetic underflow, and the results of the following computations are interpreted as being exactly ±0, not just really small numbers). e.g.

System.out.println(-1 / Float.POSITIVE_INFINITY);

-0.0

If we consider the same case with a positive number, we will receive our good old 0:

System.out.println(1 / Float.POSITIVE_INFINITY);

0.0


******* Here's a case where using -0.0 results in something different than when using 0.0:

System.out.println(1 / 0.0);
System.out.println(1 / -0.0);

Infinity
-Infinity

This makes sense if we consider the function 1 / x. As x approaches 0 from the +-side, we should get positive infinity, but as it approaches from the --side, we should get negative infinity. The graph of the function should make this clear:

(source)

In math-terms:

This illustrates one significant difference between 0 and -0 in the computational sense.


Here are some relevant resources, some of which have been brought up already. I've included them for the sake of completeness:

  • Wikipedia article on signed zero
  • "What Every Computer Scientist Should Know About Floating-Point Arithmetic" (See Signed Zero section)
  • (PDF) "Much Ado About Nothing's Sign Bit" - an interesting paper by W. Kahan.

這篇關于為什么浮點數有符號零?的文章就介紹到這了,希望我們推薦的答案對大家有所幫助,也希望大家多多支持html5模板網!

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

相關文檔推薦

How to wrap text around components in a JTextPane?(如何在 JTextPane 中的組件周圍環繞文本?)
MyBatis, how to get the auto generated key of an insert? [MySql](MyBatis,如何獲取插入的自動生成密鑰?[MySql])
Inserting to Oracle Nested Table in Java(在 Java 中插入 Oracle 嵌套表)
Java: How to insert CLOB into oracle database(Java:如何將 CLOB 插入 oracle 數據庫)
Why does Spring-data-jdbc not save my Car object?(為什么 Spring-data-jdbc 不保存我的 Car 對象?)
Use threading to process file chunk by chunk(使用線程逐塊處理文件)
主站蜘蛛池模板: 99久热| 狠狠操天天操 | 国产丝袜一区二区三区免费视频 | 欧美伦理一区 | 日韩欧美中文在线 | 美女久久 | 91大神xh98xh系列全部 | 中文在线a在线 | 久久久xx | 中文字幕 亚洲一区 | 日韩国产一区二区三区 | 欧美久久久久久久久 | 亚洲欧美日韩在线 | 欧美黄视频| 激情亚洲 | 国产成人精品一区二区 | 欧美日韩国产一区二区 | 日本午夜网 | a在线观看| av大全在线观看 | 欧美成人一级 | 一区二区久久电影 | 亚州精品天堂中文字幕 | 九色国产| 亚洲精品一区二区 | 日韩高清av | 亚洲一区二区黄 | 久久久男人的天堂 | 91.xxx.高清在线 | 中文字幕一区二区不卡 | 97精品超碰一区二区三区 | 国产欧美一级二级三级在线视频 | 91精品中文字幕一区二区三区 | 看av在线 | 久久精品亚洲精品国产欧美 | av天天干 | 中文字幕亚洲一区二区三区 | 亚洲日韩中文字幕一区 | 精品一级| 三级成人在线 | 国产成人综合久久 |