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
75108a56
Commit
75108a56
authored
Nov 20, 2019
by
Victor Zverovich
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Don't print % for nan and inf
parent
3e1f70fe
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
3 additions
and
6 deletions
+3
-6
include/fmt/format.h
include/fmt/format.h
+3
-6
No files found.
include/fmt/format.h
View file @
75108a56
...
...
@@ -1623,12 +1623,10 @@ template <typename Range> class basic_writer {
struct
inf_or_nan_writer
{
sign_t
sign
;
bool
as_percentage
;
const
char
*
str
;
size_t
size
()
const
{
return
static_cast
<
std
::
size_t
>
(
inf_size
+
(
sign
?
1
:
0
)
+
(
as_percentage
?
1
:
0
));
return
static_cast
<
std
::
size_t
>
(
inf_size
+
(
sign
?
1
:
0
));
}
size_t
width
()
const
{
return
size
();
}
...
...
@@ -1636,7 +1634,6 @@ template <typename Range> class basic_writer {
if
(
sign
)
*
it
++
=
static_cast
<
char_type
>
(
data
::
signs
[
sign
]);
it
=
internal
::
copy_str
<
char_type
>
(
str
,
str
+
static_cast
<
std
::
size_t
>
(
inf_size
),
it
);
if
(
as_percentage
)
*
it
++
=
static_cast
<
char_type
>
(
'%'
);
}
};
...
...
@@ -1754,9 +1751,9 @@ template <typename Range> class basic_writer {
float_spec
fspec
=
parse_float_type_spec
(
specs
.
type
);
if
(
!
std
::
isfinite
(
value
))
{
const
char
*
str
=
std
::
isinf
(
value
)
?
(
fspec
.
upper
?
"INF"
:
"inf"
)
auto
str
=
std
::
isinf
(
value
)
?
(
fspec
.
upper
?
"INF"
:
"inf"
)
:
(
fspec
.
upper
?
"NAN"
:
"nan"
);
return
write_padded
(
specs
,
inf_or_nan_writer
{
sign
,
fspec
.
percent
,
str
});
return
write_padded
(
specs
,
inf_or_nan_writer
{
sign
,
str
});
}
if
(
fspec
.
percent
)
value
*=
100
;
...
...
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