Skip to content
This repository has been archived by the owner on Jan 7, 2019. It is now read-only.

[io] IOStream: printf now supports basic %m.nf float formatting. #99

Merged

Conversation

strongly-typed
Copy link
Member

Simple %m.nf now gives a result quite close to what glibc does.

Fixes #18.

Result on OS X:

Info:    Machine:  usrs-MacBook-Pro.local
Info:    User:     usr
Info:    Os:       Mac 10.11.3 (x86_64)
Info:    Compiler: Apple LLVM version 7.0.2 (clang-700.1.81)
Info:    Compare xpcc's printf and xpcc with glibc's printf
Info:    xpcc  >>-  42<<
Info:    glibc >>  -42<<

In xpcc printf the minus does not touch the number.
glibc's printf does and is (to my experience) the most common behaviour.
Now xpcc's printf matches the output of glibc's printf:

Info:    Machine:  usrs-MacBook-Pro.local
Info:    User:     usr
Info:    Os:       Mac 10.11.3 (x86_64)
Info:    Compiler: Apple LLVM version 7.0.2 (clang-700.1.81)
Info:    Compare xpcc's printf and xpcc with glibc's printf
Info:    xpcc  >>  -42<<
Info:    glibc >>  -42<<
As mentioned in the issues, xpcc's printf does not have a formatter for floats.
Code size for and STM32F407 example increased by 416 bytes.

Program:    9376 bytes (0.9% Full)
Program:    9792 bytes (0.9% Full)
@salkinium
Copy link
Member

salkinium commented Feb 24, 2016

If the added program size for printf with float formatting proves too much for some AVRs, we'll make it configurable then.
If you use printf in AVRs there is a large overhead anyways, so this isn't news.
👍 from me.

Thanks. Also related to #26.

@salkinium salkinium merged commit 6f85825 into roboterclubaachen:develop Feb 24, 2016
@strongly-typed strongly-typed deleted the feature/printf_float branch February 25, 2016 08:46
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

IOStream cannot format floats
2 participants