WTF
Go to the documentation of this file.
26#ifndef WTF_MathExtras_h
27#define WTF_MathExtras_h
33#include "kjs/operations.h"
46const float piFloat = 3.14159265358979323846f;
49const float piFloat =
static_cast<float>(M_PI);
63 inline bool isinf(
double num) {
return !_finite(num) && !_isnan(num); }
64 inline bool isnan(
double num) {
return _isnan(num); }
65 inline long lround(
double num) {
return num > 0 ? num + 0.5 : ceil(num - 0.5); }
66 inline long lroundf(
float num) {
return num > 0 ? num + 0.5f : ceilf(num - 0.5f); }
67 inline double round(
double num) {
return num > 0 ? floor(num + 0.5) : ceil(num - 0.5); }
68 inline float roundf(
float num) {
return num > 0 ? floorf(num + 0.5f) : ceilf(num - 0.5f); }
69 inline bool signbit(
double num) {
return _copysign(1.0, num) < 0; }
75inline double wtf_atan2(
double x,
double y)
77 static double posInf = std::numeric_limits<double>::infinity();
78 static double negInf = -std::numeric_limits<double>::infinity();
80 double result = KJS::NaN;
82 if (x == posInf && y == posInf)
84 else if (x == posInf && y == negInf)
86 else if (x == negInf && y == posInf)
88 else if (x == negInf && y == negInf)
91 result = ::atan2(x, y);
97#define wtf_atan2(x, y) atan2(x, y)
104inline double wtf_fmod(
double x,
double y) {
return (!isinf(x) && isinf(y)) ? x : fmod(x, y); }
106#define fmod(x, y) wtf_fmod(x, y)
110#define atan2(x, y) wtf_atan2(x, y)
116inline double deg2grad(
double d) {
return d * 400.0 / 360.0; }
117inline double grad2deg(
double g) {
return g * 360.0 / 400.0; }
123inline float deg2grad(
float d) {
return d * 400.0f / 360.0f; }
124inline float grad2deg(
float g) {
return g * 360.0f / 400.0f; }
This file is part of the KDE documentation.
Documentation copyright © 1996-2023 The KDE developers.
Generated on Mon Feb 20 2023 00:00:00 by
doxygen 1.9.6 written
by
Dimitri van Heesch, © 1997-2006
KDE's Doxygen guidelines are available online.