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
b71d3fe7
Commit
b71d3fe7
authored
Oct 17, 2018
by
Victor Zverovich
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Remove use_grisu
parent
847abb6f
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
3 additions
and
6 deletions
+3
-6
include/fmt/format.h
include/fmt/format.h
+2
-5
test/format-test.cc
test/format-test.cc
+1
-1
No files found.
include/fmt/format.h
View file @
b71d3fe7
...
@@ -163,6 +163,7 @@ FMT_END_NAMESPACE
...
@@ -163,6 +163,7 @@ FMT_END_NAMESPACE
#ifndef FMT_USE_GRISU
#ifndef FMT_USE_GRISU
# define FMT_USE_GRISU 0
# define FMT_USE_GRISU 0
//# define FMT_USE_GRISU std::numeric_limits<double>::is_iec559
#endif
#endif
// __builtin_clz is broken in clang with Microsoft CodeGen:
// __builtin_clz is broken in clang with Microsoft CodeGen:
...
@@ -1177,10 +1178,6 @@ FMT_CONSTEXPR unsigned basic_parse_context<Char, ErrorHandler>::next_arg_id() {
...
@@ -1177,10 +1178,6 @@ FMT_CONSTEXPR unsigned basic_parse_context<Char, ErrorHandler>::next_arg_id() {
namespace
internal
{
namespace
internal
{
inline
bool
use_grisu
()
{
return
FMT_USE_GRISU
&&
std
::
numeric_limits
<
double
>::
is_iec559
;
}
// Formats value using Grisu2 algorithm:
// Formats value using Grisu2 algorithm:
// https://www.cs.tufts.edu/~nr/cs257/archive/florian-loitsch/printf.pdf
// https://www.cs.tufts.edu/~nr/cs257/archive/florian-loitsch/printf.pdf
template
<
typename
Double
>
template
<
typename
Double
>
...
@@ -2841,7 +2838,7 @@ void basic_writer<Range>::write_double(T value, const format_specs &spec) {
...
@@ -2841,7 +2838,7 @@ void basic_writer<Range>::write_double(T value, const format_specs &spec) {
return
write_inf_or_nan
(
handler
.
upper
?
"INF"
:
"inf"
);
return
write_inf_or_nan
(
handler
.
upper
?
"INF"
:
"inf"
);
memory_buffer
buffer
;
memory_buffer
buffer
;
bool
use_grisu
=
internal
::
use_grisu
()
&&
sizeof
(
T
)
<=
sizeof
(
double
)
&&
bool
use_grisu
=
FMT_USE_GRISU
&&
sizeof
(
T
)
<=
sizeof
(
double
)
&&
spec
.
type
!=
'a'
&&
spec
.
type
!=
'A'
&&
spec
.
type
!=
'a'
&&
spec
.
type
!=
'A'
&&
internal
::
grisu2_format
(
static_cast
<
double
>
(
value
),
buffer
,
spec
);
internal
::
grisu2_format
(
static_cast
<
double
>
(
value
),
buffer
,
spec
);
if
(
!
use_grisu
)
{
if
(
!
use_grisu
)
{
...
...
test/format-test.cc
View file @
b71d3fe7
...
@@ -996,7 +996,7 @@ TEST(FormatterTest, HashFlag) {
...
@@ -996,7 +996,7 @@ TEST(FormatterTest, HashFlag) {
EXPECT_EQ
(
"0x42"
,
format
(
"{0:#x}"
,
0x42ull
));
EXPECT_EQ
(
"0x42"
,
format
(
"{0:#x}"
,
0x42ull
));
EXPECT_EQ
(
"042"
,
format
(
"{0:#o}"
,
042ull
));
EXPECT_EQ
(
"042"
,
format
(
"{0:#o}"
,
042ull
));
if
(
fmt
::
internal
::
use_grisu
()
)
if
(
FMT_USE_GRISU
)
EXPECT_EQ
(
"-42.0"
,
format
(
"{0:#}"
,
-
42.0
));
EXPECT_EQ
(
"-42.0"
,
format
(
"{0:#}"
,
-
42.0
));
else
else
EXPECT_EQ
(
"-42.0000"
,
format
(
"{0:#}"
,
-
42.0
));
EXPECT_EQ
(
"-42.0000"
,
format
(
"{0:#}"
,
-
42.0
));
...
...
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