Here you can find the source of doubleToString(final Double value)
Parameter | Description |
---|---|
value | a double value |
public static final String doubleToString(final Double value)
//package com.java2s; //License from project: Open Source License public class Main { /**//from w w w . ja v a 2s . co m * Converts a double into an SVG decimal string. * * @param value a double value * * @return an SVG number string */ public static final String doubleToString(final Double value) { final int intValue = value.intValue(); if (approximatelyEqual(intValue, value)) { return Integer.toString(intValue); } return value.toString(); } /** * Returns true if a and b are approximately equal. * * @param a a double * @param b a double * * @return true if a and b are approximately equal */ public static final boolean approximatelyEqual(final double a, final double b) { return Math.abs(a - b) < 0.000001; } }