From 51bfef137b57a6b838749b2fd5f30e2a0ea13f92 Mon Sep 17 00:00:00 2001 From: Junekey Jeon <33922675+jk-jeon@users.noreply.github.com> Date: Fri, 10 May 2024 15:38:24 -0700 Subject: [PATCH 1/2] Update README.md Fix link to Schubfach into the latest one --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index 606fa3f..7521dd5 100644 --- a/README.md +++ b/README.md @@ -1,7 +1,7 @@ # Dragonbox This library is a reference implementation of [Dragonbox](other_files/Dragonbox.pdf) in C++. -Dragonbox is a float-to-string conversion algorithm based on a beautiful algorithm [Schubfach](https://drive.google.com/open?id=1luHhyQF9zKlM8yJ1nebU0OgVYhfC6CBN), developed by Raffaello Giulietti in 2017-2018. Dragonbox is further inspired by [Grisu](https://www.cs.tufts.edu/~nr/cs257/archive/florian-loitsch/printf.pdf) and [Grisu-Exact](https://github.com/jk-jeon/Grisu-Exact). +Dragonbox is a float-to-string conversion algorithm based on a beautiful algorithm [Schubfach](https://drive.google.com/file/d/1IEeATSVnEE6TkrHlCYNY2GjaraBjOT4f/edit), developed by Raffaello Giulietti in 2017-2018. Dragonbox is further inspired by [Grisu](https://www.cs.tufts.edu/~nr/cs257/archive/florian-loitsch/printf.pdf) and [Grisu-Exact](https://github.com/jk-jeon/Grisu-Exact). # Introduction Dragonbox generates a pair of integers from a floating-point number: the decimal significand and the decimal exponent of the input floating-point number. These integers can then be used for string generation of decimal representation of the input floating-point number, the procedure commonly called ````ftoa```` or ````dtoa````. From 9bac14fa32c630cfed75f5d1b68f7344ae426cce Mon Sep 17 00:00:00 2001 From: Junekey Jeon <33922675+jk-jeon@users.noreply.github.com> Date: Fri, 24 May 2024 13:04:07 -0700 Subject: [PATCH 2/2] Fix a short circuit bug r needs to be divided by 10^kappa in any case --- include/dragonbox/dragonbox.h | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/include/dragonbox/dragonbox.h b/include/dragonbox/dragonbox.h index 784b23a..2e24355 100644 --- a/include/dragonbox/dragonbox.h +++ b/include/dragonbox/dragonbox.h @@ -3495,8 +3495,8 @@ namespace jkj { // interval. if (!interval_type.include_right_endpoint()) { // Is r divisible by 10^kappa? - if (z_result.is_integer && - div::check_divisibility_and_divide_by_pow10(r)) { + if (div::check_divisibility_and_divide_by_pow10(r) && + z_result.is_integer) { // This should be in the interval. decimal_significand += r - 1; }