MCPcopy Index your code
hub / github.com/processing/processing / doubleToString

Method doubleToString

core/src/processing/data/JSONObject.java:512–530  ·  view source on GitHub ↗

Produce a string from a double. The string "null" will be returned if the number is not finite. @param d A double. @return A String.

(double d)

Source from the content-addressed store, hash-verified

510 * @return A String.
511 */
512 static protected String doubleToString(double d) {
513 if (Double.isInfinite(d) || Double.isNaN(d)) {
514 return "null";
515 }
516
517 // Shave off trailing zeros and decimal point, if possible.
518
519 String string = Double.toString(d);
520 if (string.indexOf('.') > 0 && string.indexOf('e') < 0 &&
521 string.indexOf('E') < 0) {
522 while (string.endsWith("0")) {
523 string = string.substring(0, string.length() - 1);
524 }
525 if (string.endsWith(".")) {
526 string = string.substring(0, string.length() - 1);
527 }
528 }
529 return string;
530 }
531
532
533 /**

Callers

nothing calls this directly

Calls 1

toStringMethod · 0.45

Tested by

no test coverage detected