mirror of
https://github.com/serde-rs/serde.git
synced 2025-10-03 07:45:38 +00:00
Float copysign does not exist in libcore yet
This commit is contained in:
parent
d2fcc346b9
commit
6ba9c12ff6
@ -187,12 +187,12 @@ macro_rules! num_as_copysign_self {
|
|||||||
where
|
where
|
||||||
E: Error,
|
E: Error,
|
||||||
{
|
{
|
||||||
#[cfg(no_float_copysign)]
|
#[cfg(any(no_float_copysign, not(feature = "std")))]
|
||||||
{
|
{
|
||||||
Ok(v as Self::Value)
|
Ok(v as Self::Value)
|
||||||
}
|
}
|
||||||
|
|
||||||
#[cfg(not(no_float_copysign))]
|
#[cfg(all(not(no_float_copysign), feature = "std"))]
|
||||||
{
|
{
|
||||||
// Preserve sign of NaN. The `as` produces a nondeterministic sign.
|
// Preserve sign of NaN. The `as` produces a nondeterministic sign.
|
||||||
let sign = if v.is_sign_positive() { 1.0 } else { -1.0 };
|
let sign = if v.is_sign_positive() { 1.0 } else { -1.0 };
|
||||||
|
Loading…
x
Reference in New Issue
Block a user