-
-
Notifications
You must be signed in to change notification settings - Fork 136
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
Problem with select float in E-notation format #317
Comments
Can you send pull request? |
If suggested solution is ok for you, I can do it. |
I think it is ok. |
This was referenced Oct 23, 2018
chrudosvorlicek
pushed a commit
to chrudosvorlicek/dibi
that referenced
this issue
Oct 23, 2018
chrudosvorlicek
pushed a commit
to chrudosvorlicek/dibi
that referenced
this issue
Oct 23, 2018
This was referenced Oct 23, 2018
dg
pushed a commit
that referenced
this issue
Oct 25, 2018
dg
pushed a commit
that referenced
this issue
Oct 25, 2018
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Version: I'm using v3.2.3, but it is also in master
Bug Description
When selecting float number in e-notation (e.g. 1.1e+10) class \Dibi\Result rtrims the zero, which causes change of output value (1.1e+10 is selected as 1.1e+1).
Steps To Reproduce
just try to select float number in e-notation from database.
Expected Behavior
If the number is in e-notation, leave rigth zeros.
Possible Solution
In class \Dibi\Result in private function normalize in part where $type === Type::FLOAT add check if number is in e-notation format and if it is, do not perform rtrim on zeros. It can be something like this:
$p = strpos($value, '.'); $e = strpos($value, 'e'); if ($p !== false && $e === false) { $value = rtrim(rtrim($value, '0'), '.'); } elseif ($p !== false && $e !== false) { $value = rtrim($value, '.'); }
The text was updated successfully, but these errors were encountered: