implement ldexp function for convenience
This commit is contained in:
parent
95495ac334
commit
035c6cdd58
@ -120,6 +120,7 @@
|
||||
<Compile Include="UserInterface\VerticalAlignment.cs" />
|
||||
<Compile Include="CustomSettingsProvider.cs" />
|
||||
<Compile Include="Settings\VersionSetting.cs" />
|
||||
<Compile Include="MathExtensions.cs" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<Folder Include="Logic\" />
|
||||
|
||||
27
MBS.Framework/MathExtensions.cs
Normal file
27
MBS.Framework/MathExtensions.cs
Normal file
@ -0,0 +1,27 @@
|
||||
using System;
|
||||
namespace MBS.Framework
|
||||
{
|
||||
public static class MathExtensions
|
||||
{
|
||||
/// <summary>
|
||||
/// Multiplies a floating point value x by the number 2 raised to the exp power.
|
||||
/// </summary>
|
||||
/// <returns>The ldexp.</returns>
|
||||
/// <param name="x">The x coordinate.</param>
|
||||
/// <param name="exp">Exp.</param>
|
||||
public static float ldexp(float x, int exp)
|
||||
{
|
||||
return (float)(x * Math.Pow(2, exp));
|
||||
}
|
||||
/// <summary>
|
||||
/// Multiplies a floating point value x by the number 2 raised to the exp power.
|
||||
/// </summary>
|
||||
/// <returns>The ldexp.</returns>
|
||||
/// <param name="x">The x coordinate.</param>
|
||||
/// <param name="exp">Exp.</param>
|
||||
public static double ldexp(double x, int exp)
|
||||
{
|
||||
return (x * Math.Pow(2, exp));
|
||||
}
|
||||
}
|
||||
}
|
||||
Loading…
x
Reference in New Issue
Block a user