Skip to content
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

Fix GH-17503: Undefined float conversion in mb_convert_variables #17689

Closed
wants to merge 3 commits into from

Conversation

cmb69
Copy link
Member

@cmb69 cmb69 commented Feb 3, 2025

Conversion of floating point to integer values is undefined if the integral part of the float value cannot be represented by the integer type. We need to cater to that explicitly (in a manner similar to zend_dval_to_lval_cap()).

Conversion of floating point to integer values is undefined if the
integral part of the float value cannot be represented by the integer
type.  We need to cater to that explicitly (in a manner similar to
`zend_dval_to_lval_cap()`).
@cmb69 cmb69 linked an issue Feb 3, 2025 that may be closed by this pull request
@cmb69 cmb69 marked this pull request as ready for review February 4, 2025 00:34
@alexdowad
Copy link
Contributor

Dear @cmb69, thanks so much for working on this.

Do you think it is a good idea to use float for this quantity? Would it be better to use double?

@cmb69
Copy link
Member Author

cmb69 commented Feb 4, 2025

I went with float, because .multiplier is a float. Using double here might indeed be a bit better regarding the precision, and shouldn't make a relevant performance difference (note that I'm not a floating point expert, so I might be wrong).

Copy link
Contributor

@youkidearitai youkidearitai left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thank you very much. Make sense to me.

Copy link
Contributor

@alexdowad alexdowad left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks so much!

@cmb69 cmb69 closed this in 55e676e Feb 4, 2025
@cmb69 cmb69 deleted the cmb/gh17503 branch February 4, 2025 14:56
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Undefined float conversion in mb_convert_variables
3 participants