public void AmplitudeRatioToPowerRatio_75OhmImpedance(double dBmV, double expected) { AmplitudeRatio ampRatio = AmplitudeRatio.FromDecibelMillivolts(dBmV); double actual = Math.Round(ampRatio.ToPowerRatio(ElectricResistance.FromOhms(75)).DecibelMilliwatts, 2); Assert.Equal(expected, actual); }
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.FromDecibelMillivolts(double?)"/> public static AmplitudeRatio?DecibelMillivolts(this double?value) => AmplitudeRatio.FromDecibelMillivolts(value);
/// <inheritdoc cref="AmplitudeRatio.FromDecibelMillivolts(double)"/> public static AmplitudeRatio DecibelMillivolts(this long value) => AmplitudeRatio.FromDecibelMillivolts(value);
/// <inheritdoc cref="AmplitudeRatio.FromDecibelMillivolts(double?)"/> public static AmplitudeRatio?DecibelMillivolts(this decimal?value) => AmplitudeRatio.FromDecibelMillivolts(value == null ? (double?)null : Convert.ToDouble(value.Value));
/// <inheritdoc cref="AmplitudeRatio.FromDecibelMillivolts(double)"/> public static AmplitudeRatio DecibelMillivolts(this decimal value) => AmplitudeRatio.FromDecibelMillivolts(Convert.ToDouble(value));
public double AmplitudeRatioToPowerRatio_50OhmImpedance(double dBmV) { AmplitudeRatio ampRatio = AmplitudeRatio.FromDecibelMillivolts(dBmV); return(Math.Round(ampRatio.ToPowerRatio(ElectricResistance.FromOhms(50)).DecibelMilliwatts, 2)); }
public static AmplitudeRatio?DecibelMillivolts <T>(this T?value) where T : struct => AmplitudeRatio.FromDecibelMillivolts(value == null ? (double?)null : Convert.ToDouble(value.Value));
public static AmplitudeRatio DecibelMillivolts <T>(this T value) => AmplitudeRatio.FromDecibelMillivolts(Convert.ToDecimal(value));
public void NumberToDecibelMillivoltsTest() => Assert.Equal(AmplitudeRatio.FromDecibelMillivolts(2), 2.DecibelMillivolts());