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
ff7e73af
Commit
ff7e73af
authored
Sep 26, 2021
by
Victor Zverovich
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Always run grisu_gen_digits before fallback_format
parent
2976e31a
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
8 additions
and
10 deletions
+8
-10
include/fmt/format-inl.h
include/fmt/format-inl.h
+4
-4
test/compile-fp-test.cc
test/compile-fp-test.cc
+4
-6
No files found.
include/fmt/format-inl.h
View file @
ff7e73af
...
@@ -2326,9 +2326,9 @@ FMT_CONSTEXPR20 void fallback_format(Float n, int num_digits, bool binary32,
...
@@ -2326,9 +2326,9 @@ FMT_CONSTEXPR20 void fallback_format(Float n, int num_digits, bool binary32,
// Generate the given number of digits.
// Generate the given number of digits.
exp10
-=
num_digits
-
1
;
exp10
-=
num_digits
-
1
;
if
(
num_digits
==
0
)
{
if
(
num_digits
==
0
)
{
buf
.
try_resize
(
1
);
denominator
*=
10
;
denominator
*=
10
;
buf
[
0
]
=
add_compare
(
numerator
,
numerator
,
denominator
)
>
0
?
'1'
:
'0'
;
auto
digit
=
add_compare
(
numerator
,
numerator
,
denominator
)
>
0
?
'1'
:
'0'
;
buf
.
push_back
(
digit
);
return
;
return
;
}
}
buf
.
try_resize
(
to_unsigned
(
num_digits
));
buf
.
try_resize
(
to_unsigned
(
num_digits
));
...
@@ -2407,8 +2407,8 @@ FMT_HEADER_ONLY_CONSTEXPR20 int format_float(T value, int precision,
...
@@ -2407,8 +2407,8 @@ FMT_HEADER_ONLY_CONSTEXPR20 int format_float(T value, int precision,
const
int
max_double_digits
=
767
;
const
int
max_double_digits
=
767
;
if
(
precision
>
max_double_digits
)
precision
=
max_double_digits
;
if
(
precision
>
max_double_digits
)
precision
=
max_double_digits
;
fixed_handler
handler
{
buf
.
data
(),
0
,
precision
,
-
cached_exp10
,
fixed
};
fixed_handler
handler
{
buf
.
data
(),
0
,
precision
,
-
cached_exp10
,
fixed
};
if
(
!
is_constant_evaluated
()
&&
if
(
grisu_gen_digits
(
normalized
,
1
,
exp
,
handler
)
!=
digits
::
error
&&
grisu_gen_digits
(
normalized
,
1
,
exp
,
handler
)
!=
digits
::
error
)
{
!
is_constant_evaluated
()
)
{
exp
+=
handler
.
exp10
;
exp
+=
handler
.
exp10
;
buf
.
try_resize
(
to_unsigned
(
handler
.
size
));
buf
.
try_resize
(
to_unsigned
(
handler
.
size
));
fallback
=
false
;
fallback
=
false
;
...
...
test/compile-fp-test.cc
View file @
ff7e73af
...
@@ -8,12 +8,10 @@
...
@@ -8,12 +8,10 @@
#include "fmt/compile.h"
#include "fmt/compile.h"
#include "gmock/gmock.h"
#include "gmock/gmock.h"
#if defined(__cpp_lib_bit_cast) && __cpp_lib_bit_cast >= 201806 && \
#if defined(__cpp_lib_bit_cast) && __cpp_lib_bit_cast >= 201806 && \
defined(__cpp_constexpr) && __cpp_constexpr >= 201907 && \
defined(__cpp_constexpr) && __cpp_constexpr >= 201907 && \
defined(__cpp_constexpr_dynamic_alloc) && \
defined(__cpp_constexpr_dynamic_alloc) && \
__cpp_constexpr_dynamic_alloc >= 201907 && __cplusplus >= 202002L && \
__cpp_constexpr_dynamic_alloc >= 201907 && __cplusplus >= 202002L
!FMT_MSC_VER && \
!FMT_GCC_VERSION // MSVC & GCC constexpr limits are too low.
template
<
size_t
max_string_length
,
typename
Char
=
char
>
struct
test_string
{
template
<
size_t
max_string_length
,
typename
Char
=
char
>
struct
test_string
{
template
<
typename
T
>
constexpr
bool
operator
==
(
const
T
&
rhs
)
const
noexcept
{
template
<
typename
T
>
constexpr
bool
operator
==
(
const
T
&
rhs
)
const
noexcept
{
return
fmt
::
basic_string_view
<
Char
>
(
rhs
).
compare
(
buffer
)
==
0
;
return
fmt
::
basic_string_view
<
Char
>
(
rhs
).
compare
(
buffer
)
==
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