当前位置:网站首页>Double.doubleToLongBits()方法使用
Double.doubleToLongBits()方法使用
2022-08-10 10:38:00 【zhangjianming2018】
该方法可以将double类型数据转换成long类型数据,从而可以使double类型数据按照long的方法判断大小(<, >, ==)。
例如:
Double.doubleToLongBits(10.00) == Double.doubleToLongBits(10.00)Double.doubleToLongBits(20.00) > Double.doubleToLongBits(10.00)Double.doubleToLongBits(10.00) < Double.doubleToLongBits(20.00)
Double类longBitsToDouble()方法 (Double class longBitsToDouble() method)
longBitsToDouble() method is available in java.lang package.
longBitsToDouble()方法在java.lang包中可用。
longBitsToDouble() method is used to return the double value corresponding to the given long bit denotation followed by IEEE 754 double floating-point standards.
longBitsToDouble()方法用于返回与给定的长位符号对应的双精度值,后跟IEEE 754双浮点标准。
longBitsToDouble() method is a static method, it is accessible with the class name too and if we try to access the method with the class object then also we will not get an error.
longBitsToDouble()方法是一个静态方法,也可以使用类名进行访问,如果尝试使用类对象访问该方法,那么也不会出错。
longBitsToDouble() method does not throw an exception at the time of representing bits.
longBitsToDouble()方法在表示位时不会引发异常。
Syntax:
句法
public static double longBitsToDouble(long bits_rep);
Parameter(s):
参数:
long bits_rep – represents the long integer value.
long bits_rep –表示长整数值。
Return value:
返回值:
The return type of this method is double, it returns the bits that represent the long integer value.
此方法的返回类型为double ,它返回表示长整数值的位。
Note:
注意:
If we pass "0x7ff0000000000000L", it returns the value "positive infinity".
如果我们传递“ 0x7ff0000000000000L” ,它将返回值“ positive infinity” 。
If we pass "0xfff0000000000000L", it returns the value "negative infinity".
如果我们传递“ 0xfff0000000000000L” ,它将返回值“ negative infinity” 。
// Java program to demonstrate the example
// of longBitsToDouble(long bits_rep)
// method of Double class
public class LongBitsToDoubleOfDoubleClass {
public static void main(String[] args) {
// Variables initialization
double d1 = 18.20;
double d2 = 19.20;
// Display value1,value2 values
System.out.println("d1: " + d1);
System.out.println("d2: " + d2);
// Double instance creation
Double value1 = new Double(d1);
Double value2 = new Double(d2);
// It returns the double value denoted by the given bit denotation
//by calling value1.longBitsToDouble(124568)
double result1 = value1.longBitsToDouble(124568);
// It returns the double value denoted by the given bit denotation
//by calling value1.longBitsToDouble(124568)
double result2 = value2.longBitsToDouble(0xfff0000000000000L);
// Display result1,result2 values
System.out.println("value1.longBitsToDouble(124568): " + result1);
System.out.println("value2.longBitsToDouble(0xfff0000000000000L): " + result2);
}
}
d1: 18.2
d2: 19.2
value1.longBitsToDouble(124568): 6.1545E-319
value2.longBitsToDouble(0xfff0000000000000L): -Infinity
边栏推荐
- 【C语言】头文件#include <conio.h>,conio是Console Input/Output(控制台输入输出)
- 《MySQL高级篇》六、索引的创建与设计原则
- owl.carousel poster card Slider carousel switch
- 网络安全笔记5——数字签名
- Dry goods!ASSANet: Making PointNet++ faster and stronger
- 第2章-矩阵及其运算-矩阵创建(1)
- [Microservice Architecture] Microservices and SOA Architecture (2)
- 什么是抽象类
- TCP/IP笔记
- LeetCode Algorithm 914. 卡牌分组
猜你喜欢

开发模式对测试的影响

Redis (six) - transaction and lock mechanism of Redis6 (unfinished, to be supplemented)

14 high-frequency handwritten JS interview questions and answers to consolidate your JS foundation

「时序数据库」使用cassandra进行时间序列数据扫描

bus事件总线 使用

让软件飞——“X+”技术揭秘

快速上手,征服三种不同分布式架构调用方案

Get started quickly and conquer three different distributed architecture calling schemes

C#实战:基于ItextSharp技术标签生成小工具

Research on motion capture system for indoor combined positioning technology
随机推荐
用proteus直接仿真stm32-可以完全丢弃编程器
mysql5.7 installation and deployment - yum installation
CodeChef STMRRG String Merging (dp)
JWT 实现登录认证 + Token 自动续期方案
跨公网环境,路由策略,进行设备的访问
【C语言】头文件#include <conio.h>,conio是Console Input/Output(控制台输入输出)
mysql5.7安装部署-yum安装
【Azure云】服务端点和私有链接有什么区别?观点(1)
4 面拿华为 offer 的水平,面试阿里居然一面就被吊打?
组合模式:Swift 实现
《MySQL高级篇》六、索引的创建与设计原则
ESP8266 Tutorial 1 - Introduction to ESP8266 Hardware Platform
Research on motion capture system for indoor combined positioning technology
8月份DB-Engines 数据库排行榜最新战况
Gartner再次重申了“数据编织”的重要价值
chart.js水平柱状图插件
GPU accelerated Pinterest recommendation model, the number of parameters increased by 100 times, and the user activity increased by 16%
Redis (six) - transaction and lock mechanism of Redis6 (unfinished, to be supplemented)
Text selection rounded style border-radius
HCIP ---- VLAN