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

Serial.print(0ULL) gives empty output #178

Closed
warmonkey opened this issue Jan 14, 2023 · 2 comments · Fixed by #203
Closed

Serial.print(0ULL) gives empty output #178

warmonkey opened this issue Jan 14, 2023 · 2 comments · Fixed by #203

Comments

@warmonkey
Copy link

Test case:
Serial.print(0ULL);
Expected output: 0
Actual output: nothing

Quick fix:

// FAST IMPLEMENTATION FOR ULL
size_t Print::printULLNumber(unsigned long long n64, uint8_t base)
{
  //handle special case
  if (n64 == 0) {
    write('0');
    return 1;
  }
@warmonkey warmonkey changed the title Serial.print(0ULL) gives not output Serial.print(0ULL) gives empty output Jan 14, 2023
@aentinger
Copy link
Contributor

Can you create a PR or at least a failing test case?

earlephilhower added a commit to earlephilhower/ArduinoCore-API that referenced this issue Sep 3, 2023
Fixes #1691

To be removed once upstream bug is fixed and core-api imported:
arduino#178
@earlephilhower
Copy link
Contributor

Failing example from earlephilhower/arduino-pico#1691

void setup() {
  Serial.begin(9600);
  while (!Serial) {}
  uint64_t n = 123;
  uint64_t m = n;
  Serial.print("n - m = ");
  Serial.println(n - m);
  n++;
  Serial.print("n - m = ");
  Serial.println(n - m);
}
void loop() {}

Gives

n - m =
n - m = 1

aentinger pushed a commit that referenced this issue Sep 4, 2023
Fixes #1691

To be removed once upstream bug is fixed and core-api imported:
#178
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 a pull request may close this issue.

3 participants