Inhaltsverzeichnis

copysign()

#include <cmath>

double copysign (double x, double y) 

Liefert $|x| \cdot sgn(y)$ mit dem Betrag von x und dem Vorzeichen von y.

Parameter

x, y Gleitkommazahlen

Ergebnis

Rückgabewert: Zahl mit dem Betrag von x und Vorzeichen von y.

Siehe auch

signbit().

Beispiel

copysign.cpp
#include <cmath>
#include <iostream>
 
int main()
{
  std::cout << std::copysign(3.14, -1) << "\n";
}