Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Allow forcing floats to be encoded as F32#178

Merged
m6w6 merged 1 commit into
msgpack:mastermsgpack/msgpack-php:masterfrom
jackprice:jackprice/msgpack-f32jackprice/msgpack-php:jackprice/msgpack-f32Copy head branch name to clipboard
Aug 26, 2025
Merged

Allow forcing floats to be encoded as F32#178
m6w6 merged 1 commit into
msgpack:mastermsgpack/msgpack-php:masterfrom
jackprice:jackprice/msgpack-f32jackprice/msgpack-php:jackprice/msgpack-f32Copy head branch name to clipboard

Conversation

@jackprice

Copy link
Copy Markdown

This merge allows users to force floats to be encoded as 32-bit floats (float 32) rather than the default 64-bit doubles. This would primarily be useful for reducing the storage size of the packed result, and has no effect on unpacking, aside from the loss in precision that will happen transparently.

If there is appetite for this and this fits with style/structure expected I will expand to allow similarly forcing int8,int16 etc.

I've implemented this as an option on the packer class, but also as an ini flag (though I'm unsure if that's actually useful).

@m6w6

m6w6 commented Feb 19, 2025

Copy link
Copy Markdown
Collaborator

👍 LGTM; test cases are a bit suspicious; anything better to do there?

@jackprice

Copy link
Copy Markdown
Author

👍 LGTM; test cases are a bit suspicious; anything better to do there?

Awesome, thanks! I just basically mirrored some existing tests, what would you prefer?

@m6w6 m6w6 merged commit d514428 into msgpack:master Aug 26, 2025
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.

2 participants

Morty Proxy This is a proxified and sanitized view of the page, visit original site.