@Override public void visit(FloatConstant node) { resultValue = node.getValue(); }
@Override public void visit(FloatConstant node) { result = node.getValue(); }
public boolean isPowerOf2(Expression node) { double f; int fi; if (node instanceof FloatConstant) { f = ((FloatConstant) node).getValue(); fi = (int) ((FloatConstant) node).getValue(); if ((fi >=2) &&(f == fi) && (Integer.bitCount(fi) == 1 )) { return true; } else { return false; } } else { return false; } }
@Override public void visit(FloatConstant floatConstant) { if (Double.isNaN(floatConstant.getValue())) code.append("undefined"); else if (compare(floatConstant.getValue(), Math.floor(floatConstant.getValue())) == 0) { code.append((int) floatConstant.getValue()); } else { code.append(Double.toString(floatConstant.getValue())); } }
@Override public void visit(FloatConstant floatConstant) { code.append(Double.toString(floatConstant.getValue())); //code.append('d'); }
@Override public void visit(FloatConstant node) { result.append(Double.toString(node.getValue())); }
@Override public void visit(FloatConstant floatConstant) { code.append(Double.toString(floatConstant.getValue())); }
@Override public void visit(FloatConstant floatConstant) { code.append(Double.toString(floatConstant.getValue()).replace('E', 'e')); }
@Override public void visit(FloatConstant floatConstant) { code.append(Double.toString(floatConstant.getValue()).replace('E', 'e')); }
private double getValueOfExpression(Expression e) { if (e instanceof FloatConstant) { return ((FloatConstant) e).getValue(); } else return values.get(((Variable) e).getName())[0]; } }
@Override public void visit(FloatConstant node) { result = null; double multiplicator = Math.pow(10, numberOfDigits); result = new FloatConstant(Math.round(node.getValue() * multiplicator) / multiplicator); }
@Override public void visit(FloatConstant node) { resultValue = new Constant(node.getValue()); }
@Override public void visit(FloatConstant node) { result = new RealInterval(node.getValue()); }
@Override public void visit(FloatConstant floatConstant) { append(Double.toString(floatConstant.getValue())); append('d'); }
@Override public void visit(AssignmentNode node) { if (node.getValue() instanceof FloatConstant) { double value = ((FloatConstant) node.getValue()).getValue(); if (Math.abs(value) <= EPSILON) toRemove.add(node); } super.visit(node); }
@Override public void visit(AssignmentNode node) { String name = node.getVariable().getName(); Multivector mv; if (!multivectors.containsKey(name)) { mv = new Multivector(16); multivectors.put(name, mv); } else mv = multivectors.get(name); MultivectorComponent mvC = (MultivectorComponent) node.getVariable(); mv.entries[mvC.getBladeIndex()] = ((FloatConstant) node.getValue()).getValue(); super.visit(node); }
@Override public void visit(Division node) { if (node.getRight() instanceof FloatConstant) { FloatConstant newLeft = new FloatConstant(1/((FloatConstant) node.getRight()).getValue()); replaceWith = new Multiplication(newLeft, node.getLeft()); } }
@Override public void visit(Division node) { System.out.println("MyDivVisit"); if (isPowerOf2(node.getRight())) { int toshift = Integer.numberOfTrailingZeros((int) ((FloatConstant) node.getRight()).getValue()); node.getLeft().accept(this); Operation tobedivided = toappend; ConstantShift cs = new ConstantShift(toshift, ShiftMode.Right); cs.setData(tobedivided); toappend = cs; addToGraph(cs); }else{ visitbinary(node, DIVISION); }}