Float IsInteger
This commit is contained in:
parent
cd25b5b35c
commit
11e33c7140
@ -358,5 +358,16 @@ namespace MPIR.Tests.HugeFloatTests
|
||||
Assert.IsFalse(b.FitsUshort());
|
||||
}
|
||||
}
|
||||
|
||||
[TestMethod]
|
||||
public void FloatIsInteger()
|
||||
{
|
||||
using (var a = new HugeFloat("-233454059287409285742345.125"))
|
||||
{
|
||||
Assert.IsFalse(a.IsInteger());
|
||||
a.Value = a * 8;
|
||||
Assert.IsTrue(a.IsInteger());
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -1223,6 +1223,12 @@ namespace MPIR
|
||||
/// <returns>true if the value will fit in a short</returns>
|
||||
bool FitsUshort() { return MP(fits_ushort_p)(_value) != 0; }
|
||||
|
||||
/// <summary>
|
||||
/// Returns true if the source number is a whole integer.
|
||||
/// </summary>
|
||||
/// <returns>true if the value is an integer</returns>
|
||||
bool IsInteger() { return MP(integer_p)(_value) != 0; }
|
||||
|
||||
#pragma endregion
|
||||
|
||||
#pragma region IO
|
||||
|
Loading…
Reference in New Issue
Block a user