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
085171e7
Commit
085171e7
authored
Sep 22, 2020
by
Victor Zverovich
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Remove grisu_count_digits
parent
aa729bf2
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
1 addition
and
15 deletions
+1
-15
include/fmt/format-inl.h
include/fmt/format-inl.h
+1
-15
No files found.
include/fmt/format-inl.h
View file @
085171e7
...
...
@@ -1498,20 +1498,6 @@ enum result {
};
}
// A version of count_digits optimized for grisu_gen_digits.
inline
int
grisu_count_digits
(
uint32_t
n
)
{
if
(
n
<
10
)
return
1
;
if
(
n
<
100
)
return
2
;
if
(
n
<
1000
)
return
3
;
if
(
n
<
10000
)
return
4
;
if
(
n
<
100000
)
return
5
;
if
(
n
<
1000000
)
return
6
;
if
(
n
<
10000000
)
return
7
;
if
(
n
<
100000000
)
return
8
;
if
(
n
<
1000000000
)
return
9
;
return
10
;
}
// Generates output using the Grisu digit-gen algorithm.
// error: the size of the region (lower, upper) outside of which numbers
// definitely do not round to value (Delta in Grisu3).
...
...
@@ -1527,7 +1513,7 @@ FMT_ALWAYS_INLINE digits::result grisu_gen_digits(fp value, uint64_t error,
FMT_ASSERT
(
integral
==
value
.
f
>>
-
one
.
e
,
""
);
// The fractional part of scaled value (p2 in Grisu) c = value % one.
uint64_t
fractional
=
value
.
f
&
(
one
.
f
-
1
);
exp
=
grisu_
count_digits
(
integral
);
// kappa in Grisu.
exp
=
count_digits
(
integral
);
// kappa in Grisu.
// Divide by 10 to prevent overflow.
auto
result
=
handler
.
on_start
(
data
::
powers_of_10_64
[
exp
-
1
]
<<
-
one
.
e
,
value
.
f
/
10
,
error
*
10
,
exp
);
...
...
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