From 38cc72ffe7580904dd8b73afa6dd12fe9a08db8c Mon Sep 17 00:00:00 2001 From: Thomas Bruderer Date: Thu, 7 Jan 2021 14:56:26 +0100 Subject: [PATCH] Use canonical name CopySign --- Funcky.Money/Distribution/DefaultDistributionStrategy.cs | 2 +- Funcky.Money/Extensions/SignExtension.cs | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/Funcky.Money/Distribution/DefaultDistributionStrategy.cs b/Funcky.Money/Distribution/DefaultDistributionStrategy.cs index b42f34f..516c9ac 100644 --- a/Funcky.Money/Distribution/DefaultDistributionStrategy.cs +++ b/Funcky.Money/Distribution/DefaultDistributionStrategy.cs @@ -65,7 +65,7 @@ private static decimal ExactSlice(MoneyDistribution distribution, int index, Mon => money.Amount / DistributionTotal(distribution) * distribution.Factors[index]; private decimal SignedPrecision(MoneyDistribution distribution, Money money) - => Precision(distribution, money).WithSignFrom(money.Amount); + => Precision(distribution, money).CopySign(money.Amount); // Order of evaluation: Distribution > Context Distribution > Context Currency > Money Currency private decimal Precision(MoneyDistribution distribution, Money money) diff --git a/Funcky.Money/Extensions/SignExtension.cs b/Funcky.Money/Extensions/SignExtension.cs index 45bda0b..6bb614c 100644 --- a/Funcky.Money/Extensions/SignExtension.cs +++ b/Funcky.Money/Extensions/SignExtension.cs @@ -2,7 +2,7 @@ namespace Funcky.Extensions { internal static class SignExtension { - public static decimal WithSignFrom(this decimal positiveNumber, decimal signSource) + public static decimal CopySign(this decimal positiveNumber, decimal signSource) => signSource switch { < 0 => -positiveNumber,