-
Notifications
You must be signed in to change notification settings - Fork 3.1k
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
String formatting: plus sign ignored for %+g #3265
Comments
I tested it with this firmware and this program. The results show that now the + is the same on NodeMCU as on Ubuntu's LUA. However, at the same time they indicate they have a different interpretation of the number of spaces when the sign is omitted. Also you might wonder why I used 3.1410 as the number, not 3.1415… that's because they also have different opinions about rounding. |
Thanks for testing. I'll try to have a look at both issues. If there's easy way to fix it it can be done. Maybe we should continue the discussion directly in the PR. |
This didn't get picked up as fixed automagically. If it should remain open, please feel free to reopen it! |
I tested with this firmware built from commit 64bbf00 = the current dev branch. The results are as from my previous test above. @vsky279 Since the MR is merged now, I guess it would be confusing to continue the discussion there. Will you make a new MR for the spacing and/or rounding bugs? Shall I open issues for them? If the MR seems easy maybe we should just extend and re-open this issue. |
You were too fast guys. I suggest reopening this issue rather than opening another one. I have almost ready the PR for testing for the As for the rounding - I think it is not something to be corrected. I think the difference @mk-pmb observes between Ubuntu Lua 5.2 and NodeMCU Lua 5.3 is due to the fact that we are using 32bit float while Ubuntu is using 64bit double. 3.1415 does not has precise representation in 32bit float. It is in fact stored as 3.141499996185303 ( |
(If anyone else wonders: He's using big endian notation.) Maybe they multiply by 10**precision first, or calculate the next decimal digit and decide based on that.
Would be waaaay to easy if computer rounding would be the same as we learned in school math. |
Will do, probably tomorrow. Meanwhile: For changing the rounding I think we should ensure a wide consensus, do we have that? Edit: I see it's being discussed in the PR. |
Definitely there needs to be wide agreement. This is also why I have two separate commits. |
Done for ESP8266. Meanwhile I got an ESP32 as well, but |
I think that this should be solved with the merging of the snprintf implementation. Can you verify? |
I tested this already. Both flags '+' & ' ' work fine with the new snprintf implementation. The double rounding - it would be nice to have it implemented. Is it possible to submit a PR on source files provided by a submodule? |
I think that you should submit the PR to the original module....
…On Sun, Oct 4, 2020 at 5:50 PM Lukáš Voborský ***@***.***> wrote:
I tested this already. Both flags '+' & ' ' work fine with the new
snprintf implementation.
The double rounding - it would be nice to have it implemented. Is it
possible to submit a PR on source files provided by a submodule?
—
You are receiving this because you commented.
Reply to this email directly, view it on GitHub
<#3265 (comment)>,
or unsubscribe
<https://github.com/notifications/unsubscribe-auth/AALQLTKCY2BBJF4S74HEC2LSJDUZVANCNFSM4QQ5VJUA>
.
|
I think that with 64-bit doubles (PR #3225) there's no need to have the double rounding implemented. |
Closing by request of @vsky279. |
Expected behavior
My number has a plus sign, as on Ubuntu:
Actual behavior
No sign in the REPL on my ESP8266 (using this firmware built with
LUA=53
from current dev branch + tmr fix.Test code
NodeMCU startup banner
Hardware
ESP8266 LoLin v3
The text was updated successfully, but these errors were encountered: