aboutsummaryrefslogtreecommitdiffstats
path: root/Software/Visual_Studio/Tango.Core/ExtensionMethods
diff options
context:
space:
mode:
authorRoy Ben Shabat <Roy.mail.net@gmail.com>2024-09-02 06:41:16 +0300
committerRoy Ben Shabat <Roy.mail.net@gmail.com>2024-09-02 06:41:16 +0300
commitb2b4196d6f3bb007ae250a3e0648d1a5786d8dbf (patch)
tree7de10793cef1ad125febee72cbb29627461488dd /Software/Visual_Studio/Tango.Core/ExtensionMethods
parent0d22d909e6263692d61709f1baf5dd6f0b34806e (diff)
downloadTango-b2b4196d6f3bb007ae250a3e0648d1a5786d8dbf.tar.gz
Tango-b2b4196d6f3bb007ae250a3e0648d1a5786d8dbf.zip
Implemented a workaround for light inks rounding.
Diffstat (limited to 'Software/Visual_Studio/Tango.Core/ExtensionMethods')
-rw-r--r--Software/Visual_Studio/Tango.Core/ExtensionMethods/DoubleExtensions.cs22
1 files changed, 22 insertions, 0 deletions
diff --git a/Software/Visual_Studio/Tango.Core/ExtensionMethods/DoubleExtensions.cs b/Software/Visual_Studio/Tango.Core/ExtensionMethods/DoubleExtensions.cs
new file mode 100644
index 000000000..8ccab4d44
--- /dev/null
+++ b/Software/Visual_Studio/Tango.Core/ExtensionMethods/DoubleExtensions.cs
@@ -0,0 +1,22 @@
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+
+
+public static class DoubleExtensions
+{
+ /// <summary>
+ /// Replaces the decimal part of this value and returns a new value.
+ /// </summary>
+ /// <param name="value">The value.</param>
+ /// <param name="fromValue">The value to take the decimal part from.</param>
+ /// <returns></returns>
+ public static double ReplaceDecimalPart(this double value, double fromValue)
+ {
+ decimal right = (decimal)fromValue - Math.Truncate((decimal)fromValue);
+ double result = (double)(Decimal.Truncate((decimal)value) + right);
+ return result;
+ }
+}