Java Double类doubleToLongBits()方法与示例

Double类doubleToLongBits()方法 (Double class doubleToLongBits() method)

  • doubleToLongBits() method is available in java.lang package.

    doubleToLongBits()方法在java.lang包中可用。

  • doubleToLongBits() method follows IEEE 754 double floating-point standards and according to standards, it returns the bits that denote floating-point value.

    doubleToLongBits()方法遵循IEEE 754双浮点标准,并且根据这些标准,它返回表示浮点值的位。

  • doubleToLongBits() 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.

    doubleToLongBits()方法是一个静态方法,也可以使用类名进行访问,如果我们尝试使用类对象访问该方法,那么也不会收到错误。

  • doubleToLongBits() method does not throw an exception at the time of representing bits.

    doubleToLongBits()方法在表示位时不会引发异常。

Syntax:

句法:

    public static long doubleToLongBits(double value);

Parameter(s):

参数:

  • double value – This parameter represents the double precision floating point value.

    double value –此参数表示双精度浮点值。

Return value:

返回值:

The return type of this method is long, it returns the bits that represent the double precision floating-point value.

此方法的返回类型为long ,它返回表示双精度浮点值的位。

Note:

注意:

  • If we pass positive infinity, it returns the value 0x7ff0000000000000L.

    如果我们传递正无穷大 ,它将返回值0x7ff0000000000000L

  • If we pass negative infinity, it returns the value 0xfff0000000000000L.

    如果我们传递负无穷大 ,它将返回值0xfff0000000000000L

  • If we pass NaN, it returns the value 0x7ff8000000000000L.

    如果我们通过NaN ,它将返回值0x7ff8000000000000L

Example:

例:

// Java program to demonstrate the example 
// of doubleToLongBits(double value)
// method of Double class
public class DoubleToLongBitsOfDoubleClass {
public static void main(String[] args) {
// Variables initialization
double value1 = 18.20;
double value2 = 19.20;
// Display value1,value2 values
System.out.println("value1: " + value1);
System.out.println("value2: " + value2);
// It returns the bits denoted by the double 
// floating-point argument by calling 
// Double.doubleToLongBits(value1)
long result1 = Double.doubleToLongBits(value1);
// It returns the bits denoted by the double 
// floating-point argument by calling 
// Double.doubleToLongBits(value2)
long result2 = Double.doubleToLongBits(value2);
// Display result1,result2 values
System.out.println("Double.doubleToLongBits(value1): " + result1);
System.out.println("Double.doubleToLongBits(value2): " + result2);
}
}

Output

输出量

value1: 18.2
value2: 19.2
Double.doubleToLongBits(value1): 4625816062258262835
Double.doubleToLongBits(value2): 4626097537234973491

翻译自: https://www.includehelp.com/java/double-class-doubletolongbits-method-with-example.aspx

本文来自互联网用户投稿,该文观点仅代表作者本人,不代表本站立场。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如若转载,请注明出处:http://www.mzph.cn/news/379830.shtml

如若内容造成侵权/违法违规/事实不符,请联系多彩编程网进行投诉反馈email:809451989@qq.com,一经查实,立即删除!

相关文章

Firefox(火狐浏览器)彩蛋

①在地址栏上输入: about:mozilla ②在地址栏上输入: about:robots ③在地址栏上输入: www.figma.com/404/ ④地址栏上输入: chrome://global/content/alerts/alert.xul

jquery.history插件在ie中失效的问题

hash标志中不能有? ff中不存在这个问题。 转载于:https://www.cnblogs.com/xyun/archive/2008/12/01/1345188.html

Java——反射(Class.forName()读取配置文件举例).

榨汁机(Juicer)榨汁机的案例: 分别有水果(Fruit),苹果(Apple),香蕉(Bananal),橘子(Orange),榨汁(squeeze) 要求: 榨出不同的水果汁来喝 //一般方法求解 package com.testl;public class Text1 {public static void main(Strin…

java 根据类名示例化类_Java类类getEnclosingClass()方法及示例

java 根据类名示例化类类的类getEnclosingClass()方法 (Class class getEnclosingClass() method) getEnclosingClass() method is available in java.lang package. getEnclosingClass()方法在java.lang包中可用。 getEnclosingClass() method is used to return recent or im…

C++:cin.getline

转:百度百科 http://baike.baidu.com/view/2383876.htm cin.getline 此函数是按行读取,其语法为:cin.getline(字符指针,字符个数N,结束符); 功能是:一次读取多个字符(包括空白字符),直到读满N-1个,或者遇到指定的结束符…

端口复用和重映射--STM32F103

什么是端口复用? STM32中有很多内置外设,这些外设的引脚都是与GPIO复用的,什么时候复用呢?就是当一个GPIO作为内置外设引脚使用时,就叫做复用。比如串口1的发送接收引脚是PA9,PA10,当PA9&#…

考研数学

眼前俨然一副冬的气象,伴随气温的骤降,考研复习也进入异常紧张的阶段。在考试前这两个月里,考生如何复习数学,成绩还可以有所提高。万学?海文数学教研组针对冲刺阶段数学复习归纳总结以下复习经验和建议,供大家参考。…

一个很好的自学网站~推荐一下

http://www.51zxw.net/study.asp?vip15746908

[转]Ubuntu远程桌面登陆

原文地址:http://www.cnblogs.com/xdzone/archive/2011/03/10/1979644.html 1.xp下默认的远程桌面协议是rdp,默认端口3389,而ubuntu用的时vnc:默认端口5900 2.首先被访问的主机(windows/linux)都要设置为允…

NVIC中断管理---STM32

NVIC:嵌套向量中断控制器 在了解中断之前,我们先了解抢占优先级和响应优先级 抢占优先级和响应优先级 抢占优先级决定能不能打断,高优先级的抢占可以中断低优先级的抢占响应优先级在抢占优先级相同时,高响应优先级先执行&#x…

Java BigDecimal stripTrailingZeros()方法与示例

BigDecimal类stripTrailingZeros()方法 (BigDecimal Class stripTrailingZeros() method) stripTrailingZeros() method is available in java.math package. stripTrailingZeros()方法在java.math包中可用。 stripTrailingZeros() method is used to get a BigDecimal that is…

外部中断---STM32F1

外部中断概述 STM32的中断控制器支持19个外部中断/事件请求: 线0-15:对应外部IO口的输入中断线16:连接到PVD输出线17:连接到RTC闹钟事件线18:连接到USB唤醒事件 STM32每个IO口都有可以作为外部中断输入,…

转:点9图

关于”点九” 转:http://mux.baidu.com/?p1506“点九”是andriod平台的应用软件开发里的一种特殊的图片形式,文件扩展名为:.9.png 智能手机中有自动横屏的功能,同一幅界面会在随着手机(或平板电脑)中的方向传感器的参数不同而改变显示的方向…

Python HTMLCalendar类| 带实例的formatyear()方法

Python HTMLCalendar.formatyear()方法 (Python HTMLCalendar.formatyear() Method) formatyear() method is an inbuilt method of the HTMLCalendar class of calendar module in Python. It works on HTMLCalendar class object and returns an HTML table consisting of th…

2009中国企业家新春联谊会

2009中国企业家新春联谊会——把握当前机遇,笑对经济危机,畅饮将帅美酒尊敬的嘉宾:当前,国际形势正在发生深刻而复杂的变化,由美国次贷危机引发的全球经济危机已经愈演愈烈,美国前五大投资银行有3家宣告破产…

串口通信的基本原理----STM32

串口通信基本原理 1. 处理器与外部设置通信的基本方式 并行通信:数据各个位同时传输串行通信:数据按位顺序传输 在串行通信中,按照数据的传输方向,又分为: 单工:数据传输只支持在一个方向传输半双工&am…

java获取vm运行参数_如何获取在Java中运行Java VM的版本?

java获取vm运行参数To get the version of running VM (Virtual Machine) in Java, we use the getProperties() method, which is defined in System class, while calling the method, we need to pass the property name to get the version of running Java VM. 要获取Java…

Spring MVC+Ant+Tomcat+Eclipse最简单的demo

第一步是Java的Web环境搭建,下载Eclipse(或者更好的但收费的IDE-IntelliJ Idea,和Resharper一家公司出的),下载Tomcat,下载JDK,下载Spring,注意安装Tomcat的时候配置一下管理员账号和…

MySQL的环境变量配置详细步骤

1.下载MySQL 例如下载:mysql-installer-community-5.5.60.1 我以这个版本为例 2.右击->我的电脑->属性 3. 4.找到在 系统变量 中找到 Path 5.找MySql的bin目录(每个人的电脑上这个文件的位置应该是差不多的,找到之后复制下来&#x…

转帖:强命名程序集(Strong Name Assembly)的概念

强命名程序集(Strong Name Assembly)的概念因为不同的公司可能会开发出有相同名字的程序集来,如果这些程序集都被复制到同一 个相同的目录下,最后一个安装的程序集将会代替前面的程序集。这就是著名的Windows “DLL Hell”出现的原…