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

原始浮點值如何為-0.0?這意味著什么?

How can a primitive float value be -0.0? What does that mean?(原始浮點值如何為-0.0?這意味著什么?)
本文介紹了原始浮點值如何為-0.0?這意味著什么?的處理方法,對大家解決問題具有一定的參考價值,需要的朋友們下面隨著小編來一起學習吧!

問題描述

為什么原始浮點值可以是-0.0?這是什么意思?
我可以取消該功能嗎?

How come a primitive float value can be -0.0? What does that mean?
Can I cancel that feature?

當我有:

  float fl;  

然后 fl == -0.0 返回 truefl == 0 也是如此.但是當我打印它時,它會打印 -0.0.

Then fl == -0.0 returns true and so does fl == 0. But when I print it, it prints -0.0.

推薦答案

因為 Java 使用 IEEE 浮點標準-Point Arithmetic (IEEE 754),它定義了 -0.0 以及何時應該使用它.

Because Java uses the IEEE Standard for Floating-Point Arithmetic (IEEE 754) which defines -0.0 and when it should be used.

可表示的最小數在次正規有效數中沒有 1 位,由符號確定,稱為正或 負零.它實際上表示在零和相同符號的最小可表示非零數之間的范圍內的數字四舍五入到零,這就是它有符號的原因,以及它的倒數 +Inf 或 -Inf 也有符號.

The smallest number representable has no 1 bit in the subnormal significand and is called the positive or negative zero as determined by the sign. It actually represents a rounding to zero of numbers in the range between zero and the smallest representable non-zero number of the same sign, which is why it has a sign, and why its reciprocal +Inf or -Inf also has a sign.

您可以通過添加 0.0

例如

Double.toString(value + 0.0);

參見:Java浮點數的復雜性

涉及負零的操作
...
(-0.0) + 0.0 -> 0.0

Operations Involving Negative Zero
...
(-0.0) + 0.0 -> 0.0

-

當浮點運算導致負浮點數非常接近 0 以致無法正常表示時,會產生-0.0".

"-0.0" is produced when a floating-point operation results in a negative floating-point number so close to 0 that it cannot be represented normally.

這篇關于原始浮點值如何為-0.0?這意味著什么?的文章就介紹到這了,希望我們推薦的答案對大家有所幫助,也希望大家多多支持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| 麻豆va| 久久久精彩视频 | 国产精品日日夜夜 | av在线播放网站 | 日韩精品在线看 | 国产一区二区在线视频 | 国产三级一区二区三区 | 国产激情视频 | 久久免费精彩视频 | 久久久久香蕉视频 | 日韩精品一区二区不卡 | 蜜桃精品噜噜噜成人av | 国产精品69久久久久水密桃 | 野狼在线社区2017入口 | 精品在线一区二区三区 | 91就要激情 | 国产欧美在线 | 在线观看你懂的网站 | 国产欧美精品在线 | 91精品国产91久久久久久不卞 | 日韩三级免费网站 | 久久久久久久网 | 欧美激情亚洲天堂 | 久久精品国产免费看久久精品 | 91精品国产色综合久久 | 亚洲精品乱码久久久久久蜜桃91 | 欧美日本亚洲 | 97国产一区二区 | 国产精品自拍一区 | 亚洲一二三区精品 | 欧美成人免费在线 | 欧美xxxx色视频在线观看免费 | 韩日一区二区三区 | 亚洲一区二区三区欧美 | 国产精品视频网 |