Skip to content

Commit

Permalink
Merge branch 'master' of https://github.com/jk-jeon/dragonbox
Browse files Browse the repository at this point in the history
  • Loading branch information
jk-jeon committed Sep 2, 2024
2 parents 81f7335 + 11df5f0 commit b27a9ab
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@ target_link_libraries(my_target dragonbox::dragonbox) # or dragonbox::dragonbox_
```

# Language Standard
The library is targeting C++17 and actively using its features (e.g., `if constexpr`).
The library requires C++11 or higher. Since C++20, every function provided is `constexpr`.

# Usage Examples
(Simple string generation from `float/double`)
Expand Down Expand Up @@ -98,6 +98,9 @@ By default, `jkj::dragonbox::to_decimal` returns a struct with three members (`s

***Important.*** `jkj::dragonbox::to_decimal` is designed to ***work only with finite nonzero*** inputs. The behavior of it when given with infinities/NaN's/`+0`/`-0` is undefined. `jkj::dragonbox::to_chars` and `jkj::dragonbox::to_chars_n` work fine for any inputs.

# To people wanting to port the algorithm
Those who want to port the algorithm into other languages or re-implement it from scratch are recommended to look at the [simpler implementation](https://github.com/jk-jeon/dragonbox/tree/master/subproject/simple) first rather than the main implementation, since the main implementation is riddled with template indirections obscuring the core logic of the algorithm. The simpler implementation offers less flexibility and somewhat slower performance, but is much more straightforward so it should be easier to understand.

# Policies
Dragonbox provides several policies that the user can select. Most of the time the default policies will be sufficient, but for some situation this customizability might be useful. There are currently five different kinds of policies that you can specify: sign policy, trailing zero policy, decimal-to-binary (parsing) rounding policy, binary-to-decimal (formatting) rounding policy, and cache policy. Those policies live in the namespace `jkj::dragonbox::policy`. You can provide the policies as additional parameters to `jkj::dragonbox::to_decimal` or `jkj::dragonbox::to_chars` or `jkj::dragonbox::to_chars_n`. Here is an example usage:
```cpp
Expand Down

0 comments on commit b27a9ab

Please sign in to comment.