sdlCopysign function

double sdlCopysign(
  1. double x,
  2. double y
)

Copy the sign of one floating-point value to another.

The definition of copysign is that copysign(x, y) = abs(x) * sign(y).

Domain: -INF <= x <= INF, -INF <= y <= f

Range: -INF <= z <= INF

This function operates on double-precision floating point values, use SDL_copysignf for single-precision floats.

\param x floating point value to use as the magnitude. \param y floating point value to use as the sign. \returns the floating point value with the sign of y and the magnitude of x.

\threadsafety It is safe to call this function from any thread.

\since This function is available since SDL 3.1.3.

\sa SDL_copysignf \sa SDL_fabs

extern SDL_DECLSPEC double SDLCALL SDL_copysign(double x, double y)

Implementation

double sdlCopysign(double x, double y) {
  final sdlCopysignLookupFunction = libSdl3.lookupFunction<
      Double Function(Double x, Double y),
      double Function(double x, double y)>('SDL_copysign');
  return sdlCopysignLookupFunction(x, y);
}