public void ConversionRoundTrip() { AmplitudeRatio decibelvolt = AmplitudeRatio.FromDecibelVolts(1); Assert.AreEqual(1, AmplitudeRatio.FromDecibelMicrovolts(decibelvolt.DecibelMicrovolts).DecibelVolts, DecibelMicrovoltsTolerance); Assert.AreEqual(1, AmplitudeRatio.FromDecibelMillivolts(decibelvolt.DecibelMillivolts).DecibelVolts, DecibelMillivoltsTolerance); Assert.AreEqual(1, AmplitudeRatio.FromDecibelVolts(decibelvolt.DecibelVolts).DecibelVolts, DecibelVoltsTolerance); }
public void ConversionRoundTrip() { AmplitudeRatio decibelvolt = AmplitudeRatio.FromDecibelVolts(1); AssertEx.EqualTolerance(1, AmplitudeRatio.FromDecibelMicrovolts(decibelvolt.DecibelMicrovolts).DecibelVolts, DecibelMicrovoltsTolerance); AssertEx.EqualTolerance(1, AmplitudeRatio.FromDecibelMillivolts(decibelvolt.DecibelMillivolts).DecibelVolts, DecibelMillivoltsTolerance); AssertEx.EqualTolerance(1, AmplitudeRatio.FromDecibelsUnloaded(decibelvolt.DecibelsUnloaded).DecibelVolts, DecibelsUnloadedTolerance); AssertEx.EqualTolerance(1, AmplitudeRatio.FromDecibelVolts(decibelvolt.DecibelVolts).DecibelVolts, DecibelVoltsTolerance); }
/// <inheritdoc cref="AmplitudeRatio.FromDecibelMicrovolts(double?)"/> public static AmplitudeRatio?DecibelMicrovolts(this decimal?value) => AmplitudeRatio.FromDecibelMicrovolts(value == null ? (double?)null : Convert.ToDouble(value.Value));
/// <inheritdoc cref="AmplitudeRatio.FromDecibelMicrovolts(double)"/> public static AmplitudeRatio DecibelMicrovolts(this decimal value) => AmplitudeRatio.FromDecibelMicrovolts(Convert.ToDouble(value));
/// <inheritdoc cref="AmplitudeRatio.FromDecibelMicrovolts(double?)"/> public static AmplitudeRatio?DecibelMicrovolts(this float?value) => AmplitudeRatio.FromDecibelMicrovolts(value);
/// <inheritdoc cref="AmplitudeRatio.FromDecibelMicrovolts(double)"/> public static AmplitudeRatio DecibelMicrovolts(this double value) => AmplitudeRatio.FromDecibelMicrovolts(value);
public static AmplitudeRatio?DecibelMicrovolts <T>(this T?value) where T : struct => AmplitudeRatio.FromDecibelMicrovolts(value == null ? (double?)null : Convert.ToDouble(value.Value));
public static AmplitudeRatio DecibelMicrovolts <T>(this T value) => AmplitudeRatio.FromDecibelMicrovolts(Convert.ToDecimal(value));
public void NumberToDecibelMicrovoltsTest() => Assert.Equal(AmplitudeRatio.FromDecibelMicrovolts(2), 2.DecibelMicrovolts());