aboutsummaryrefslogtreecommitdiffstats
path: root/README.md
diff options
context:
space:
mode:
authorMarco Paland <marco@paland.com>2018-08-21 12:37:46 +0200
committerMarco Paland <marco@paland.com>2018-08-21 12:37:46 +0200
commite6b5331a36a5815cc36a9b2872f29234efee72cb (patch)
tree53519bcfd31b2663c749f86ddc1cfdcc388ea911 /README.md
parent61de9c0cb0738e51625b6071a88921fecd591180 (diff)
downloadprintf-e6b5331a36a5815cc36a9b2872f29234efee72cb.tar.gz
printf-e6b5331a36a5815cc36a9b2872f29234efee72cb.tar.bz2
printf-e6b5331a36a5815cc36a9b2872f29234efee72cb.zip
fix(printf): fix floating point precision limit
Return the correct count of precision digits now. Fixes #22
Diffstat (limited to 'README.md')
-rw-r--r--README.md8
1 files changed, 7 insertions, 1 deletions
diff --git a/README.md b/README.md
index 930207f..eb360fa 100644
--- a/README.md
+++ b/README.md
@@ -28,7 +28,7 @@ Therefore I decided to write an own, final implementation which meets the follow
- Support of decimal/floating number representation (with an own fast itoa/ftoa)
- Reentrant and thread-safe, malloc free, no static vars/buffers
- LINT and compiler L4 warning free, mature, coverity clean, automotive ready
- - Extensive test suite (> 320 test cases) passing
+ - Extensive test suite (> 330 test cases) passing
- Simply the best *printf* around the net
- MIT license
@@ -167,6 +167,12 @@ int length = sprintf(NULL, "Hello, world"); // length is set to 12
| PRINTF_SUPPORT_PTRDIFF_T | defined | Define this to enable ptrdiff_t (%t) support |
+## Caveats
+- The internal floating point conversion has a maximum precision of 9 digits. Any higher precision is truncated after the 9th digit and zeros are returned.
+ So `printf("%.12f", 42.89522312345678)` gives `42.895223123000`.
+- Exponential floating point format (e.g. `"%.10e"` to get `1.167e+65`) for large numbers is not supported yet. Sorry.
+
+
## Test suite
For testing just compile, build and run the test suite located in `test/test_suite.cpp`. This uses the [catch](https://github.com/catchorg/Catch2) framework for unit-tests, which is auto-adding main().
Running with the `--wait-for-keypress exit` option waits for the enter key after test end.