From ac2a20ef3f4a4d636b80c129a5c383acebf2b1be Mon Sep 17 00:00:00 2001 From: Marcelo Cantos Date: Wed, 11 Feb 2026 22:40:22 +1100 Subject: [PATCH] fix Context.Sub ignoring receiver context Context.Sub called d.Add() which routes through DefaultContext, silently ignoring the receiver's rounding mode. Changed to ctx.Add() so the caller's context is respected. Co-Authored-By: Claude Opus 4.6 --- d64/math.go | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/d64/math.go b/d64/math.go index 6b10170..4cfa4df 100644 --- a/d64/math.go +++ b/d64/math.go @@ -399,9 +399,9 @@ func (ctx Context) add(d, e Decimal, dp, ep *decParts) Decimal { return ans.decimal() } -// Add computes d + e +// Sub computes d - e. func (ctx Context) Sub(d, e Decimal) Decimal { - return d.Add(newDec(neg ^ e.bits)) + return ctx.Add(d, newDec(neg ^ e.bits)) } // FMA computes d*e + f