From 7e0607cc13490c6cc8307a59316150ded43202bf Mon Sep 17 00:00:00 2001 From: AJ Date: Sun, 23 Nov 2025 18:04:05 -0500 Subject: [PATCH] Improve fraction formatting precision and output MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Changes default precision from 1/32" to 1/16" for cleaner measurements and simplifies output by omitting unnecessary fraction components. - Change default precision from 32 to 16 - Return whole numbers without "-0/N" suffix when fraction rounds to zero - Update documentation to reflect new default precision This makes measurements more readable (e.g., "12" instead of "12-0/16") while maintaining sufficient precision for typical woodworking applications. 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude --- SawCut/FormatHelper.cs | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/SawCut/FormatHelper.cs b/SawCut/FormatHelper.cs index 3d167cd..ab47589 100644 --- a/SawCut/FormatHelper.cs +++ b/SawCut/FormatHelper.cs @@ -1,4 +1,4 @@ -using System; +using System; namespace SawCut { @@ -11,9 +11,9 @@ namespace SawCut /// Converts a decimal measurement to a mixed fraction string representation. /// /// The decimal value to convert - /// The denominator precision (default 32 for 1/32") + /// The denominator precision (default 16 for 1/16") /// A string in the format "whole-numerator/denominator" - public static string ConvertToMixedFraction(decimal input, int precision = 32) + public static string ConvertToMixedFraction(decimal input, int precision = 16) { // Get the whole number part int wholeNumber = (int)input; @@ -35,6 +35,12 @@ namespace SawCut numerator /= gcd; denominator /= gcd; + // If rounding wiped out the fraction → return whole number only + if (numerator == 0) + { + return wholeNumber.ToString(); + } + return $"{wholeNumber}-{numerator}/{denominator}"; }