Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Print negative numbers as negative numbers regardless of base#4535

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 ourterms of service andprivacy statement. We’ll occasionally send you account related emails.

Already on GitHub?Sign in to your account

Open
cousteaulecommandant wants to merge1 commit intoarduino:master
base:master
Choose a base branch
Loading
fromcousteaulecommandant:patch-2
Open

Print negative numbers as negative numbers regardless of base#4535

cousteaulecommandant wants to merge1 commit intoarduino:masterfromcousteaulecommandant:patch-2

Conversation

@cousteaulecommandant
Copy link
Contributor

Base 10 is not special. Printing a negative number such as -15 in base 16 should show -F, not FFFFFFF1. For the result with the many Fs, the number should be converted to unsigned long (or unsigned int for fewer Fs).
Issue #4460 complains about the behavior ofprint for negative ints (which prints them as unsignedlong), and I think the best solution would be to be consistent with what negative integers actually represent rather than with what printf does in C.

lemio reacted with thumbs up emoji
Make negative integers be represented with "-" in any base, not just base 10.
@facchinmfacchinm added the Print and Stream classThe Arduino core library's Print and Stream classes labelJan 20, 2017
@CLAassistant
Copy link

CLAassistant commentedApr 9, 2021
edited
Loading

CLA assistant check
All committers have signed the CLA.

Sign up for freeto join this conversation on GitHub. Already have an account?Sign in to comment

Reviewers

No reviews

Assignees

No one assigned

Labels

Print and Stream classThe Arduino core library's Print and Stream classes

Projects

None yet

Milestone

No milestone

Development

Successfully merging this pull request may close these issues.

3 participants

@cousteaulecommandant@CLAassistant@facchinm

[8]ページ先頭

©2009-2025 Movatter.jp