Skip to content

Commit

Permalink
Float copysign does not exist in libcore yet
Browse files Browse the repository at this point in the history
  • Loading branch information
dtolnay committed Oct 26, 2023
1 parent d2fcc34 commit 6ba9c12
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions serde/src/de/impls.rs
Original file line number Diff line number Diff line change
Expand Up @@ -187,12 +187,12 @@ macro_rules! num_as_copysign_self {
where
E: Error,
{
#[cfg(no_float_copysign)]
#[cfg(any(no_float_copysign, not(feature = "std")))]
{
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.
let sign = if v.is_sign_positive() { 1.0 } else { -1.0 };
Expand Down

0 comments on commit 6ba9c12

Please sign in to comment.