use CannyFastMath in various places even where it might not be any different
also update a bunch of packages clean up redundant YamlDotNet references
This commit is contained in:
@@ -18,6 +18,7 @@ https://docs.microsoft.com/en-us/visualstudio/msbuild/msbuild
|
||||
<Python Condition="'$(OS)'=='Windows_NT' Or '$(OS)'=='Windows'">py -3</Python>
|
||||
<ProjectGuid>{C899FCA4-7037-4E49-ABC2-44DE72487110}</ProjectGuid>
|
||||
<TargetFrameworkMoniker>.NETFramework, Version=v4.7.2</TargetFrameworkMoniker>
|
||||
<RestorePackages>false</RestorePackages>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup>
|
||||
<OutputType>Library</OutputType>
|
||||
|
||||
@@ -11,10 +11,10 @@
|
||||
</PropertyGroup>
|
||||
<Import Project="..\RobustToolbox\MSBuild\Robust.DefineConstants.targets" />
|
||||
<ItemGroup>
|
||||
<PackageReference Include="Nett" Version="0.13.0" />
|
||||
<PackageReference Include="Nett" Version="0.15.0" />
|
||||
<PackageReference Include="SixLabors.ImageSharp" Version="1.0.0-rc0002" />
|
||||
<PackageReference Include="SixLabors.ImageSharp.Drawing" Version="1.0.0-beta0009" />
|
||||
<PackageReference Include="YamlDotNet" Version="8.1.0" />
|
||||
<PackageReference Include="JetBrains.Annotations" Version="2020.1.0" PrivateAssets="All" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<ProjectReference Include="..\RobustToolbox\Lidgren.Network\Lidgren.Network.csproj" />
|
||||
|
||||
@@ -77,7 +77,7 @@ namespace Content.Client.GameObjects.Components.Power
|
||||
SolarControlConsoleBoundInterfaceState scc = (SolarControlConsoleBoundInterfaceState) state;
|
||||
_lastState = scc;
|
||||
_window.NotARadar.UpdateState(scc);
|
||||
_window.OutputPower.Text = ((int) Math.Floor(scc.OutputPower)).ToString();
|
||||
_window.OutputPower.Text = ((int) MathF.Floor(scc.OutputPower)).ToString();
|
||||
_window.SunAngle.Text = FormatAngle(scc.TowardsSun);
|
||||
UpdateField(_window.PanelRotation, FormatAngle(scc.Rotation));
|
||||
UpdateField(_window.PanelVelocity, FormatAngle(scc.AngularVelocity * 60));
|
||||
|
||||
@@ -12,6 +12,9 @@ using SixLabors.ImageSharp;
|
||||
using SixLabors.ImageSharp.Advanced;
|
||||
using SixLabors.ImageSharp.PixelFormats;
|
||||
using Color = Robust.Shared.Maths.Color;
|
||||
using CannyFastMath;
|
||||
using Math = CannyFastMath.Math;
|
||||
using MathF = CannyFastMath.MathF;
|
||||
|
||||
namespace Content.Client.Parallax
|
||||
{
|
||||
@@ -78,7 +81,7 @@ namespace Content.Client.Parallax
|
||||
private readonly NoiseGenerator.NoiseType NoiseType = NoiseGenerator.NoiseType.Fbm;
|
||||
private readonly uint Seed = 1234;
|
||||
private readonly float Persistence = 0.5f;
|
||||
private readonly float Lacunarity = (float) (Math.PI * 2 / 3);
|
||||
private readonly float Lacunarity = (float) (Math.TAU / 3);
|
||||
private readonly float Frequency = 1;
|
||||
private readonly uint Octaves = 3;
|
||||
private readonly float Threshold;
|
||||
@@ -179,12 +182,12 @@ namespace Content.Client.Parallax
|
||||
for (var x = 0; x < bitmap.Width; x++)
|
||||
{
|
||||
// Do noise calculations.
|
||||
var noiseVal = Math.Min(1, Math.Max(0, (noise.GetNoiseTiled(x, y) + 1) / 2));
|
||||
var noiseVal = MathF.Min(1, MathF.Max(0, (noise.GetNoiseTiled(x, y) + 1) / 2));
|
||||
|
||||
// Threshold
|
||||
noiseVal = Math.Max(0, noiseVal - Threshold);
|
||||
noiseVal = MathF.Max(0, noiseVal - Threshold);
|
||||
noiseVal *= threshVal;
|
||||
noiseVal = (float) Math.Pow(noiseVal, powFactor);
|
||||
noiseVal = (float) MathF.Pow(noiseVal, powFactor);
|
||||
|
||||
// Get colors based on noise values.
|
||||
var srcColor = Color.InterpolateBetween(OuterColor, InnerColor, noiseVal)
|
||||
@@ -215,7 +218,7 @@ namespace Content.Client.Parallax
|
||||
private readonly NoiseGenerator.NoiseType MaskNoiseType = NoiseGenerator.NoiseType.Fbm;
|
||||
private readonly uint MaskSeed = 1234;
|
||||
private readonly float MaskPersistence = 0.5f;
|
||||
private readonly float MaskLacunarity = (float) Math.PI * 2 / 3;
|
||||
private readonly float MaskLacunarity = (float) (Math.PI * 2 / 3);
|
||||
private readonly float MaskFrequency = 1;
|
||||
private readonly uint MaskOctaves = 3;
|
||||
private readonly float MaskThreshold;
|
||||
@@ -406,11 +409,11 @@ namespace Content.Client.Parallax
|
||||
var y = random.Next(0, buffer.Height);
|
||||
|
||||
// Grab noise at this point.
|
||||
var noiseVal = Math.Min(1, Math.Max(0, (noise.GetNoiseTiled(x, y) + 1) / 2));
|
||||
var noiseVal = MathF.Min(1, MathF.Max(0, (noise.GetNoiseTiled(x, y) + 1) / 2));
|
||||
// Threshold
|
||||
noiseVal = Math.Max(0, noiseVal - MaskThreshold);
|
||||
noiseVal = MathF.Max(0, noiseVal - MaskThreshold);
|
||||
noiseVal *= threshVal;
|
||||
noiseVal = (float) Math.Pow(noiseVal, powFactor);
|
||||
noiseVal = (float) MathF.Pow(noiseVal, powFactor);
|
||||
|
||||
var randomThresh = random.NextFloat();
|
||||
if (randomThresh > noiseVal)
|
||||
|
||||
@@ -18,6 +18,9 @@ using Robust.Shared.Localization;
|
||||
using Robust.Shared.Prototypes;
|
||||
using Robust.Shared.Timing;
|
||||
using Robust.Shared.ViewVariables;
|
||||
using CannyFastMath;
|
||||
using Math = CannyFastMath.Math;
|
||||
using MathF = CannyFastMath.MathF;
|
||||
|
||||
namespace Content.Client.State
|
||||
{
|
||||
|
||||
@@ -6,6 +6,9 @@ using System;
|
||||
using Robust.Client.Graphics.Shaders;
|
||||
using Robust.Shared.IoC;
|
||||
using Robust.Shared.Prototypes;
|
||||
using CannyFastMath;
|
||||
using Math = CannyFastMath.Math;
|
||||
using MathF = CannyFastMath.MathF;
|
||||
|
||||
namespace Robust.Client.UserInterface.Controls
|
||||
{
|
||||
@@ -33,7 +36,7 @@ namespace Robust.Client.UserInterface.Controls
|
||||
{
|
||||
Color color;
|
||||
|
||||
var lerp = 1f - Math.Abs(Progress); // for future bikeshedding purposes
|
||||
var lerp = 1f - MathF.Abs(Progress); // for future bikeshedding purposes
|
||||
|
||||
if (Progress >= 0f)
|
||||
{
|
||||
@@ -42,7 +45,7 @@ namespace Robust.Client.UserInterface.Controls
|
||||
}
|
||||
else
|
||||
{
|
||||
var alpha = Math.Clamp(0.5f * lerp, 0f, 0.5f);
|
||||
var alpha = MathF.Clamp(0.5f * lerp, 0f, 0.5f);
|
||||
color = new Color(1f, 1f, 1f, alpha);
|
||||
}
|
||||
|
||||
|
||||
@@ -18,7 +18,7 @@
|
||||
<PrivateAssets>all</PrivateAssets>
|
||||
</PackageReference>
|
||||
<PackageReference Include="Microsoft.EntityFrameworkCore.Sqlite" Version="3.1.0" />
|
||||
<PackageReference Include="Npgsql.EntityFrameworkCore.PostgreSQL" Version="3.1.0" />
|
||||
<PackageReference Include="Npgsql.EntityFrameworkCore.PostgreSQL" Version="3.1.4" />
|
||||
</ItemGroup>
|
||||
|
||||
</Project>
|
||||
|
||||
@@ -5,6 +5,9 @@ using Robust.Server.AI;
|
||||
using Robust.Shared.Interfaces.Timing;
|
||||
using Robust.Shared.IoC;
|
||||
using Robust.Shared.Utility;
|
||||
using CannyFastMath;
|
||||
using Math = CannyFastMath.Math;
|
||||
using MathF = CannyFastMath.MathF;
|
||||
|
||||
namespace Content.Server.AI
|
||||
{
|
||||
@@ -35,7 +38,7 @@ namespace Content.Server.AI
|
||||
{
|
||||
if(_timeMan.CurTime < _nextBark)
|
||||
return;
|
||||
|
||||
|
||||
var rngState = GenSeed();
|
||||
_nextBark = _timeMan.CurTime + MinimumDelay + TimeSpan.FromSeconds(Random01(ref rngState) * 10);
|
||||
|
||||
|
||||
@@ -214,7 +214,7 @@ namespace Content.Server.AI
|
||||
if(Random01(ref rngState) < 0.5f)
|
||||
return;
|
||||
|
||||
var pick = (int) Math.Round(Random01(ref rngState) * (_normalAssistantConversation.Count - 1));
|
||||
var pick = (int) MathF.Round(Random01(ref rngState) * (_normalAssistantConversation.Count - 1));
|
||||
_chatMan.EntitySay(SelfEntity, _normalAssistantConversation[pick]);
|
||||
}
|
||||
|
||||
|
||||
@@ -24,7 +24,7 @@ namespace Content.Server.Chemistry.Metabolism
|
||||
|
||||
void IExposeData.ExposeData(ObjectSerializer serializer)
|
||||
{
|
||||
serializer.DataField(ref _metabolismRate, "rate", ReagentUnit.New(1M));
|
||||
serializer.DataField(ref _metabolismRate, "rate", ReagentUnit.New(1.0));
|
||||
serializer.DataField(ref _nutritionFactor, "nutrimentFactor", 30.0f);
|
||||
}
|
||||
|
||||
@@ -36,7 +36,7 @@ namespace Content.Server.Chemistry.Metabolism
|
||||
hunger.UpdateFood(metabolismAmount.Float() * NutritionFactor);
|
||||
|
||||
//Return amount of reagent to be removed, remove reagent regardless of HungerComponent presence
|
||||
return metabolismAmount;
|
||||
return metabolismAmount;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -4,6 +4,9 @@ using Content.Server.GameObjects.Components.Chemistry;
|
||||
using Content.Shared.Interfaces;
|
||||
using Robust.Shared.Interfaces.GameObjects;
|
||||
using Robust.Shared.Serialization;
|
||||
using CannyFastMath;
|
||||
using Math = CannyFastMath.Math;
|
||||
using MathF = CannyFastMath.MathF;
|
||||
|
||||
namespace Content.Server.Chemistry.ReactionEffects
|
||||
{
|
||||
@@ -35,9 +38,9 @@ namespace Content.Server.Chemistry.ReactionEffects
|
||||
serializer.DataField(ref _maxScale, "maxScale", 1);
|
||||
}
|
||||
|
||||
public void React(IEntity solutionEntity, decimal intensity)
|
||||
public void React(IEntity solutionEntity, double intensity)
|
||||
{
|
||||
float floatIntensity = (float)intensity;
|
||||
float floatIntensity = (float)intensity;
|
||||
if (solutionEntity == null)
|
||||
return;
|
||||
if(!solutionEntity.TryGetComponent(out SolutionComponent solution))
|
||||
@@ -46,7 +49,7 @@ namespace Content.Server.Chemistry.ReactionEffects
|
||||
//Handle scaling
|
||||
if (_scaled)
|
||||
{
|
||||
floatIntensity = Math.Min(floatIntensity, _maxScale);
|
||||
floatIntensity = MathF.Min(floatIntensity, _maxScale);
|
||||
}
|
||||
else
|
||||
{
|
||||
@@ -54,10 +57,10 @@ namespace Content.Server.Chemistry.ReactionEffects
|
||||
}
|
||||
|
||||
//Calculate intensities
|
||||
int finalDevastationRange = (int)Math.Round(_devastationRange * floatIntensity);
|
||||
int finalHeavyImpactRange = (int)Math.Round(_heavyImpactRange * floatIntensity);
|
||||
int finalLightImpactRange = (int)Math.Round(_lightImpactRange * floatIntensity);
|
||||
int finalFlashRange = (int)Math.Round(_flashRange * floatIntensity);
|
||||
int finalDevastationRange = (int)MathF.Round(_devastationRange * floatIntensity);
|
||||
int finalHeavyImpactRange = (int)MathF.Round(_heavyImpactRange * floatIntensity);
|
||||
int finalLightImpactRange = (int)MathF.Round(_lightImpactRange * floatIntensity);
|
||||
int finalFlashRange = (int)MathF.Round(_flashRange * floatIntensity);
|
||||
ExplosionHelper.SpawnExplosion(solutionEntity.Transform.GridPosition, finalDevastationRange,
|
||||
finalHeavyImpactRange, finalLightImpactRange, finalFlashRange);
|
||||
}
|
||||
|
||||
@@ -13,7 +13,7 @@
|
||||
<Import Project="..\RobustToolbox\MSBuild\Robust.DefineConstants.targets" />
|
||||
<ItemGroup>
|
||||
<PackageReference Include="Microsoft.AspNetCore.Http.Abstractions" Version="2.2.0" />
|
||||
<PackageReference Include="YamlDotNet" Version="8.1.0" />
|
||||
<PackageReference Include="JetBrains.Annotations" Version="2020.1.0" PrivateAssets="All" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<ProjectReference Include="..\Content.Server.Database\Content.Server.Database.csproj" />
|
||||
|
||||
@@ -47,7 +47,7 @@ namespace Content.Server.GameObjects.Components.Chemistry
|
||||
public override void ExposeData(ObjectSerializer serializer)
|
||||
{
|
||||
base.ExposeData(serializer);
|
||||
serializer.DataField(ref _transferAmount, "transferAmount", ReagentUnit.New(5.0M));
|
||||
serializer.DataField(ref _transferAmount, "transferAmount", ReagentUnit.New(5.0));
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
|
||||
@@ -488,7 +488,7 @@ namespace Content.Server.GameObjects.Components.Chemistry
|
||||
//Trigger reaction effects
|
||||
foreach (var effect in reaction.Effects)
|
||||
{
|
||||
effect.React(Owner, unitReactions.Decimal());
|
||||
effect.React(Owner, unitReactions.Double());
|
||||
}
|
||||
|
||||
//Play reaction sound client-side
|
||||
|
||||
@@ -1,6 +1,9 @@
|
||||
using System;
|
||||
using Content.Shared.GameObjects.Components.Inventory;
|
||||
using Robust.Shared.GameObjects;
|
||||
using CannyFastMath;
|
||||
using Math = CannyFastMath.Math;
|
||||
using MathF = CannyFastMath.MathF;
|
||||
|
||||
namespace Content.Server.GameObjects
|
||||
{
|
||||
|
||||
@@ -21,6 +21,9 @@ using Robust.Shared.Maths;
|
||||
using Robust.Shared.Serialization;
|
||||
using Robust.Shared.ViewVariables;
|
||||
using Timer = Robust.Shared.Timers.Timer;
|
||||
using CannyFastMath;
|
||||
using Math = CannyFastMath.Math;
|
||||
using MathF = CannyFastMath.MathF;
|
||||
|
||||
namespace Content.Server.GameObjects.Components.Mobs
|
||||
{
|
||||
|
||||
@@ -15,6 +15,9 @@ using Robust.Shared.IoC;
|
||||
using Robust.Shared.Maths;
|
||||
using Robust.Shared.Serialization;
|
||||
using Robust.Shared.ViewVariables;
|
||||
using CannyFastMath;
|
||||
using Math = CannyFastMath.Math;
|
||||
using MathF = CannyFastMath.MathF;
|
||||
|
||||
namespace Content.Server.GameObjects.Components.Weapon.Melee
|
||||
{
|
||||
|
||||
@@ -12,6 +12,9 @@ using Robust.Shared.IoC;
|
||||
using Robust.Shared.Maths;
|
||||
using System;
|
||||
using System.Linq;
|
||||
using CannyFastMath;
|
||||
using Math = CannyFastMath.Math;
|
||||
using MathF = CannyFastMath.MathF;
|
||||
|
||||
namespace Content.Server.GameObjects.EntitySystems
|
||||
{
|
||||
@@ -77,7 +80,7 @@ namespace Content.Server.GameObjects.EntitySystems
|
||||
{
|
||||
EntityQuery = new TypeEntityQuery(typeof(SolarPanelComponent));
|
||||
// Initialize the sun to something random
|
||||
TowardsSun = Math.PI * 2 * _robustRandom.NextDouble();
|
||||
TowardsSun = Math.TAU * _robustRandom.NextDouble();
|
||||
SunAngularVelocity = Angle.FromDegrees(0.1 + ((_robustRandom.NextDouble() - 0.5) * 0.05));
|
||||
}
|
||||
|
||||
|
||||
@@ -8,6 +8,6 @@ namespace Content.Shared.Interfaces
|
||||
/// </summary>
|
||||
public interface IReactionEffect : IExposeData
|
||||
{
|
||||
void React(IEntity solutionEntity, decimal intensity);
|
||||
void React(IEntity solutionEntity, double intensity);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -13,6 +13,9 @@ using Robust.Shared.Physics;
|
||||
using Robust.Shared.Random;
|
||||
using System;
|
||||
using Robust.Shared.Interfaces.Physics;
|
||||
using CannyFastMath;
|
||||
using Math = CannyFastMath.Math;
|
||||
using MathF = CannyFastMath.MathF;
|
||||
|
||||
namespace Content.Server.Throw
|
||||
{
|
||||
@@ -146,7 +149,7 @@ namespace Content.Server.Throw
|
||||
var forceNecessary = impulseNecessary * (1f / timing.TickRate);
|
||||
|
||||
// Then clamp it to the max force allowed and call Throw().
|
||||
Throw(thrownEnt, Math.Min(forceNecessary, throwForceMax), targetLoc, sourceLoc, spread, throwSourceEnt);
|
||||
Throw(thrownEnt, MathF.Min(forceNecessary, throwForceMax), targetLoc, sourceLoc, spread, throwSourceEnt);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -10,8 +10,8 @@ namespace Content.Shared.Chemistry
|
||||
class DefaultMetabolizable : IMetabolizable
|
||||
{
|
||||
//Rate of metabolism in units / second
|
||||
private decimal _metabolismRate = 1;
|
||||
public decimal MetabolismRate => _metabolismRate;
|
||||
private double _metabolismRate = 1;
|
||||
public double MetabolismRate => _metabolismRate;
|
||||
|
||||
void IExposeData.ExposeData(ObjectSerializer serializer)
|
||||
{
|
||||
@@ -20,7 +20,7 @@ namespace Content.Shared.Chemistry
|
||||
|
||||
ReagentUnit IMetabolizable.Metabolize(IEntity solutionEntity, string reagentId, float tickTime)
|
||||
{
|
||||
return ReagentUnit.New(MetabolismRate * (decimal)tickTime);
|
||||
return ReagentUnit.New(MetabolismRate * tickTime);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -30,11 +30,6 @@ namespace Content.Shared.Chemistry
|
||||
return new ReagentUnit(value * (int) Math.Pow(10, Shift));
|
||||
}
|
||||
|
||||
public static ReagentUnit New(decimal value)
|
||||
{
|
||||
return new ReagentUnit((int) Math.Round(value * (decimal) Math.Pow(10, Shift), MidpointRounding.AwayFromZero));
|
||||
}
|
||||
|
||||
public static ReagentUnit New(float value)
|
||||
{
|
||||
return new ReagentUnit(FromFloat(value));
|
||||
@@ -42,7 +37,7 @@ namespace Content.Shared.Chemistry
|
||||
|
||||
private static int FromFloat(float value)
|
||||
{
|
||||
return (int) Math.Round(value * (float) Math.Pow(10, Shift), MidpointRounding.AwayFromZero);
|
||||
return (int) MathF.Round(value * MathF.Pow(10, Shift), MidpointRounding.AwayFromZero);
|
||||
}
|
||||
|
||||
public static ReagentUnit New(double value)
|
||||
@@ -83,12 +78,6 @@ namespace Content.Shared.Chemistry
|
||||
return New(aD * b);
|
||||
}
|
||||
|
||||
public static ReagentUnit operator *(ReagentUnit a, decimal b)
|
||||
{
|
||||
var aD = (decimal) a.ShiftDown();
|
||||
return New(aD * b);
|
||||
}
|
||||
|
||||
public static ReagentUnit operator *(ReagentUnit a, double b)
|
||||
{
|
||||
var aD = a.ShiftDown();
|
||||
@@ -166,11 +155,6 @@ namespace Content.Shared.Chemistry
|
||||
return (float) ShiftDown();
|
||||
}
|
||||
|
||||
public decimal Decimal()
|
||||
{
|
||||
return (decimal) ShiftDown();
|
||||
}
|
||||
|
||||
public double Double()
|
||||
{
|
||||
return ShiftDown();
|
||||
|
||||
@@ -136,7 +136,7 @@ namespace Content.Shared.Chemistry
|
||||
if(quantity <= 0)
|
||||
return;
|
||||
|
||||
var ratio = (TotalVolume - quantity).Decimal() / TotalVolume.Decimal();
|
||||
var ratio = (TotalVolume - quantity).Double() / TotalVolume.Double();
|
||||
|
||||
if (ratio <= 0)
|
||||
{
|
||||
@@ -180,13 +180,13 @@ namespace Content.Shared.Chemistry
|
||||
}
|
||||
|
||||
newSolution = new Solution();
|
||||
var newTotalVolume = ReagentUnit.New(0M);
|
||||
var newTotalVolume = ReagentUnit.New(0);
|
||||
var remainingVolume = TotalVolume;
|
||||
|
||||
for (var i = 0; i < _contents.Count; i++)
|
||||
{
|
||||
var reagent = _contents[i];
|
||||
var ratio = (remainingVolume - quantity).Decimal() / remainingVolume.Decimal();
|
||||
var ratio = (remainingVolume - quantity).Double() / remainingVolume.Double();
|
||||
remainingVolume -= reagent.Quantity;
|
||||
|
||||
var newQuantity = reagent.Quantity * ratio;
|
||||
|
||||
@@ -12,7 +12,7 @@
|
||||
</PropertyGroup>
|
||||
<Import Project="..\RobustToolbox\MSBuild\Robust.DefineConstants.targets" />
|
||||
<ItemGroup>
|
||||
<PackageReference Include="YamlDotNet" Version="8.1.0" />
|
||||
<PackageReference Include="JetBrains.Annotations" Version="2020.1.0" PrivateAssets="All" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<ProjectReference Include="..\RobustToolbox\Lidgren.Network\Lidgren.Network.csproj">
|
||||
|
||||
@@ -35,16 +35,6 @@ namespace Content.Tests.Shared.Chemistry
|
||||
Assert.AreEqual(expected, $"{result}");
|
||||
}
|
||||
|
||||
[Test]
|
||||
[TestCase("1.001", "1")]
|
||||
[TestCase("0.999", "1")]
|
||||
public void ReagentUnitDecimalTests(string valueAsString, string expected)
|
||||
{
|
||||
var value = decimal.Parse(valueAsString);
|
||||
var result = ReagentUnit.New(value);
|
||||
Assert.AreEqual(expected, $"{result}");
|
||||
}
|
||||
|
||||
[Test]
|
||||
[TestCase("1.005", "1.01")]
|
||||
[TestCase("0.999", "1")]
|
||||
@@ -116,7 +106,7 @@ namespace Content.Tests.Shared.Chemistry
|
||||
[TestCase(2.005f, 201)]
|
||||
public void FloatRoundingTest(float a, int expected)
|
||||
{
|
||||
var result = (int) Math.Round(a * (float) Math.Pow(10, 2), MidpointRounding.AwayFromZero);
|
||||
var result = (int) MathF.Round(a * (float) MathF.Pow(10, 2), MidpointRounding.AwayFromZero);
|
||||
Assert.AreEqual(expected, result);
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user