- All Superinterfaces:
ASTNode,ConstantNode,ExpressionNode,ForLoopInitializerNode,InitializerNode,SizeableNode
A floating constant node represents an occurrence of a literal floating point
number in a program. The C11 Standard specifies the formats for floating
point constants in Sec. 6.4.4.2:
A floating constant has a significand part that may be followed by an exponent part and a suffix that specifies its type. The components of the significand part may include a digit sequence representing the whole-number part, followed by a period (.), followed by a digit sequence representing the fraction part. The components of the exponent part are an e, E, p, or P followed by an exponent consisting of an optionally signed digit sequence. Either the whole-number part or the fraction part has to be present; for decimal floating constants, either the period or the exponent part has to be present.
-
Nested Class Summary
Nested classes/interfaces inherited from interface dev.civl.abc.ast.node.IF.ASTNode
ASTNode.NodeKindNested classes/interfaces inherited from interface dev.civl.abc.ast.node.IF.expression.ConstantNode
ConstantNode.ConstantKindNested classes/interfaces inherited from interface dev.civl.abc.ast.node.IF.expression.ExpressionNode
ExpressionNode.ExpressionKind -
Method Summary
Modifier and TypeMethodDescriptioncopy()Returns a deep copy of this AST node.exponent()Returns the exponent part of the constant, including the letter.Returns the fraction part of the significand.Returns the floating (real or complex) value obtained by interpreting the representation of the constant.booleanIs this a complex value (not real)?Returns the whole-number part of the significand.Methods inherited from interface dev.civl.abc.ast.node.IF.ASTNode
addAllTransformAnnotations, addTransformAnnotation, child, childIndex, children, diff, equiv, getAttribute, getOwner, getScope, getSource, id, keepOnly, nextDFS, nodeKind, numChildren, parent, prettyPrint, prettyRepresentation, prettyRepresentation, print, remove, removeChild, removeTransformAnnotation, setAttribute, setChild, setId, setOwner, setScope, toString, transformAnnotationsMethods inherited from interface dev.civl.abc.ast.node.IF.expression.ConstantNode
constantKind, getStringRepresentation, setStringRepresentationMethods inherited from interface dev.civl.abc.ast.node.IF.expression.ExpressionNode
addConversion, expressionKind, getConversion, getConvertedType, getInitialType, getNumConversions, isConstantExpression, isLvalue, removeConversions, setInitialTypeMethods inherited from interface dev.civl.abc.ast.node.IF.declaration.InitializerNode
isSideEffectFreeMethods inherited from interface dev.civl.abc.ast.node.IF.expression.SizeableNode
getType
-
Method Details
-
isComplex
boolean isComplex()Is this a complex value (not real)?- Returns:
trueiff the value is a complex number, not a real number
-
wholePart
String wholePart()Returns the whole-number part of the significand. This is the digit sequence preceding the "." or just the entire significand if the "." is not present.- Returns:
- the whole-number part of the significand
-
fractionPart
String fractionPart()Returns the fraction part of the significand. This is the digit sequence following the ".". May returnnullif not fraction part is present.- Returns:
- the fraction part of the significand
-
exponent
String exponent()Returns the exponent part of the constant, including the letter. May returnnullif the exponent part is not present.- Returns:
- the exponent part of the constant
-
getConstantValue
FloatingValue getConstantValue()Returns the floating (real or complex) value obtained by interpreting the representation of the constant.- Specified by:
getConstantValuein interfaceConstantNode- Returns:
- the floating value
-
copy
FloatingConstantNode copy()Description copied from interface:ASTNodeReturns a deep copy of this AST node. The node and all of its descendants will be cloned. The cloning does not copy analysis or attribute information.- Specified by:
copyin interfaceASTNode- Specified by:
copyin interfaceConstantNode- Specified by:
copyin interfaceExpressionNode- Specified by:
copyin interfaceForLoopInitializerNode- Specified by:
copyin interfaceInitializerNode- Specified by:
copyin interfaceSizeableNode- Returns:
- deep copy of this node
-