-
Notifications
You must be signed in to change notification settings - Fork 698
fix(golang-github-task-slim-sprig): stabilize arm64 rounding #18481
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Open
Mitch Zhu (miz060)
wants to merge
1
commit into
4.0
Choose a base branch
from
mitchzhu/golang-github-task-slim-sprig-rounding
base: 4.0
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from all commits
Commits
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
22 changes: 22 additions & 0 deletions
22
...comps/golang-github-task-slim-sprig/0001-numeric-force-float64-rounding-before-modf.patch
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,22 @@ | ||
| From 0f85e14d9ed22d40591320b7afef80351cba390d Mon Sep 17 00:00:00 2001 | ||
| From: Mitch Zhu <mitchzhu@microsoft.com> | ||
| Date: Tue, 18 Aug 2026 00:00:00 +0000 | ||
| Subject: [PATCH] numeric: force float64 rounding before Modf | ||
|
|
||
| Go may fuse the multiplication passed to math.Modf on arm64, preserving | ||
| additional precision and changing the result of round. An explicit float64 | ||
| conversion forces rounding to float64 precision before the Modf call, as | ||
| recommended in golang/go#77657. | ||
| --- | ||
| numeric.go | 2 +- | ||
| 1 file changed, 1 insertion(+), 1 deletion(-) | ||
|
|
||
| diff --git a/numeric.go b/numeric.go | ||
| index 7a73fc4..f3abf5c 100644 | ||
| --- a/numeric.go | ||
| +++ b/numeric.go | ||
| @@ -171 +171 @@ func round(a interface{}, p int, rOpt ...float64) float64 { | ||
| - digit := pow * val | ||
| + digit := float64(pow * val) | ||
| -- | ||
| 2.51.0 |
17 changes: 17 additions & 0 deletions
17
base/comps/golang-github-task-slim-sprig/golang-github-task-slim-sprig.comp.toml
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,17 @@ | ||
| [components.golang-github-task-slim-sprig] | ||
|
|
||
| [[components.golang-github-task-slim-sprig.overlays]] | ||
| description = "Force float64 rounding before math.Modf to prevent fused arithmetic from changing round results" | ||
| type = "patch-add" | ||
| source = "0001-numeric-force-float64-rounding-before-modf.patch" | ||
|
|
||
| [[components.golang-github-task-slim-sprig.overlays]] | ||
| description = "Apply the float64 rounding patch after Go source preparation" | ||
| type = "spec-append-lines" | ||
| section = "%prep" | ||
| lines = ["%autopatch -p1"] | ||
|
|
||
| [components.golang-github-task-slim-sprig.overlays.metadata] | ||
| category = "azl-platform-adaptation" | ||
| upstream-status = "upstreamable" | ||
| bugs = [{ url = "https://github.com/golang/go/issues/77657" }] | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
22 changes: 22 additions & 0 deletions
22
specs/g/golang-github-task-slim-sprig/0001-numeric-force-float64-rounding-before-modf.patch
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,22 @@ | ||
| From 0f85e14d9ed22d40591320b7afef80351cba390d Mon Sep 17 00:00:00 2001 | ||
| From: Mitch Zhu <mitchzhu@microsoft.com> | ||
| Date: Tue, 18 Aug 2026 00:00:00 +0000 | ||
| Subject: [PATCH] numeric: force float64 rounding before Modf | ||
|
|
||
| Go may fuse the multiplication passed to math.Modf on arm64, preserving | ||
| additional precision and changing the result of round. An explicit float64 | ||
| conversion forces rounding to float64 precision before the Modf call, as | ||
| recommended in golang/go#77657. | ||
| --- | ||
| numeric.go | 2 +- | ||
| 1 file changed, 1 insertion(+), 1 deletion(-) | ||
|
|
||
| diff --git a/numeric.go b/numeric.go | ||
| index 7a73fc4..f3abf5c 100644 | ||
| --- a/numeric.go | ||
| +++ b/numeric.go | ||
| @@ -171 +171 @@ func round(a interface{}, p int, rOpt ...float64) float64 { | ||
| - digit := pow * val | ||
| + digit := float64(pow * val) | ||
| -- | ||
| 2.51.0 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
question(blocking): Fedora upstream has orphaned this package entirely: https://src.fedoraproject.org/rpms/golang-github-task-slim-sprig
What in our distro is still requiring it?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I checked the Azure Linux 4 SDK dependency graph. Ginkgo v1 and v2 require slim-sprig. Ginkgo v1 is required by golevedb, which feeds httpcache -> k8s-client, so slim-sprig is not currently a removable leaf and needs to remain packaged. (I did find some other orphaned golang pkgs we should remove, will follow up in another PR).