public void Signbit() { Assert.IsFalse(ValueHelpers.Signbit(1.0)); Assert.IsTrue(ValueHelpers.Signbit(-1.0)); Assert.IsTrue(ValueHelpers.Signbit(float64NegativeZero)); Assert.IsFalse(ValueHelpers.Signbit(0.0)); }
public void Copysign() { Assert.AreEqual(42.0, ValueHelpers.Copysign(42.0, 1.0)); Assert.AreEqual(42.0, ValueHelpers.Copysign(-42.0, 1.0)); Assert.AreEqual(-42.0, ValueHelpers.Copysign(-42.0, -1.0)); Assert.AreEqual(42.0, ValueHelpers.Copysign(-42.0, 0.0)); Assert.AreEqual(-42.0, ValueHelpers.Copysign(-42.0, float64NegativeZero)); Assert.AreEqual(42.0, ValueHelpers.Copysign(-42.0, (double)Text.FloatLiteral.NaN(false))); Assert.AreEqual(-42.0, ValueHelpers.Copysign(-42.0, (double)Text.FloatLiteral.NaN(true))); }
/// <summary> /// Gets or sets a value in memory at a particular byte offset. /// </summary> /// <value>A value in memory.</value> public double this[uint offset] { get { return(ValueHelpers.ReinterpretAsFloat64(new LinearMemoryAsInt64(mem)[offset])); } set { var uintView = new LinearMemoryAsInt64(mem); uintView[offset] = ValueHelpers.ReinterpretAsInt64(value); } }
public float this[uint Offset] { get { return(ValueHelpers.ReinterpretAsFloat32(new LinearMemoryAsInt32(mem)[Offset])); } set { var uintView = new LinearMemoryAsInt32(mem); uintView[Offset] = ValueHelpers.ReinterpretAsInt32(value); } }
/// <summary> /// Evaluates an initializer expression. /// </summary> /// <param name="expression">The expression to evaluate.</param> /// <returns>The value obtained by evaluating the initializer expression.</returns> public T Evaluate <T>(InitializerExpression expression) { return((T)Evaluate(expression, ValueHelpers.ToWasmValueType <T>())); }
/// <summary> /// Evaluates an initializer expression. /// </summary> /// <param name="expression">The expression to evaluate.</param> /// <param name="resultType">The result type expected from the expression.</param> /// <returns>The value obtained by evaluating the initializer expression.</returns> public object Evaluate(InitializerExpression expression, Type resultType) { return(Evaluate(expression, ValueHelpers.ToWasmValueType(resultType))); }