本文整理汇总了C++中ASTNode::getDenominator方法的典型用法代码示例。如果您正苦于以下问题:C++ ASTNode::getDenominator方法的具体用法?C++ ASTNode::getDenominator怎么用?C++ ASTNode::getDenominator使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类ASTNode
的用法示例。
在下文中一共展示了ASTNode::getDenominator方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: if
/**
* Constructor that makes a ConverterASTNode from an ASTNode.
*/
ConverterASTNode::ConverterASTNode(const ASTNode &templ): ASTNode(templ.getType())
{
if (this->getType() == AST_RATIONAL)
{
this->mDenominator = templ.getDenominator();
this->mInteger = templ.getNumerator();
}
else if (this->getType() == AST_REAL || this->getType() == AST_REAL_E)
{
this->mExponent = templ.getExponent();
this->mReal = templ.getMantissa();
}
if (this->getType() == AST_PLUS || this->getType() == AST_MINUS || this->getType() == AST_TIMES || this->getType() == AST_DIVIDE || this->getType() == AST_POWER)
{
this->mChar = templ.getCharacter();
}
else if (this->getType() == AST_INTEGER)
{
this->mInteger = templ.getInteger();
}
if ((!this->isOperator()) && (!this->isNumber()))
{
this->setName(templ.getName());
}
unsigned int counter;
for (counter = 0; counter < templ.getNumChildren(); counter++)
{
this->addChild(new ConverterASTNode(*templ.getChild(counter)));
}
};
示例2: dim
//.........这里部分代码省略.........
SBMLTransforms::clearComponentValues();
// but it may not be an integer
#if defined(__linux)
if (!std::isnan(value))
#else
if (!isnan(value))
#endif
// we cant check
{
isExpression = 1;
}
else
{
if (ceil(value) == value)
{
isInteger = 1;
}
}
}
}
if (isRational == 1)
{
//FIX-ME will need sorting for double exponents
//* (2) if the second argument b is a rational number n/m,
//* it must be possible to derive the m-th root of (a{unit})n,
//* where {unit} signifies the units associated with a;
unsigned int impossible = 0;
for (unsigned int n = 0; impossible == 0 && n < unitsArg1->getNumUnits(); n++)
{
if ((int)(unitsArg1->getUnit(n)->getExponent()) * child->getInteger() %
child->getDenominator() != 0)
impossible = 1;
}
if (impossible)
logRationalPowerConflict(node, sb);
}
else if (isExpression == 1)
{
logExpressionPowerConflict(node, sb);
}
else if (isInteger == 0)
{
logNonIntegerPowerConflict(node, sb);
}
}
// if (!areEquivalent(dim, unitsPower))
// {
// /* 'v' does not have units of dimensionless. */
// /* If the power 'n' is a parameter, check if its units are either
// * undeclared or declared as dimensionless. If either is the case,
// * the value of 'n' must be an integer.
// */
// const Parameter *param = NULL;