Package org.djutils.float128
Class DoubleDouble
- java.lang.Object
-
- java.lang.Number
-
- org.djutils.float128.DoubleDouble
-
- All Implemented Interfaces:
Serializable
,Comparable<DoubleDouble>
public class DoubleDouble extends Number implements Serializable, Comparable<DoubleDouble>
DoubleDouble stores a value as two double values, with a hi double value and a lo double value. The lo double value has a value of around 1.0E13 lower magnitude than the hi double value. The value that is represented by the DoubleDouble has the value hi+lo. DoubleDouble is immutable.
Copyright (c) 2020-2020 Delft University of Technology, Jaffalaan 5, 2628 BX Delft, the Netherlands. All rights reserved. See for project information https://djutils.org. The DJUTILS project is distributed under a three-clause BSD-style license, which can be found at https://djutils.org/docs/license.html.- Author:
- Alexander Verbraeck, Peter Knoppers
- See Also:
- Serialized Form
-
-
Constructor Summary
Constructors Constructor Description DoubleDouble(double value)
Construct a new DoubleDouble value using one double, where the lo part of the DoubleDouble will be 0.DoubleDouble(double hi, double lo)
Construct a new DoubleDouble value consisting of a high (most significant) part and a low (least significant) part.
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description int
compareTo(DoubleDouble o)
double
doubleValue()
float
floatValue()
int
intValue()
long
longValue()
static DoubleDouble
valueOf(String s)
Construct a DoubleDouble from a String value.-
Methods inherited from class java.lang.Number
byteValue, shortValue
-
-
-
-
Constructor Detail
-
DoubleDouble
public DoubleDouble(double hi, double lo)
Construct a new DoubleDouble value consisting of a high (most significant) part and a low (least significant) part.- Parameters:
hi
- double; the high part of the DoubleDouble valuelo
- double; the low part of the DoubleDouble value
-
DoubleDouble
public DoubleDouble(double value)
Construct a new DoubleDouble value using one double, where the lo part of the DoubleDouble will be 0.- Parameters:
value
- double; the high part of the DoubleDouble value
-
-
Method Detail
-
valueOf
public static DoubleDouble valueOf(String s)
Construct a DoubleDouble from a String value.- Parameters:
s
- String; the String value to be parsed- Returns:
- a DoubleDouble value representing s with as many correct digits as possible
-
compareTo
public int compareTo(DoubleDouble o)
- Specified by:
compareTo
in interfaceComparable<DoubleDouble>
-
floatValue
public float floatValue()
- Specified by:
floatValue
in classNumber
-
doubleValue
public double doubleValue()
- Specified by:
doubleValue
in classNumber
-
-