Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
F
fmt
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Libraries
fmt
Commits
925b744a
Commit
925b744a
authored
Jan 15, 2022
by
Junekey Jeon
Committed by
Victor Zverovich
Jan 19, 2022
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Improve comments
parent
22b14ff2
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
13 additions
and
3 deletions
+13
-3
include/fmt/format-inl.h
include/fmt/format-inl.h
+13
-3
No files found.
include/fmt/format-inl.h
View file @
925b744a
...
...
@@ -793,7 +793,8 @@ struct uint128_wrapper {
uint64_t
low_
;
constexpr
uint128_wrapper
(
uint64_t
high
,
uint64_t
low
)
FMT_NOEXCEPT
:
high_
{
high
},
low_
{
low
}
{}
:
high_
{
high
},
low_
{
low
}
{}
constexpr
uint64_t
high
()
const
FMT_NOEXCEPT
{
return
high_
;
}
constexpr
uint64_t
low
()
const
FMT_NOEXCEPT
{
return
low_
;
}
...
...
@@ -2008,6 +2009,8 @@ template <typename T> decimal_fp<T> to_decimal(T x) FMT_NOEXCEPT {
exponent
+=
float_info
<
T
>::
exponent_bias
-
float_info
<
T
>::
significand_bits
;
// Shorter interval case; proceed like Schubfach.
// In fact, when exponent == 1 and significand == 0, the interval is
// regular. However, it can be shown that the end-results are anyway same.
if
(
significand
==
0
)
return
shorter_interval_case
<
T
>
(
exponent
);
significand
|=
...
...
@@ -2030,6 +2033,13 @@ template <typename T> decimal_fp<T> to_decimal(T x) FMT_NOEXCEPT {
// 10^kappa <= deltai < 10^(kappa + 1)
const
uint32_t
deltai
=
cache_accessor
<
T
>::
compute_delta
(
cache
,
beta_minus_1
);
const
carrier_uint
two_fc
=
significand
<<
1
;
// For the case of binary32, the result of integer check is not correct for
// 29711844 * 2^-81, and it is the unique counterexample. However, since
// 29711844 is even, this does not cause any problem for the endpoints; it can
// only cause a problem when we need to perform integer check for the center.
// Fortunately, with the input 297184444 * 2^-81, that branch is never
// executed, so we are fine.
const
typename
cache_accessor
<
T
>::
compute_mul_result
z_mul
=
cache_accessor
<
T
>::
compute_mul
((
two_fc
|
1
)
<<
beta_minus_1
,
cache
);
...
...
@@ -2039,8 +2049,8 @@ template <typename T> decimal_fp<T> to_decimal(T x) FMT_NOEXCEPT {
// better than the compiler; we are computing zi / big_divisor here.
decimal_fp
<
T
>
ret_value
;
ret_value
.
significand
=
divide_by_10_to_kappa_plus_1
(
z_mul
.
result
);
uint32_t
r
=
static_cast
<
uint32_t
>
(
z_mul
.
result
-
float_info
<
T
>::
big_divisor
*
ret_value
.
significand
);
uint32_t
r
=
static_cast
<
uint32_t
>
(
z_mul
.
result
-
float_info
<
T
>::
big_divisor
*
ret_value
.
significand
);
if
(
r
>
deltai
)
{
goto
small_divisor_case_label
;
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment