void iPhoneDoubleCopy::eval() { DoubleData *src = (DoubleData *)systemEngine->dStack.pop(); DoubleData *tgt = new DoubleData(); tgt->clear(); tgt->set(((DoubleData *)src)->get()); systemEngine->dStack.push(src); systemEngine->dStack.push(tgt); };
void iPhoneSubtractDoubleDouble::eval() { DoubleData *acc = (DoubleData *)systemEngine->getData(); DoubleData *num = (DoubleData *)systemEngine->getData(); DoubleData *result = new DoubleData(); result->set(num->get() - acc->get()); systemEngine->putData(result); delete num; delete acc; }
void iPhoneDivideDoubleDouble::eval() { DoubleData *acc = (DoubleData *)systemEngine->getData(); DoubleData *num = (DoubleData *)systemEngine->getData(); if (acc->get() == 0) { systemEngine->setError(eDivZero); } else { DoubleData *result = new DoubleData(); result->set(num->get() / acc->get()); systemEngine->putData(result); } delete num; delete acc; }