本文整理汇总了C++中mozilla::IsNegativeZero方法的典型用法代码示例。如果您正苦于以下问题:C++ mozilla::IsNegativeZero方法的具体用法?C++ mozilla::IsNegativeZero怎么用?C++ mozilla::IsNegativeZero使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类mozilla
的用法示例。
在下文中一共展示了mozilla::IsNegativeZero方法的8个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: memset
MathCache::MathCache() {
memset(table, 0, sizeof(table));
/* See comments in lookup(). */
JS_ASSERT(IsNegativeZero(-0.0));
JS_ASSERT(!IsNegativeZero(+0.0));
JS_ASSERT(hash(-0.0, MathCache::Sin) != hash(+0.0, MathCache::Sin));
}
示例2: js_copysign
double
js::ecmaAtan2(double y, double x)
{
#if defined(_MSC_VER)
/*
* MSVC's atan2 does not yield the result demanded by ECMA when both x
* and y are infinite.
* - The result is a multiple of pi/4.
* - The sign of y determines the sign of the result.
* - The sign of x determines the multiplicator, 1 or 3.
*/
if (IsInfinite(y) && IsInfinite(x)) {
double z = js_copysign(M_PI / 4, y);
if (x < 0)
z *= 3;
return z;
}
#endif
#if defined(SOLARIS) && defined(__GNUC__)
if (y == 0) {
if (IsNegativeZero(x))
return js_copysign(M_PI, y);
if (x == 0)
return y;
}
#endif
return atan2(y, x);
}
示例3:
static double
min_double(double x, double y)
{
// Math.min(num, NaN) => NaN, Math.min(-0, +0) => -0
if (x < y || IsNaN(x) || (x == y && IsNegativeZero(x)))
return x;
return y;
}
示例4:
double
js::math_min_impl(double x, double y)
{
// Math.min(num, NaN) => NaN, Math.min(-0, +0) => -0
if (x < y || IsNaN(x) || (x == y && IsNegativeZero(x)))
return x;
return y;
}
示例5: sin
double
js::math_sin_uncached(double x)
{
#ifdef _WIN64
// Workaround MSVC bug where sin(-0) is +0 instead of -0 on x64 on
// CPUs without FMA3 (pre-Haswell). See bug 1076670.
if (IsNegativeZero(x))
return -0.0;
#endif
return sin(x);
}
示例6: NumberValueToStringBuffer
static bool
RenderDouble(WasmRenderContext& c, double num)
{
if (IsNegativeZero(num))
return c.buffer.append("-0");
if (IsNaN(num))
return c.buffer.append("nan");
if (IsInfinite(num)) {
if (num > 0)
return c.buffer.append("infinity");
return c.buffer.append("-infinity");
}
return NumberValueToStringBuffer(c.cx, DoubleValue(num), c.buffer);
}
示例7: RenderNaN
static bool
RenderDouble(WasmRenderContext& c, double d)
{
if (IsNaN(d))
return RenderNaN(c.sb(), d);
if (IsNegativeZero(d))
return c.buffer.append("-0");
if (IsInfinite(d)) {
if (d > 0)
return c.buffer.append("infinity");
return c.buffer.append("-infinity");
}
return NumberValueToStringBuffer(c.cx, DoubleValue(d), c.sb());
}
示例8: CallArgsFromVp
bool
js_math_min(JSContext *cx, unsigned argc, Value *vp)
{
CallArgs args = CallArgsFromVp(argc, vp);
double minval = PositiveInfinity<double>();
for (unsigned i = 0; i < args.length(); i++) {
double x;
if (!ToNumber(cx, args[i], &x))
return false;
// Math.min(num, NaN) => NaN, Math.min(-0, +0) => -0
if (x < minval || IsNaN(x) || (x == minval && IsNegativeZero(x)))
minval = x;
}
args.rval().setNumber(minval);
return true;
}