Skip to content

fix(apiquery): encode float32 query values at float32 precision - #172

Open
latent-9 wants to merge 1 commit into
kernel:mainfrom
latent-9:fix/apiquery-float32-precision
Open

fix(apiquery): encode float32 query values at float32 precision#172
latent-9 wants to merge 1 commit into
kernel:mainfrom
latent-9:fix/apiquery-float32-precision

Conversation

@latent-9

@latent-9 latent-9 commented Aug 27, 2026

Copy link
Copy Markdown

internal/apiquery/encoder.go formats both reflect.Float32 and reflect.Float64 values with strconv.FormatFloat(..., 64), so float32 query parameters are serialized with float64 noise, e.g. 43.76 becomes 43.7599983215332. The sibling internal/apiform/encoder.go already splits the two kinds; this makes apiquery match. Query tests pinned to the noisy output are updated to the exact value.


Note

Low Risk
Localized serialization fix in apiquery encoding with test-only expectation updates; float64 behavior is unchanged.

Overview
float32 query parameters are now serialized with 32-bit strconv.FormatFloat instead of sharing the float64 path, so values like 43.76 no longer appear as 43.7599983215332 in encoded query strings.

This mirrors the existing split in internal/apiform/encoder.go. Encoder tests that pinned the old noisy e= output are updated to expect the rounded float32 representation.

Reviewed by Cursor Bugbot for commit 98a09ce. Bugbot is set up for automated code reviews on this repo. Configure here.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant