|
20 | 20 | package org.sosy_lab.java_smt.api;
|
21 | 21 |
|
22 | 22 | import org.sosy_lab.common.rationals.Rational;
|
| 23 | +import org.sosy_lab.java_smt.api.FormulaType.FloatingPointType; |
23 | 24 |
|
24 | 25 | import java.math.BigDecimal;
|
25 | 26 |
|
| 27 | +/** |
| 28 | + * Floating point operations. |
| 29 | + * |
| 30 | + * Most operations are overloaded: there is an option of either using the default |
| 31 | + * rounding mode (set via the option {@code solver.floatingPointRoundingMode}), |
| 32 | + * or providing the rounding mode explicitly. |
| 33 | + */ |
26 | 34 | public interface FloatingPointFormulaManager {
|
27 |
| - FloatingPointFormula makeNumber(double n, FormulaType.FloatingPointType type); |
28 | 35 |
|
29 |
| - FloatingPointFormula makeNumber(BigDecimal n, FormulaType.FloatingPointType type); |
| 36 | + FloatingPointFormula makeNumber(double n, FloatingPointType type); |
| 37 | + |
| 38 | + FloatingPointFormula makeNumber( |
| 39 | + double n, FloatingPointType type, FloatingPointRoundingMode pFloatingPointRoundingMode); |
| 40 | + |
| 41 | + FloatingPointFormula makeNumber(BigDecimal n, FloatingPointType type); |
| 42 | + |
| 43 | + FloatingPointFormula makeNumber( |
| 44 | + BigDecimal n, FloatingPointType type, FloatingPointRoundingMode pFloatingPointRoundingMode); |
| 45 | + |
| 46 | + FloatingPointFormula makeNumber(String n, FloatingPointType type); |
| 47 | + |
| 48 | + FloatingPointFormula makeNumber( |
| 49 | + String n, FloatingPointType type, FloatingPointRoundingMode pFloatingPointRoundingMode); |
30 | 50 |
|
31 |
| - FloatingPointFormula makeNumber(String n, FormulaType.FloatingPointType type); |
| 51 | + FloatingPointFormula makeNumber(Rational n, FloatingPointType type); |
32 | 52 |
|
33 |
| - FloatingPointFormula makeNumber(Rational n, FormulaType.FloatingPointType type); |
| 53 | + FloatingPointFormula makeNumber( |
| 54 | + Rational n, FloatingPointType type, FloatingPointRoundingMode pFloatingPointRoundingMode); |
34 | 55 |
|
35 |
| - FloatingPointFormula makeVariable(String pVar, FormulaType.FloatingPointType type); |
| 56 | + FloatingPointFormula makeVariable(String pVar, FloatingPointType type); |
36 | 57 |
|
37 |
| - FloatingPointFormula makePlusInfinity(FormulaType.FloatingPointType type); |
| 58 | + FloatingPointFormula makePlusInfinity(FloatingPointType type); |
38 | 59 |
|
39 |
| - FloatingPointFormula makeMinusInfinity(FormulaType.FloatingPointType type); |
| 60 | + FloatingPointFormula makeMinusInfinity(FloatingPointType type); |
40 | 61 |
|
41 |
| - FloatingPointFormula makeNaN(FormulaType.FloatingPointType type); |
| 62 | + FloatingPointFormula makeNaN(FloatingPointType type); |
42 | 63 |
|
43 | 64 | <T extends Formula> T castTo(FloatingPointFormula number, FormulaType<T> targetType);
|
44 | 65 |
|
| 66 | + <T extends Formula> T castTo( |
| 67 | + FloatingPointFormula number, |
| 68 | + FormulaType<T> targetType, |
| 69 | + FloatingPointRoundingMode pFloatingPointRoundingMode); |
| 70 | + |
| 71 | + FloatingPointFormula castFrom(Formula number, boolean signed, FloatingPointType targetType); |
| 72 | + |
45 | 73 | FloatingPointFormula castFrom(
|
46 |
| - Formula number, boolean signed, FormulaType.FloatingPointType targetType); |
| 74 | + Formula number, |
| 75 | + boolean signed, |
| 76 | + FloatingPointType targetType, |
| 77 | + FloatingPointRoundingMode pFloatingPointRoundingMode); |
47 | 78 |
|
48 | 79 | // ----------------- Arithmetic relations, return type NumeralFormula -----------------
|
49 | 80 |
|
50 | 81 | FloatingPointFormula negate(FloatingPointFormula number);
|
51 | 82 |
|
52 | 83 | FloatingPointFormula add(FloatingPointFormula number1, FloatingPointFormula number2);
|
53 | 84 |
|
| 85 | + FloatingPointFormula add( |
| 86 | + FloatingPointFormula number1, |
| 87 | + FloatingPointFormula number2, |
| 88 | + FloatingPointRoundingMode pFloatingPointRoundingMode); |
| 89 | + |
54 | 90 | FloatingPointFormula subtract(FloatingPointFormula number1, FloatingPointFormula number2);
|
55 | 91 |
|
| 92 | + FloatingPointFormula subtract( |
| 93 | + FloatingPointFormula number1, |
| 94 | + FloatingPointFormula number2, |
| 95 | + FloatingPointRoundingMode pFloatingPointRoundingMode); |
| 96 | + |
56 | 97 | FloatingPointFormula divide(FloatingPointFormula number1, FloatingPointFormula number2);
|
57 | 98 |
|
| 99 | + FloatingPointFormula divide( |
| 100 | + FloatingPointFormula number1, |
| 101 | + FloatingPointFormula number2, |
| 102 | + FloatingPointRoundingMode pFloatingPointRoundingMode); |
| 103 | + |
58 | 104 | FloatingPointFormula multiply(FloatingPointFormula number1, FloatingPointFormula number2);
|
59 | 105 |
|
| 106 | + FloatingPointFormula multiply( |
| 107 | + FloatingPointFormula number1, |
| 108 | + FloatingPointFormula number2, |
| 109 | + FloatingPointRoundingMode pFloatingPointRoundingMode); |
| 110 | + |
60 | 111 | // ----------------- Numeric relations, return type BooleanFormula -----------------
|
61 | 112 |
|
62 | 113 | /**
|
|
0 commit comments