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
fbfedcf0
Commit
fbfedcf0
authored
Jan 14, 2013
by
Victor Zverovich
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fix the issue with signbit in C++11.
parent
446f22fb
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
11 additions
and
5 deletions
+11
-5
format.cc
format.cc
+11
-5
No files found.
format.cc
View file @
fbfedcf0
...
...
@@ -31,10 +31,16 @@
#undef _SCL_SECURE_NO_WARNINGS
#define _SCL_SECURE_NO_WARNINGS
#include "format.h"
#include <math.h>
// Wrap signbit because when compiled in C++11 mode signbit is no longer a
// macro but a function defined in namespace std and the macro is undefined.
#ifndef _MSC_VER
inline
int
SignBit
(
double
value
)
{
return
signbit
(
value
);
}
#endif
#include "format.h"
#include <cassert>
#include <cctype>
#include <climits>
...
...
@@ -85,7 +91,7 @@ char *FillPadding(char *buffer,
}
#ifdef _MSC_VER
int
signb
it
(
double
value
)
{
int
SignB
it
(
double
value
)
{
if
(
value
<
0
)
return
1
;
if
(
value
==
value
)
return
0
;
int
dec
=
0
,
sign
=
0
;
...
...
@@ -188,9 +194,9 @@ void BasicFormatter::FormatDouble(
}
char
sign
=
0
;
// Use
signb
it instead of value < 0 because the latter is always
// Use
SignB
it instead of value < 0 because the latter is always
// false for NaN.
if
(
signb
it
(
value
))
{
if
(
SignB
it
(
value
))
{
sign
=
'-'
;
value
=
-
value
;
}
else
if
(
spec
.
sign_flag
())
{
...
...
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