org.jmlspecs.models
Class JMLDouble
java.lang.Object
org.jmlspecs.models.JMLDouble
- All Implemented Interfaces:
- Cloneable, Comparable, JMLComparable, JMLType, Serializable
- public strictfp class JMLDouble
- extends Object
- implements JMLComparable
A reflection of Double
that implements JMLType
.
- Version:
- $Revision: 1.34 $
- Author:
- Brandon Shilling, Gary T. Leavens, David Cok
- See Also:
Double
,
JMLDouble
Class Specifications |
public invariant this.owner == null;
private represents theDouble <- this.doubleValue; |
Specifications inherited from class Object |
represents objectState <- org.jmlspecs.lang.JMLDataGroup.IT;
public represents _getClass <- \typeof(this); |
Specifications inherited from interface Comparable |
instance public invariant ( \forall java.lang.Comparable x; x != null; x.compareTo(x) == 0);
instance public invariant ( \forall java.lang.Comparable x, y; x != null&&y != null&&this.definedComparison(x,y)&&this.definedComparison(y,x); this.sgn(x.compareTo(y)) == -this.sgn(y.compareTo(x)));
instance public invariant ( \forall int n; n == -1||n == 1; ( \forall java.lang.Comparable x, y, z; x != null&&y != null&&z != null&&this.definedComparison(x,y)&&this.definedComparison(y,z)&&this.definedComparison(x,z); this.sgn(x.compareTo(y)) == n&&this.sgn(y.compareTo(z)) == n ==> this.sgn(x.compareTo(z)) == n));
instance public invariant ( \forall int n; n == -1||n == 1; ( \forall java.lang.Comparable x, y, z; x != null&&y != null&&z != null&&this.definedComparison(x,y)&&this.definedComparison(y,z)&&this.definedComparison(x,z); (this.sgn(x.compareTo(y)) == 0&&this.sgn(y.compareTo(z)) == n||this.sgn(x.compareTo(y)) == n&&this.sgn(y.compareTo(z)) == 0) ==> this.sgn(x.compareTo(z)) == n));
instance public invariant ( \forall java.lang.Comparable x, y, z; x != null&&y != null&&z != null&&this.definedComparison(x,y)&&this.definedComparison(x,z)&&this.definedComparison(y,z); this.sgn(x.compareTo(y)) == 0 ==> this.sgn(x.compareTo(z)) == this.sgn(y.compareTo(z))); |
Model Field Summary |
double |
theDouble
The double that is the abstract value of this object. |
Constructor Summary |
JMLDouble()
Initialize this object to contain zero. |
JMLDouble(double inDouble)
Initialize this object to contain the given double. |
JMLDouble(int inInt)
Initialize this object to contain an approximation to the
given integer. |
JMLDouble(non_null Double inDouble)
Initialize this object to contain the value of the given
Double. |
JMLDouble(non_null String s)
Initialize this object to contain the value given by the
string argument. |
Method Summary |
boolean |
approximatelyEqualTo(double d2,
double epsilon)
Tell whether relative difference of this JMLDouble and the arg is
within the given epsilon. |
static boolean |
approximatelyEqualTo(double d1,
double d2,
double epsilon)
Tell whether relative difference of the two arguments is
within the given epsilon. |
boolean |
approximatelyEqualTo(non_null Double d2,
double epsilon)
Tell whether relative difference of this JMLDouble and the arg is
within the given epsilon. |
boolean |
approximatelyEqualTo(non_null JMLDouble d2,
double epsilon)
Tell whether relative difference of this JMLDouble and the arg is
within the given epsilon. |
static boolean |
approximatelyEqualTo(non_null JMLDouble d1,
double d2,
double epsilon)
Tell whether relative difference of this JMLDouble and the arg is
within the given epsilon. |
static boolean |
approximatelyEqualTo(non_null JMLDouble d1,
non_null Double d2,
double epsilon)
Tell whether relative difference of this JMLDouble and the arg is
within the given epsilon. |
static boolean |
approximatelyEqualTo(non_null JMLDouble d1,
non_null JMLDouble d2,
double epsilon)
Tell whether relative difference of this JMLDouble and the arg is
within the given epsilon. |
Object |
clone()
Return a clone of this object. |
int |
compareTo(non_null Object op2)
Compare this to op2, returning a comparison code. |
JMLDouble |
dividedBy(non_null JMLDouble d2)
Return the quotient of this divided by the given argument. |
double |
doubleValue()
Return the double contained in this object. |
boolean |
equals(nullable Object op2)
Tell whether this object is equal to the argument. |
Double |
getDouble()
Return a Double containing the double contained in this object. |
boolean |
greaterThan(non_null JMLDouble d2)
Tell whether this is strictly greater than the given argument. |
boolean |
greaterThanOrEqualTo(non_null JMLDouble d2)
Tell whether this is greater than or equal to the given argument. |
int |
hashCode()
Return a hash code for this object. |
boolean |
isInfinite()
Tell if this object contains either positive or negative infinity. |
boolean |
isNaN()
Tell if this object contains NaN (not a number). |
boolean |
isZero()
Tell if this object contains zero (either positive or negative). |
static boolean |
isZero(double d)
Tell if the argument is zero (either positive or negative). |
boolean |
lessThan(non_null JMLDouble d2)
Tell whether this is strictly less than the given argument. |
boolean |
lessThanOrEqualTo(non_null JMLDouble d2)
Tell whether this is less than or equal to the given argument. |
JMLDouble |
minus(non_null JMLDouble d2)
Return the difference between this and the given argument. |
JMLDouble |
negated()
Return the negation of this. |
JMLDouble |
plus(non_null JMLDouble d2)
Return the sum of this and the given argument. |
JMLDouble |
remainderBy(non_null JMLDouble d2)
Return the remainder of this divided by the given argument. |
JMLDouble |
times(non_null JMLDouble d2)
Return the product of this and the given argument. |
String |
toString()
Return a string representation of this object. |
boolean |
withinEpsilonOf(double d2,
double epsilon)
Tell whether absolute value of difference of this JMLDouble and the arg
is within the given epsilon. |
static boolean |
withinEpsilonOf(double d1,
double d2,
double epsilon)
Tell whether absolute value of difference of the two arguments
is within the given epsilon. |
boolean |
withinEpsilonOf(non_null Double d2,
double epsilon)
Tell whether absolute value of difference of this JMLDouble and the arg
is within the given epsilon. |
boolean |
withinEpsilonOf(non_null JMLDouble d2,
double epsilon)
Tell whether absolute value of difference of this JMLDouble and the arg
is within the given epsilon. |
static boolean |
withinEpsilonOf(non_null JMLDouble d1,
double d2,
double epsilon)
Tell whether absolute value of difference of this JMLDouble and the arg
is within the given epsilon. |
static boolean |
withinEpsilonOf(non_null JMLDouble d1,
non_null Double d2,
double epsilon)
Tell whether absolute value of difference of this JMLDouble and the arg
is within the given epsilon. |
static boolean |
withinEpsilonOf(non_null JMLDouble d1,
non_null JMLDouble d2,
double epsilon)
Tell whether absolute value of difference of this JMLDouble and the arg
is within the given epsilon. |
theDouble
public double theDouble
- The double that is the abstract value of this object.
- Specifications:
datagroup contains: doubleValue
doubleValue
private double doubleValue
- Specifications: spec_public
is in groups: theDouble
JMLDouble
public JMLDouble()
- Initialize this object to contain zero.
- Specifications: (class)pure
-
public normal_behavior
assignable theDouble, owner;
ensures this.theDouble == 0.0;
JMLDouble
public JMLDouble(double inDouble)
- Initialize this object to contain the given double.
- Specifications: (class)pure
-
public normal_behavior
requires !java.lang.Double.isNaN(inDouble);
assignable theDouble, owner;
ensures this.theDouble == inDouble;
- also
-
public normal_behavior
requires java.lang.Double.isNaN(inDouble);
assignable theDouble, owner;
ensures java.lang.Double.isNaN(this.theDouble);
JMLDouble
public JMLDouble(int inInt)
- Initialize this object to contain an approximation to the
given integer.
- Specifications: (class)pure
-
public normal_behavior
assignable theDouble, owner;
ensures this.theDouble == inInt;
JMLDouble
public JMLDouble(non_null Double inDouble)
- Initialize this object to contain the value of the given
Double.
- Specifications: (class)pure
-
public normal_behavior
requires inDouble != null&&!inDouble.isNaN();
assignable theDouble, owner;
ensures this.theDouble == inDouble.doubleValue();
- also
-
public normal_behavior
requires inDouble != null&&inDouble.isNaN();
assignable theDouble;
ensures java.lang.Double.isNaN(this.theDouble);
JMLDouble
public JMLDouble(non_null String s)
throws NumberFormatException
- Initialize this object to contain the value given by the
string argument.
- Throws:
NumberFormatException
- Specifications: (class)pure
-
public behavior
requires s != null;
assignable theDouble, owner;
ensures (* s is a parseable string that has the format of a double precision floating point literal *)&&this.theDouble == new java.lang.Double(s).doubleValue();
signals_only java.lang.NumberFormatException;
signals (java.lang.NumberFormatException) !(* s is a parseable string that has the format of a double precision floating point literal *);
isInfinite
public boolean isInfinite()
- Tell if this object contains either positive or negative infinity.
- Specifications: (class)pure
-
public normal_behavior
ensures \result <==> (this.theDouble == Infinity)||(this.theDouble == -Infinity);
isNaN
public boolean isNaN()
- Tell if this object contains NaN (not a number).
- Specifications: (class)pure
-
public normal_behavior
ensures \result <==> (this.theDouble != this.theDouble);
clone
public Object clone()
- Return a clone of this object.
- Specified by:
clone
in interface JMLType
- Overrides:
clone
in class Object
- Specifications: (class)pure
- also
-
public normal_behavior
requires !java.lang.Double.isNaN(this.theDouble);
ensures \result != null&&\result instanceof org.jmlspecs.models.JMLDouble&&((org.jmlspecs.models.JMLDouble)\result ).theDouble == this.theDouble;
- also
-
public normal_behavior
requires java.lang.Double.isNaN(this.theDouble);
ensures \result != null&&\result instanceof org.jmlspecs.models.JMLDouble&&((org.jmlspecs.models.JMLDouble)\result ).isNaN();
- Specifications inherited from overridden method in class Object:
non_null -
protected normal_behavior
requires this instanceof java.lang.Cloneable;
assignable \nothing;
ensures \result != null;
ensures \typeof(\result ) == \typeof(this);
ensures (* \result is a clone of this *);
- also
-
protected normal_behavior
requires this.getClass().isArray();
assignable \nothing;
ensures \elemtype(\typeof(\result )) == \elemtype(\typeof(this));
ensures ((java.lang.Object[])\result ).length == ((java.lang.Object[])this).length;
ensures ( \forall int i; 0 <= i&&i < ((java.lang.Object[])this).length; ((java.lang.Object[])\result )[i] == ((java.lang.Object[])this)[i]);
- also
-
requires this.getClass().isArray();
assignable \nothing;
ensures \elemtype(\typeof(\result )) == \elemtype(\typeof(this));
ensures java.lang.reflect.Array.getLength(\result ) == java.lang.reflect.Array.getLength(this);
ensures ( \forall int i; 0 <= i&&i < java.lang.reflect.Array.getLength(this); ( \exists java.lang.Object result_i; result_i == java.lang.reflect.Array.get(\result ,i); (result_i == null&&java.lang.reflect.Array.get(this,i) == null)||(result_i != null&&result_i.equals(java.lang.reflect.Array.get(this,i)))));
- also
-
protected exceptional_behavior
requires !(this instanceof java.lang.Cloneable);
assignable \nothing;
signals_only java.lang.CloneNotSupportedException;
- also
-
protected normal_behavior
requires \elemtype(\typeof(this)) <: \type(java.lang.Object);
assignable \nothing;
ensures \elemtype(\typeof(\result )) == \elemtype(\typeof(this));
ensures ((java.lang.Object[])\result ).length == ((java.lang.Object[])this).length;
ensures ( \forall int i; 0 <= i&&i < ((java.lang.Object[])this).length; ((java.lang.Object[])\result )[i] == ((java.lang.Object[])this)[i]);
- also
-
protected normal_behavior
requires \elemtype(\typeof(this)) == \type(int);
assignable \nothing;
ensures \elemtype(\typeof(\result )) == \elemtype(\typeof(this));
ensures ((int[])\result ).length == ((int[])this).length;
ensures ( \forall int i; 0 <= i&&i < ((int[])this).length; ((int[])\result )[i] == ((int[])this)[i]);
- also
-
protected normal_behavior
requires \elemtype(\typeof(this)) == \type(byte);
assignable \nothing;
ensures \elemtype(\typeof(\result )) == \elemtype(\typeof(this));
ensures ((byte[])\result ).length == ((byte[])this).length;
ensures ( \forall int i; 0 <= i&&i < ((byte[])this).length; ((byte[])\result )[i] == ((byte[])this)[i]);
- also
-
protected normal_behavior
requires \elemtype(\typeof(this)) == \type(char);
assignable \nothing;
ensures \elemtype(\typeof(\result )) == \elemtype(\typeof(this));
ensures ((char[])\result ).length == ((char[])this).length;
ensures ( \forall int i; 0 <= i&&i < ((char[])this).length; ((char[])\result )[i] == ((char[])this)[i]);
- also
-
protected normal_behavior
requires \elemtype(\typeof(this)) == \type(long);
assignable \nothing;
ensures \elemtype(\typeof(\result )) == \elemtype(\typeof(this));
ensures ((long[])\result ).length == ((long[])this).length;
ensures ( \forall int i; 0 <= i&&i < ((long[])this).length; ((long[])\result )[i] == ((long[])this)[i]);
- also
-
protected normal_behavior
requires \elemtype(\typeof(this)) == \type(short);
assignable \nothing;
ensures \elemtype(\typeof(\result )) == \elemtype(\typeof(this));
ensures ((short[])\result ).length == ((short[])this).length;
ensures ( \forall int i; 0 <= i&&i < ((short[])this).length; ((short[])\result )[i] == ((short[])this)[i]);
- also
-
protected normal_behavior
requires \elemtype(\typeof(this)) == \type(boolean);
assignable \nothing;
ensures \elemtype(\typeof(\result )) == \elemtype(\typeof(this));
ensures ((boolean[])\result ).length == ((boolean[])this).length;
ensures ( \forall int i; 0 <= i&&i < ((boolean[])this).length; ((boolean[])\result )[i] == ((boolean[])this)[i]);
- also
-
protected normal_behavior
requires \elemtype(\typeof(this)) == \type(float);
assignable \nothing;
ensures \elemtype(\typeof(\result )) == \elemtype(\typeof(this));
ensures ((float[])\result ).length == ((float[])this).length;
ensures ( \forall int i; 0 <= i&&i < ((float[])this).length; (java.lang.Float.isNaN(((float[])\result )[i])&&java.lang.Float.isNaN(((float[])this)[i]))||((float[])\result )[i] == ((float[])this)[i]);
- also
-
protected normal_behavior
requires \elemtype(\typeof(this)) == \type(double);
assignable \nothing;
ensures \elemtype(\typeof(\result )) == \elemtype(\typeof(this));
ensures ((double[])\result ).length == ((double[])this).length;
ensures ( \forall int i; 0 <= i&&i < ((double[])this).length; (java.lang.Double.isNaN(((double[])\result )[i])&&java.lang.Double.isNaN(((double[])this)[i]))||((double[])\result )[i] == ((double[])this)[i]);
- Specifications inherited from overridden method in interface JMLType:
pure- also
-
public normal_behavior
ensures \result != null;
ensures \result instanceof org.jmlspecs.models.JMLType;
ensures ((org.jmlspecs.models.JMLType)\result ).equals(this);
- implies_that
-
ensures \result != null&&\typeof(\result ) <: \type(org.jmlspecs.models.JMLType);
compareTo
public int compareTo(non_null Object op2)
throws ClassCastException
- Compare this to op2, returning a comparison code.
- Specified by:
compareTo
in interface JMLComparable
- Parameters:
op2
- the object this is compared to.
- Throws:
ClassCastException
- when o is not a JMLDouble.
- Specifications: (class)pure
- Specifications inherited from overridden method compareTo(Object o) in interface JMLComparable:
(class)pure- also
-
public behavior
requires o != null;
ensures (* o is an instance of a comparable class *);
ensures (* if this is equal to o, then \result is 0 *)&&(* if this is less than o, then \result is negative *)&&(* if this is greater than o, then \result is positive *);
signals_only java.lang.ClassCastException;
signals (java.lang.ClassCastException) (* o is not an instance of a comparable class *);
- Specifications inherited from overridden method compareTo(Object o) in interface Comparable:
pure -
public behavior
requires o != null;
ensures (* \result is negative if this is "less than" o *);
ensures (* \result is 0 if this is "equal to" o *);
ensures (* \result is positive if this is "greater than" o *);
signals_only java.lang.ClassCastException;
signals (java.lang.ClassCastException) (* the class of o prohibits it from being compared to this *);
- also
-
public behavior
requires o != null&&o instanceof java.lang.Comparable;
ensures this.definedComparison((java.lang.Comparable)o,this);
ensures o == this ==> \result == 0;
ensures this.sgn(\result ) == -this.sgn(((java.lang.Comparable)o).compareTo(this));
signals (java.lang.ClassCastException) !this.definedComparison((java.lang.Comparable)o,this);
isZero
public static boolean isZero(double d)
- Tell if the argument is zero (either positive or negative).
- Specifications: pure
-
public normal_behavior
ensures \result <==> (d == 0.0||d == -0.0);
isZero
public boolean isZero()
- Tell if this object contains zero (either positive or negative).
- Specifications: (class)pure
-
public normal_behavior
ensures \result <==> (this.theDouble == 0.0||this.theDouble == -0.0);
equals
public boolean equals(nullable Object op2)
- Tell whether this object is equal to the argument.
- Specified by:
equals
in interface JMLType
- Overrides:
equals
in class Object
- Specifications: (class)pure
- also
-
public normal_behavior
requires (op2 instanceof org.jmlspecs.models.JMLDouble)&&op2 != null;
{|-
requires !java.lang.Double.isNaN(this.theDouble)&&!this.isZero();
ensures \result <==> this.theDouble == ((org.jmlspecs.models.JMLDouble)op2).theDouble;
- also
-
requires java.lang.Double.isNaN(this.theDouble);
ensures \result <==> java.lang.Double.isNaN(((org.jmlspecs.models.JMLDouble)op2).theDouble);
- also
-
requires this.isZero();
ensures \result <==> ((org.jmlspecs.models.JMLDouble)op2).isZero();
- |}
- also
-
public normal_behavior
requires !(op2 instanceof org.jmlspecs.models.JMLDouble)||op2 == null;
ensures \result <==> false;
- Specifications inherited from overridden method equals(Object obj) in class Object:
pure -
public normal_behavior
requires obj != null;
ensures (* \result is true when obj is "equal to" this object *);
- also
-
public normal_behavior
requires this == obj;
ensures \result ;
- also
-
public code normal_behavior
requires obj != null;
ensures \result <==> this == obj;
- also
-
diverges false;
ensures obj == null ==> !\result ;
- Specifications inherited from overridden method equals(Object ob2) in interface JMLType:
pure- also
-
public normal_behavior
ensures \result ==> ob2 != null&&(* ob2 is not distinguishable from this, except by using mutation or == *);
- implies_that
-
public normal_behavior
{|-
requires ob2 != null&&ob2 instanceof org.jmlspecs.models.JMLType;
ensures ((org.jmlspecs.models.JMLType)ob2).equals(this) == \result ;
- also
-
requires ob2 == this;
ensures \result <==> true;
- |}
hashCode
public int hashCode()
- Return a hash code for this object.
- Specified by:
hashCode
in interface JMLType
- Overrides:
hashCode
in class Object
- Specifications: (class)pure
- Specifications inherited from overridden method in class Object:
-
public behavior
assignable objectState;
ensures (* \result is a hash code for this object *);
- also
-
public code normal_behavior
assignable \nothing;
- Specifications inherited from overridden method in interface JMLType:
pure
doubleValue
public double doubleValue()
- Return the double contained in this object.
- Specifications: (class)pure
-
public normal_behavior
requires !this.isNaN();
ensures \result == this.doubleValue;
- also
-
requires this.isNaN();
ensures java.lang.Double.isNaN(\result );
getDouble
public Double getDouble()
- Return a Double containing the double contained in this object.
- Specifications: non_null (class)pure
-
public normal_behavior
ensures \result != null;
ensures !this.isNaN() ==> this.theDouble == \result .doubleValue();
ensures this.isNaN() ==> \result .isNaN();
negated
public JMLDouble negated()
- Return the negation of this.
- Specifications: non_null (class)pure
-
public normal_behavior
ensures \result != null;
ensures \result .equals(new org.jmlspecs.models.JMLDouble(-this.theDouble));
plus
public JMLDouble plus(non_null JMLDouble d2)
- Return the sum of this and the given argument.
- Specifications: non_null (class)pure
-
public normal_behavior
requires d2 != null;
ensures \result != null;
ensures \result .equals(new org.jmlspecs.models.JMLDouble(this.theDouble+d2.theDouble));
minus
public JMLDouble minus(non_null JMLDouble d2)
- Return the difference between this and the given argument.
- Specifications: non_null (class)pure
-
public normal_behavior
requires d2 != null;
ensures \result != null;
ensures \result .equals(new org.jmlspecs.models.JMLDouble(this.theDouble-d2.theDouble));
times
public JMLDouble times(non_null JMLDouble d2)
- Return the product of this and the given argument.
- Specifications: non_null (class)pure
-
public normal_behavior
requires d2 != null;
ensures \result != null&&\result .equals(new org.jmlspecs.models.JMLDouble(this.theDouble*d2.theDouble));
- implies_that
-
public normal_behavior
requires d2 != null;
requires d2.isNaN()||(this.isZero()&&d2.isInfinite())||(d2.isZero()&&this.isInfinite());
ensures \result != null&&\result .isNaN();
dividedBy
public JMLDouble dividedBy(non_null JMLDouble d2)
- Return the quotient of this divided by the given argument.
- Specifications: non_null (class)pure
-
public normal_behavior
requires d2 != null;
ensures \result != null&&\result .equals(new org.jmlspecs.models.JMLDouble(this.theDouble/d2.theDouble));
- implies_that
-
public normal_behavior
requires d2 != null;
requires d2.isZero()||d2.isNaN();
ensures \result != null&&\result .isNaN();
remainderBy
public JMLDouble remainderBy(non_null JMLDouble d2)
- Return the remainder of this divided by the given argument.
- Specifications: non_null (class)pure
-
public normal_behavior
requires d2 != null;
ensures \result != null&&\result .equals(new org.jmlspecs.models.JMLDouble(this.theDouble%d2.theDouble));
- implies_that
-
public normal_behavior
requires d2 != null;
requires d2.isZero()||d2.isNaN();
ensures \result != null&&\result .isNaN();
greaterThan
public boolean greaterThan(non_null JMLDouble d2)
- Tell whether this is strictly greater than the given argument.
- Specifications: (class)pure
-
public normal_behavior
requires d2 != null;
ensures \result <==> this.theDouble > d2.theDouble;
lessThan
public boolean lessThan(non_null JMLDouble d2)
- Tell whether this is strictly less than the given argument.
- Specifications: (class)pure
-
public normal_behavior
requires d2 != null;
ensures \result <==> this.theDouble < d2.theDouble;
greaterThanOrEqualTo
public boolean greaterThanOrEqualTo(non_null JMLDouble d2)
- Tell whether this is greater than or equal to the given argument.
- Specifications: (class)pure
-
public normal_behavior
requires d2 != null;
ensures \result <==> this.theDouble >= d2.theDouble;
lessThanOrEqualTo
public boolean lessThanOrEqualTo(non_null JMLDouble d2)
- Tell whether this is less than or equal to the given argument.
- Specifications: (class)pure
-
public normal_behavior
requires d2 != null;
ensures \result <==> this.theDouble <= d2.theDouble;
toString
public String toString()
- Return a string representation of this object.
- Overrides:
toString
in class Object
- Specifications: (class)pure
- Specifications inherited from overridden method in class Object:
non_null -
public normal_behavior
assignable objectState;
ensures \result != null&&\result .equals(this.theString);
ensures (* \result is a string representation of this object *);
- also
-
public code normal_behavior
assignable \nothing;
ensures \result != null&&(* \result is the instance's class name, followed by an @, followed by the instance's hashcode in hex *);
- also
-
public code model_program { ... }
- implies_that
-
assignable objectState;
ensures \result != null;
withinEpsilonOf
public boolean withinEpsilonOf(non_null JMLDouble d2,
double epsilon)
- Tell whether absolute value of difference of this JMLDouble and the arg
is within the given epsilon.
- Specifications: (class)pure
-
public normal_behavior
requires d2 != null;
assignable \nothing;
ensures \result <==> java.lang.StrictMath.abs(this.theDouble-d2.theDouble) <= epsilon;
approximatelyEqualTo
public boolean approximatelyEqualTo(non_null JMLDouble d2,
double epsilon)
- Tell whether relative difference of this JMLDouble and the arg is
within the given epsilon.
- See Also:
approximatelyEqualTo(double, double, double)
- Specifications: (class)pure
-
public normal_behavior
requires d2 != null;
assignable \nothing;
ensures \result <==> approximatelyEqualTo(this.theDouble,d2.theDouble,epsilon);
withinEpsilonOf
public boolean withinEpsilonOf(non_null Double d2,
double epsilon)
- Tell whether absolute value of difference of this JMLDouble and the arg
is within the given epsilon.
- Specifications: (class)pure
-
public normal_behavior
requires d2 != null;
assignable \nothing;
ensures \result <==> java.lang.StrictMath.abs(this.theDouble-d2.doubleValue()) <= epsilon;
approximatelyEqualTo
public boolean approximatelyEqualTo(non_null Double d2,
double epsilon)
- Tell whether relative difference of this JMLDouble and the arg is
within the given epsilon.
- See Also:
approximatelyEqualTo(double, double, double)
- Specifications: (class)pure
-
public normal_behavior
requires d2 != null;
assignable \nothing;
ensures \result <==> approximatelyEqualTo(this.theDouble,d2.doubleValue(),epsilon);
withinEpsilonOf
public boolean withinEpsilonOf(double d2,
double epsilon)
- Tell whether absolute value of difference of this JMLDouble and the arg
is within the given epsilon.
- Specifications: (class)pure
-
public normal_behavior
assignable \nothing;
ensures \result <==> java.lang.StrictMath.abs(this.theDouble-d2) <= epsilon;
approximatelyEqualTo
public boolean approximatelyEqualTo(double d2,
double epsilon)
- Tell whether relative difference of this JMLDouble and the arg is
within the given epsilon.
- See Also:
approximatelyEqualTo(double, double, double)
- Specifications: (class)pure
-
public normal_behavior
assignable \nothing;
ensures \result <==> approximatelyEqualTo(this.theDouble,d2,epsilon);
withinEpsilonOf
public static boolean withinEpsilonOf(double d1,
double d2,
double epsilon)
- Tell whether absolute value of difference of the two arguments
is within the given epsilon.
- Specifications: pure
-
public normal_behavior
assignable \nothing;
ensures \result <==> java.lang.StrictMath.abs(d1-d2) <= epsilon;
approximatelyEqualTo
public static boolean approximatelyEqualTo(double d1,
double d2,
double epsilon)
- Tell whether relative difference of the two arguments is
within the given epsilon.
- Specifications: pure
-
public normal_behavior
assignable \nothing;
ensures \result <==> d1 == d2||java.lang.StrictMath.abs(d1-d2) <= java.lang.StrictMath.max(java.lang.StrictMath.abs(d1),java.lang.StrictMath.abs(d2))*epsilon;
withinEpsilonOf
public static boolean withinEpsilonOf(non_null JMLDouble d1,
non_null JMLDouble d2,
double epsilon)
- Tell whether absolute value of difference of this JMLDouble and the arg
is within the given epsilon.
- Specifications: pure
-
public normal_behavior
requires d1 != null&&d2 != null;
assignable \nothing;
ensures \result <==> java.lang.StrictMath.abs(d1.theDouble-d2.theDouble) <= epsilon;
approximatelyEqualTo
public static boolean approximatelyEqualTo(non_null JMLDouble d1,
non_null JMLDouble d2,
double epsilon)
- Tell whether relative difference of this JMLDouble and the arg is
within the given epsilon.
- See Also:
approximatelyEqualTo(double, double, double)
- Specifications: pure
-
public normal_behavior
requires d1 != null&&d2 != null;
assignable \nothing;
ensures \result <==> approximatelyEqualTo(d1.theDouble,d2.theDouble,epsilon);
withinEpsilonOf
public static boolean withinEpsilonOf(non_null JMLDouble d1,
non_null Double d2,
double epsilon)
- Tell whether absolute value of difference of this JMLDouble and the arg
is within the given epsilon.
- Specifications: pure
-
public normal_behavior
requires d1 != null&&d2 != null;
assignable \nothing;
ensures \result <==> java.lang.StrictMath.abs(d1.theDouble-d2.doubleValue()) <= epsilon;
approximatelyEqualTo
public static boolean approximatelyEqualTo(non_null JMLDouble d1,
non_null Double d2,
double epsilon)
- Tell whether relative difference of this JMLDouble and the arg is
within the given epsilon.
- See Also:
approximatelyEqualTo(double, double, double)
- Specifications: pure
-
public normal_behavior
requires d1 != null&&d2 != null;
assignable \nothing;
ensures \result <==> approximatelyEqualTo(d1.theDouble,d2.doubleValue(),epsilon);
withinEpsilonOf
public static boolean withinEpsilonOf(non_null JMLDouble d1,
double d2,
double epsilon)
- Tell whether absolute value of difference of this JMLDouble and the arg
is within the given epsilon.
- Specifications: pure
-
public normal_behavior
requires d1 != null;
assignable \nothing;
ensures \result <==> java.lang.StrictMath.abs(d1.theDouble-d2) <= epsilon;
approximatelyEqualTo
public static boolean approximatelyEqualTo(non_null JMLDouble d1,
double d2,
double epsilon)
- Tell whether relative difference of this JMLDouble and the arg is
within the given epsilon.
- See Also:
approximatelyEqualTo(double, double, double)
- Specifications: pure
-
public normal_behavior
requires d1 != null;
assignable \nothing;
ensures \result <==> approximatelyEqualTo(d1.theDouble,d2,epsilon);
JML is Copyright (C) 1998-2002 by Iowa State University and is distributed under the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. This release depends on code from the MultiJava project and is based in part on the Kopi project Copyright (C) 1990-99 DMS Decision Management Systems Ges.m.b.H.