-
Notifications
You must be signed in to change notification settings - Fork 461
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 ConstantFloatType value dump precision #2358
Conversation
You've opened the pull request against the latest branch 1.11.x. If your code is relevant on 1.10.x and you want it to be released sooner, please rebase your pull request and change its target to 1.10.x. |
f1a7c78
to
c591aec
Compare
|
||
return $formatted; | ||
}, | ||
fn (): string => $this->castFloatToString($this->value), |
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.
IIRC this is a perf critical path.
I think we need a benchmark to show whether this edge-case fixing leads to a perf regression in the common case
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.
Scratch that. I mixed it up with #2080
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.
#2080 - please see phpstan/phpstan#9228, the comparison should be even simplifid to ===
only, as any other float value is different
fwiw, I just stumbled over a pretty similar logic in sebastian/exporter: |
c477b0b
to
fe9bd6d
Compare
1b7e1a0
to
aaaf2c3
Compare
PR is done. |
Thank you. |
When dumping a float value, we need:
.
is always present in finite values (/wo.
the number type is integer)(string) float_expr
cast is affected byprecision
php.ini)