27 #define HAVE_FLOAT_H 0 28 #define HAVE_FUNC__FINITE 0 41 #ifndef HAVE_FUNC_ISINF 51 #include "operations.h" 56 bool KJS::isNaN(
double d)
58 #ifdef HAVE_FUNC_ISNAN 60 #elif defined HAVE_FLOAT_H 61 return _isnan(d) != 0;
67 bool KJS::isInf(
double d)
69 #if defined(HAVE_FUNC_ISINF) 71 #elif HAVE_FUNC_FINITE 72 return finite(d) == 0 && d == d;
73 #elif HAVE_FUNC__FINITE 74 return _finite(d) == 0 && d == d;
80 bool KJS::isPosInf(
double d)
82 #if defined(HAVE_FUNC_ISINF) 83 return (isinf(d) == 1);
84 #elif HAVE_FUNC_FINITE 85 return finite(d) == 0 && d == d;
86 #elif HAVE_FUNC__FINITE 87 return _finite(d) == 0 && d == d;
93 bool KJS::isNegInf(
double d)
95 #if defined(HAVE_FUNC_ISINF) 96 return (isinf(d) == -1);
97 #elif HAVE_FUNC_FINITE 98 return finite(d) == 0 && d == d;
99 #elif HAVE_FUNC__FINITE 100 return _finite(d) == 0 && d == d;
113 if (t1 == UndefinedType || t1 == NullType)
115 if (t1 == NumberType)
119 if ( isNaN( d1 ) || isNaN( d2 ) )
123 if (t1 == StringType)
125 if (t1 == BooleanType)
129 return (v1.imp() == v2.imp());
133 if ((t1 == NullType && t2 == UndefinedType) || (t1 == UndefinedType && t2 == NullType))
135 if (t1 == NumberType && t2 == StringType) {
137 return equal(exec,v1, n2);
139 if ((t1 == StringType && t2 == NumberType) || t1 == BooleanType) {
141 return equal(exec,n1, v2);
143 if (t2 == BooleanType) {
145 return equal(exec,v1, n2);
147 if ((t1 == StringType || t1 == NumberType) && t2 >= ObjectType) {
149 return equal(exec,v1, p2);
151 if (t1 >= ObjectType && (t2 == StringType || t2 == NumberType)) {
153 return equal(exec,p1, v2);
166 if (t1 == UndefinedType || t1 == NullType)
168 if (t1 == NumberType) {
171 if (isNaN(n1) || isNaN(n2))
177 }
else if (t1 == StringType) {
179 }
else if (t2 == BooleanType) {
182 if (v1.imp() == v2.imp())
194 if (p1.
type() == StringType && p2.
type() == StringType)
199 if ( isNaN( n1 ) || isNaN( n2 ) )
204 if ( isPosInf( n1 ) )
206 if ( isPosInf( n2 ) )
208 if ( isNegInf( n2 ) )
210 if ( isNegInf( n1 ) )
212 return (n1 < n2) ? 1 : 0;
215 int KJS::maxInt(
int d1,
int d2)
217 return (d1 > d2) ? d1 : d2;
220 int KJS::minInt(
int d1,
int d2)
222 return (d1 < d2) ? d1 : d2;
229 Type preferred = oper ==
'+' ? UnspecifiedType : NumberType;
233 if ((p1.
type() == StringType || p2.
type() == StringType) && oper ==
'+') {
259 else if (oper ==
'/')
262 result = fmod(n1, n2);
Value objects are act as wrappers ("smart pointers") around ValueImp objects and their descendents...
Type type() const
Returns the type of value.
Represents an primitive Number value.
bool toBoolean(ExecState *exec) const
Performs the ToBoolean type conversion operation on this value (ECMA 9.2)
double toNumber(ExecState *exec) const
Performs the ToNumber type conversion operation on this value (ECMA 9.3)
Represents an primitive String value.
Value toPrimitive(ExecState *exec, Type preferredType=UnspecifiedType) const
Performs the ToPrimitive type conversion operation on this value (ECMA 9.1)
UString toString(ExecState *exec) const
Performs the ToString type conversion operation on this value (ECMA 9.8)
Represents the current state of script execution.