jdk Double类具体实现
二、方法
/*** Returns a string representation of the {@code double}* argument. All characters mentioned below are ASCII characters.* <ul>* <li>If the argument is NaN, the result is the string* "{@code NaN}".* <li>Otherwise, the result is a string that represents the sign and* magnitude (absolute value) of the argument. If the sign is negative,* the first character of the result is '{@code -}'* ({@code '\u005Cu002D'}); if the sign is positive, no sign character* appears in the result. As for the magnitude <i>m</i>:* <ul>* <li>If <i>m</i> is infinity, it is represented by the characters* {@code "Infinity"}; thus, positive infinity produces the result* {@code "Infinity"} and negative infinity produces the result* {@code "-Infinity"}.** <li>If <i>m</i> is zero, it is represented by the characters* {@code "0.0"}; thus, negative zero produces the result* {@code "-0.0"} and positive zero produces the result* {@code "0.0"}.** <li>If <i>m</i> is greater than or equal to 10<sup>-3</sup> but less* than 10<sup>7</sup>, then it is represented as the integer part of* <i>m</i>, in decimal form with no leading zeroes, followed by* '{@code .}' ({@code '\u005Cu002E'}), followed by one or* more decimal digits representing the fractional part of <i>m</i>.** <li>If <i>m</i> is less than 10<sup>-3</sup> or greater than or* equal to 10<sup>7</sup>, then it is represented in so-called* "computerized scientific notation." Let <i>n</i> be the unique* integer such that 10<sup><i>n</i></sup> ≤ <i>m</i> {@literal <}* 10<sup><i>n</i>+1</sup>; then let <i>a</i> be the* mathematically exact quotient of <i>m</i> and* 10<sup><i>n</i></sup> so that 1 ≤ <i>a</i> {@literal <} 10. The* magnitude is then represented as the integer part of <i>a</i>,* as a single decimal digit, followed by '{@code .}'* ({@code '\u005Cu002E'}), followed by decimal digits* representing the fractional part of <i>a</i>, followed by the* letter '{@code E}' ({@code '\u005Cu0045'}), followed* by a representation of <i>n</i> as a decimal integer, as* produced by the method {@link Integer#toString(int)}.* </ul>* </ul>* How many digits must be printed for the fractional part of* <i>m</i> or <i>a</i>? There must be at least one digit to represent* the fractional part, and beyond that as many, but only as many, more* digits as are needed to uniquely distinguish the argument value from* adjacent values of type {@code double}. That is, suppose that* <i>x</i> is the exact mathematical value represented by the decimal* representation produced by this method for a finite nonzero argument* <i>d</i>. Then <i>d</i> must be the {@code double} value nearest* to <i>x</i>; or if two {@code double} values are equally close* to <i>x</i>, then <i>d</i> must be one of them and the least* significant bit of the significand of <i>d</i> must be {@code 0}.** <p>To create localized string representations of a floating-point* value, use subclasses of {@link java.text.NumberFormat}.** @param d the {@code double} to be converted.* @return a string representation of the argument.*/public static String toString(double d) {return FloatingDecimal.toJavaFormatString(d);}
jdk Double类具体实现相关推荐
- 【读码JDK】- java.lang.Double类Api介绍及测试
[读码JDK]java.lang包目录 请自行调整包路径,中文仅供参考. java.lang.Double类Api介绍及测试 package lang;import org.junit.Test;/* ...
- 1.5 Double类
Double 类在对象中包装了一个基本类型 double 的值.Double 类对象包含一个 double 类型的字段.此外,该类还提供了多个方法,可以将 double 类型与 String 类型相互 ...
- doublevalue_Java Double类doubleValue()方法与示例
doublevalue Double类doubleValue()方法 (Double class doubleValue() method) doubleValue() method is avail ...
- Java Double类parseDouble()方法的示例
Double类parseDouble()方法 (Double class parseDouble() method) parseDouble() method is available in java ...
- Java Double类doubleToLongBits()方法与示例
Double类doubleToLongBits()方法 (Double class doubleToLongBits() method) doubleToLongBits() method is av ...
- JDK Unsafe类的使用与CAS原子特性
JDK Unsafe类的使用与CAS原子特性 Java.util.concurrent.atomic包,其中包含了大量使用到Unsafe这个类 Java不能直接访问操作系统的底层,而是通过本地方法来访 ...
- Java Double类详解
Double 类的构造方法 Double 类中的构造方法有如下两个. Double(double value):构造一个新分配的 Double 对象,它表示转换为 double 类型的参数.Doubl ...
- Java高级之Float类和Double类的isNaN()方法
遇到这个问题,最开始是在HashMap的源码中,在构造方法中调用了该方法 而isNaN()是Float类和Double类都有的一个静态方法,意思是判断输入的参数是否是一个NaN值. 方法体就只有一条语 ...
- 数据库查询字段类型为double类型和float类型时遇到的坑
对于小数型的字段,我们常用double类型和float类型,但是这两种类型使用的时候有很大差别,下面我们来看一下 在设计数据表时,突然发现原来FLOAT原来是很不靠谱的,所以在这里建议大家换成DOUB ...
- java中double..compare_Java Double类compare()方法与示例
Double类compare()法compare()方法在java.lang包中可用. compare()方法用于检查给定两个双精度值的相等或不相等,换句话说,可以说此方法用于比较两个双精度值. co ...
最新文章
- linux命令简单汇总,直通车
- 黄猫被汽车撞死 花猫雨夜苦守
- 安装ubuntu时将boot目录单独挂载的意义
- 1.5 Map集合:HashMap 和TreeMap 类
- centos7下NFS服务器的搭建与配置
- 【期望DP】概率充电器(luogu 4284)
- python基本数据类型——str
- 在Windows下编译zlib1.2.5
- springcloud的简单使用_微服务架构:初识Spring Cloud
- 【4】搭建Docker私服harbor
- html语言中glyphicon,Bootstrap字体图标无法正常显示的解决方法
- 华为eNSP BUG——Serial线配置ACL问题
- 思维导图很难做?MindManager教你一招致胜!
- atitit 国家与社区发展战略研究attilax 总结 v2 .docx
- 让Microsoft Office2010 新建 Microsoft Office 97-2003 文档
- UBNT设置AP模式注意事项
- 腾讯云cdn怎样接入域名
- 电脑无线网络(WiFi)密码查看(cmd命令控制符)
- 华为荣耀X1相机或图库图标被删除后的恢复方法(不需要恢复出厂设置)!
- 分布式缓存系统Redis原理解析
热门文章
- PHP邮件扩展,PHP邮件扩展:mailpp
- java中包定义_java中包的定义与使用
- 实习踩坑之路:JSON格式错误,导致Java异常JSON parse error: Cannot deserialize instance of `java.util.ArrayList` out o
- 违反计算机信息网络国际联网安全,给你普及一下为了加强对计算机信息网络国际联网的安全保护,维护公共秩序和社会稳定,早在1997年12月30日【刁爱青吧】_百度贴吧...
- Log4j2 Zero Day 漏洞 Apache Flink 应对指南(二)
- android应用热修复与插件化实践之路
- 老板下死命令:必须将20M文件从30秒压缩到1秒,我是如何做到的?
- 从Android转大前端半年,我的一些思考
- android banner的比例,Android_首页Banner的封装
- xpath的基础知识