| 224 | |
| 225 | |
| 226 | int MathLib::value::compare(const MathLib::value &v) const |
| 227 | { |
| 228 | value temp(*this); |
| 229 | temp.promote(v); |
| 230 | |
| 231 | if (temp.isFloat()) { |
| 232 | if (temp.mDoubleValue < v.getDoubleValue()) |
| 233 | return -1; |
| 234 | if (temp.mDoubleValue > v.getDoubleValue()) |
| 235 | return 1; |
| 236 | return 0; |
| 237 | } |
| 238 | |
| 239 | if (temp.mIsUnsigned) { |
| 240 | if (static_cast<unsigned long long>(mIntValue) < static_cast<unsigned long long>(v.mIntValue)) |
| 241 | return -1; |
| 242 | if (static_cast<unsigned long long>(mIntValue) > static_cast<unsigned long long>(v.mIntValue)) |
| 243 | return 1; |
| 244 | return 0; |
| 245 | } |
| 246 | |
| 247 | if (mIntValue < v.mIntValue) |
| 248 | return -1; |
| 249 | if (mIntValue > v.mIntValue) |
| 250 | return 1; |
| 251 | return 0; |
| 252 | } |
| 253 | |
| 254 | MathLib::value MathLib::value::add(int v) const |
| 255 | { |