Beispiel #1
0
 /// <summary>
 ///     Gets a <see cref="Timestamp"/> from the given
 ///     quantity of seconds.
 /// </summary>
 /// <param name="seconds">
 ///     The value in seconds.
 /// </param>
 /// <returns>
 ///     The <see cref="Timestamp"/>.
 /// </returns>
 public static Timestamp FromSeconds(double seconds)
 {
     return(new Timestamp(DoubleUtils.ClampToInt64(seconds * 1000000000)));
 }
Beispiel #2
0
 /// <summary>
 ///     Gets a <see cref="Timestamp"/> from the given
 ///     quantity of nanoseconds.
 /// </summary>
 /// <param name="nanoseconds">
 ///     The value in nanoseconds.
 /// </param>
 /// <returns>
 ///     The <see cref="Timestamp"/>.
 /// </returns>
 public static Timestamp FromNanoseconds(double nanoseconds)
 {
     return(new Timestamp(DoubleUtils.ClampToInt64(nanoseconds)));
 }
Beispiel #3
0
 /// <summary>
 /// GreaterThan - Returns whether or not the first double is greater than the second double.
 /// That is, whether or not the first is strictly greater than *and* not within epsilon of
 /// the other number.  Note that this epsilon is proportional to the numbers themselves
 /// to that AreClose survives scalar multiplication.  Note,
 /// There are plenty of ways for this to return false even for numbers which
 /// are theoretically identical, so no code calling this should fail to work if this
 /// returns false.  This is important enough to repeat:
 /// NB: NO CODE CALLING THIS FUNCTION SHOULD DEPEND ON ACCURATE RESULTS - this should be
 /// used for optimizations *only*.
 /// </summary>
 /// <returns>
 /// bool - the result of the GreaterThan comparison.
 /// </returns>
 /// <param name="value1"> The first double to compare. </param>
 /// <param name="value2"> The second double to compare. </param>
 public static bool GreaterThan(double value1, double value2)
 {
     return((value1 > value2) && !DoubleUtils.AreClose(value1, value2));
 }
 /// <summary>
 ///     Determines whether this range overlaps with the given range.
 ///     See <see cref="DoubleUtils.DoRangesOverlap"/> for more information.
 /// </summary>
 /// <param name="other">
 ///     The range to check.
 /// </param>
 /// <returns>
 ///     <c>true</c> if this instance overlaps with <paramref name="other"/>;
 ///     <c>false</c> otherwise.
 /// </returns>
 public bool Overlaps(DoubleRange other)
 {
     return(DoubleUtils.DoRangesOverlap(this.begin, this.end, other.begin, other.end));
 }
Beispiel #5
0
 /// <summary>
 /// LessThan - Returns whether or not the first double is less than the second double.
 /// That is, whether or not the first is strictly less than *and* not within epsilon of
 /// the other number.  Note that this epsilon is proportional to the numbers themselves
 /// to that AreClose survives scalar multiplication.  Note,
 /// There are plenty of ways for this to return false even for numbers which
 /// are theoretically identical, so no code calling this should fail to work if this
 /// returns false.  This is important enough to repeat:
 /// NB: NO CODE CALLING THIS FUNCTION SHOULD DEPEND ON ACCURATE RESULTS - this should be
 /// used for optimizations *only*.
 /// </summary>
 /// <returns>
 /// bool - the result of the LessThan comparison.
 /// </returns>
 /// <param name="value1"> The first double to compare. </param>
 /// <param name="value2"> The second double to compare. </param>
 public static bool LessThan(double value1, double value2)
 {
     return((value1 < value2) && !DoubleUtils.AreClose(value1, value2));
 }