27 #define HAVE_FLOAT_H 0
48 #include "operations.h"
53 bool KJS::isNaN(
double d)
58 bool KJS::isInf(
double d)
63 bool KJS::isPosInf(
double d)
65 return ( isinf(d) && d > 0 );
68 bool KJS::isNegInf(
double d)
70 return ( isinf(d) && d < 0 );
80 if (t1 == UndefinedType || t1 == NullType)
86 if ( isNaN( d1 ) || isNaN( d2 ) )
92 if (t1 == BooleanType)
96 return (v1.imp() == v2.imp());
100 if ((t1 == NullType && t2 == UndefinedType) || (t1 == UndefinedType && t2 == NullType))
102 if (t1 == NumberType && t2 == StringType) {
104 return equal(exec,v1, n2);
106 if ((t1 == StringType && t2 == NumberType) || t1 == BooleanType) {
108 return equal(exec,n1, v2);
110 if (t2 == BooleanType) {
112 return equal(exec,v1, n2);
114 if ((t1 == StringType || t1 == NumberType) && t2 >= ObjectType) {
116 return equal(exec,v1, p2);
118 if (t1 >= ObjectType && (t2 == StringType || t2 == NumberType)) {
120 return equal(exec,p1, v2);
133 if (t1 == UndefinedType || t1 == NullType)
135 if (t1 == NumberType) {
138 if (isNaN(n1) || isNaN(n2))
144 }
else if (t1 == StringType) {
146 }
else if (t2 == BooleanType) {
149 if (v1.imp() == v2.imp())
161 if (p1.
type() == StringType && p2.
type() == StringType)
166 if ( isNaN( n1 ) || isNaN( n2 ) )
171 if ( isPosInf( n1 ) )
173 if ( isPosInf( n2 ) )
175 if ( isNegInf( n2 ) )
177 if ( isNegInf( n1 ) )
179 return (n1 < n2) ? 1 : 0;
182 int KJS::maxInt(
int d1,
int d2)
184 return (d1 > d2) ? d1 : d2;
187 int KJS::minInt(
int d1,
int d2)
189 return (d1 < d2) ? d1 : d2;
196 Type preferred = oper ==
'+' ? UnspecifiedType : NumberType;
200 if ((p1.
type() == StringType || p2.
type() == StringType) && oper ==
'+') {
226 else if (oper ==
'/')
229 result = fmod(n1, n2);
Represents the current state of script execution.
Represents an primitive Number value.
Represents an primitive String value.
Value objects are act as wrappers ("smart pointers") around ValueImp objects and their descendents.
UString toString(ExecState *exec) const
Performs the ToString type conversion operation on this value (ECMA 9.8)
Value toPrimitive(ExecState *exec, Type preferredType=UnspecifiedType) const
Performs the ToPrimitive type conversion operation on this value (ECMA 9.1)
bool toBoolean(ExecState *exec) const
Performs the ToBoolean type conversion operation on this value (ECMA 9.2)
Type type() const
Returns the type of value.
double toNumber(ExecState *exec) const
Performs the ToNumber type conversion operation on this value (ECMA 9.3)