Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Menu
Open sidebar
OpenDAS
dlib
Commits
c2b66ecc
Commit
c2b66ecc
authored
Oct 22, 2015
by
Davis King
Browse files
Cleaned up the float_details code and made it more standards conforming.
parent
57e187e8
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
3 additions
and
21 deletions
+3
-21
dlib/float_details.h
dlib/float_details.h
+3
-21
No files found.
dlib/float_details.h
View file @
c2b66ecc
...
...
@@ -3,7 +3,7 @@
#ifndef DLIB_FLOAT_DEtAILS_Hh_
#define DLIB_FLOAT_DEtAILS_Hh_
#include <math
.h
>
#include <
c
math>
#include "algs.h"
#include <limits>
...
...
@@ -100,24 +100,6 @@ namespace dlib
// ----------------------------------------------------------------------------------------
// ----------------------------------------------------------------------------------------
double
_frexp
(
double
v
,
int
*
e
)
const
{
return
frexp
(
v
,
e
);
}
float
_frexp
(
float
v
,
int
*
e
)
const
{
return
frexpf
(
v
,
e
);
}
double
_ldexp
(
double
v
,
int
e
)
const
{
return
ldexp
(
v
,
e
);
}
float
_ldexp
(
float
v
,
int
e
)
const
{
return
ldexpf
(
v
,
e
);
}
#ifdef __CYGWIN__
// frexpl and ldexpl aren't available on cygwin so just use the double version.
long
double
_frexp
(
long
double
v
,
int
*
e
)
const
{
return
_frexp
((
double
)
v
,
e
);
}
long
double
_ldexp
(
long
double
v
,
int
e
)
const
{
return
_ldexp
((
double
)
v
,
e
);
}
#else
long
double
_frexp
(
long
double
v
,
int
*
e
)
const
{
return
frexpl
(
v
,
e
);
}
long
double
_ldexp
(
long
double
v
,
int
e
)
const
{
return
ldexpl
(
v
,
e
);
}
#endif
template
<
typename
T
>
void
convert_from_T
(
const
T
&
val
...
...
@@ -138,7 +120,7 @@ namespace dlib
else
if
(
val
<
std
::
numeric_limits
<
T
>::
infinity
())
{
int
exp
;
mantissa
=
static_cast
<
int64
>
(
_
frexp
(
val
,
&
exp
)
*
(((
uint64
)
1
)
<<
digits
));
mantissa
=
static_cast
<
int64
>
(
std
::
frexp
(
val
,
&
exp
)
*
(((
uint64
)
1
)
<<
digits
));
exponent
=
exp
-
digits
;
// Compact the representation a bit by shifting off any low order bytes
...
...
@@ -162,7 +144,7 @@ namespace dlib
)
const
{
if
(
exponent
<
is_inf
)
return
_
ldexp
((
T
)
mantissa
,
exponent
);
return
std
::
ldexp
((
T
)
mantissa
,
exponent
);
else
if
(
exponent
==
is_inf
)
return
std
::
numeric_limits
<
T
>::
infinity
();
else
if
(
exponent
==
is_ninf
)
...
...
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