
(FPCore (d1 d2 d3) :precision binary64 (+ (+ (* d1 d2) (* (+ d3 5.0) d1)) (* d1 32.0)))
double code(double d1, double d2, double d3) {
return ((d1 * d2) + ((d3 + 5.0) * d1)) + (d1 * 32.0);
}
real(8) function code(d1, d2, d3)
real(8), intent (in) :: d1
real(8), intent (in) :: d2
real(8), intent (in) :: d3
code = ((d1 * d2) + ((d3 + 5.0d0) * d1)) + (d1 * 32.0d0)
end function
public static double code(double d1, double d2, double d3) {
return ((d1 * d2) + ((d3 + 5.0) * d1)) + (d1 * 32.0);
}
def code(d1, d2, d3): return ((d1 * d2) + ((d3 + 5.0) * d1)) + (d1 * 32.0)
function code(d1, d2, d3) return Float64(Float64(Float64(d1 * d2) + Float64(Float64(d3 + 5.0) * d1)) + Float64(d1 * 32.0)) end
function tmp = code(d1, d2, d3) tmp = ((d1 * d2) + ((d3 + 5.0) * d1)) + (d1 * 32.0); end
code[d1_, d2_, d3_] := N[(N[(N[(d1 * d2), $MachinePrecision] + N[(N[(d3 + 5.0), $MachinePrecision] * d1), $MachinePrecision]), $MachinePrecision] + N[(d1 * 32.0), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
\left(d1 \cdot d2 + \left(d3 + 5\right) \cdot d1\right) + d1 \cdot 32
\end{array}
Sampling outcomes in binary64 precision:
Herbie found 7 alternatives:
| Alternative | Accuracy | Speedup |
|---|
(FPCore (d1 d2 d3) :precision binary64 (+ (+ (* d1 d2) (* (+ d3 5.0) d1)) (* d1 32.0)))
double code(double d1, double d2, double d3) {
return ((d1 * d2) + ((d3 + 5.0) * d1)) + (d1 * 32.0);
}
real(8) function code(d1, d2, d3)
real(8), intent (in) :: d1
real(8), intent (in) :: d2
real(8), intent (in) :: d3
code = ((d1 * d2) + ((d3 + 5.0d0) * d1)) + (d1 * 32.0d0)
end function
public static double code(double d1, double d2, double d3) {
return ((d1 * d2) + ((d3 + 5.0) * d1)) + (d1 * 32.0);
}
def code(d1, d2, d3): return ((d1 * d2) + ((d3 + 5.0) * d1)) + (d1 * 32.0)
function code(d1, d2, d3) return Float64(Float64(Float64(d1 * d2) + Float64(Float64(d3 + 5.0) * d1)) + Float64(d1 * 32.0)) end
function tmp = code(d1, d2, d3) tmp = ((d1 * d2) + ((d3 + 5.0) * d1)) + (d1 * 32.0); end
code[d1_, d2_, d3_] := N[(N[(N[(d1 * d2), $MachinePrecision] + N[(N[(d3 + 5.0), $MachinePrecision] * d1), $MachinePrecision]), $MachinePrecision] + N[(d1 * 32.0), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
\left(d1 \cdot d2 + \left(d3 + 5\right) \cdot d1\right) + d1 \cdot 32
\end{array}
(FPCore (d1 d2 d3) :precision binary64 (* d1 (+ d3 (+ d2 37.0))))
double code(double d1, double d2, double d3) {
return d1 * (d3 + (d2 + 37.0));
}
real(8) function code(d1, d2, d3)
real(8), intent (in) :: d1
real(8), intent (in) :: d2
real(8), intent (in) :: d3
code = d1 * (d3 + (d2 + 37.0d0))
end function
public static double code(double d1, double d2, double d3) {
return d1 * (d3 + (d2 + 37.0));
}
def code(d1, d2, d3): return d1 * (d3 + (d2 + 37.0))
function code(d1, d2, d3) return Float64(d1 * Float64(d3 + Float64(d2 + 37.0))) end
function tmp = code(d1, d2, d3) tmp = d1 * (d3 + (d2 + 37.0)); end
code[d1_, d2_, d3_] := N[(d1 * N[(d3 + N[(d2 + 37.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
d1 \cdot \left(d3 + \left(d2 + 37\right)\right)
\end{array}
Initial program 98.0%
cancel-sign-sub98.0%
+-commutative98.0%
*-commutative98.0%
distribute-lft-out100.0%
distribute-lft-neg-out100.0%
distribute-rgt-neg-in100.0%
distribute-lft-out--100.0%
associate-+r+100.0%
+-commutative100.0%
associate--l+100.0%
sub-neg100.0%
metadata-eval100.0%
metadata-eval100.0%
associate-+l+100.0%
metadata-eval100.0%
Simplified100.0%
(FPCore (d1 d2 d3)
:precision binary64
(if (<= d2 -15000.0)
(* d1 d2)
(if (or (<= d2 -1.5e-82)
(and (not (<= d2 -1.2e-148))
(or (<= d2 -4.2e-251)
(and (not (<= d2 2.45e-307)) (<= d2 7e-272)))))
(* d1 37.0)
(* d1 d3))))
double code(double d1, double d2, double d3) {
double tmp;
if (d2 <= -15000.0) {
tmp = d1 * d2;
} else if ((d2 <= -1.5e-82) || (!(d2 <= -1.2e-148) && ((d2 <= -4.2e-251) || (!(d2 <= 2.45e-307) && (d2 <= 7e-272))))) {
tmp = d1 * 37.0;
} else {
tmp = d1 * d3;
}
return tmp;
}
real(8) function code(d1, d2, d3)
real(8), intent (in) :: d1
real(8), intent (in) :: d2
real(8), intent (in) :: d3
real(8) :: tmp
if (d2 <= (-15000.0d0)) then
tmp = d1 * d2
else if ((d2 <= (-1.5d-82)) .or. (.not. (d2 <= (-1.2d-148))) .and. (d2 <= (-4.2d-251)) .or. (.not. (d2 <= 2.45d-307)) .and. (d2 <= 7d-272)) then
tmp = d1 * 37.0d0
else
tmp = d1 * d3
end if
code = tmp
end function
public static double code(double d1, double d2, double d3) {
double tmp;
if (d2 <= -15000.0) {
tmp = d1 * d2;
} else if ((d2 <= -1.5e-82) || (!(d2 <= -1.2e-148) && ((d2 <= -4.2e-251) || (!(d2 <= 2.45e-307) && (d2 <= 7e-272))))) {
tmp = d1 * 37.0;
} else {
tmp = d1 * d3;
}
return tmp;
}
def code(d1, d2, d3): tmp = 0 if d2 <= -15000.0: tmp = d1 * d2 elif (d2 <= -1.5e-82) or (not (d2 <= -1.2e-148) and ((d2 <= -4.2e-251) or (not (d2 <= 2.45e-307) and (d2 <= 7e-272)))): tmp = d1 * 37.0 else: tmp = d1 * d3 return tmp
function code(d1, d2, d3) tmp = 0.0 if (d2 <= -15000.0) tmp = Float64(d1 * d2); elseif ((d2 <= -1.5e-82) || (!(d2 <= -1.2e-148) && ((d2 <= -4.2e-251) || (!(d2 <= 2.45e-307) && (d2 <= 7e-272))))) tmp = Float64(d1 * 37.0); else tmp = Float64(d1 * d3); end return tmp end
function tmp_2 = code(d1, d2, d3) tmp = 0.0; if (d2 <= -15000.0) tmp = d1 * d2; elseif ((d2 <= -1.5e-82) || (~((d2 <= -1.2e-148)) && ((d2 <= -4.2e-251) || (~((d2 <= 2.45e-307)) && (d2 <= 7e-272))))) tmp = d1 * 37.0; else tmp = d1 * d3; end tmp_2 = tmp; end
code[d1_, d2_, d3_] := If[LessEqual[d2, -15000.0], N[(d1 * d2), $MachinePrecision], If[Or[LessEqual[d2, -1.5e-82], And[N[Not[LessEqual[d2, -1.2e-148]], $MachinePrecision], Or[LessEqual[d2, -4.2e-251], And[N[Not[LessEqual[d2, 2.45e-307]], $MachinePrecision], LessEqual[d2, 7e-272]]]]], N[(d1 * 37.0), $MachinePrecision], N[(d1 * d3), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;d2 \leq -15000:\\
\;\;\;\;d1 \cdot d2\\
\mathbf{elif}\;d2 \leq -1.5 \cdot 10^{-82} \lor \neg \left(d2 \leq -1.2 \cdot 10^{-148}\right) \land \left(d2 \leq -4.2 \cdot 10^{-251} \lor \neg \left(d2 \leq 2.45 \cdot 10^{-307}\right) \land d2 \leq 7 \cdot 10^{-272}\right):\\
\;\;\;\;d1 \cdot 37\\
\mathbf{else}:\\
\;\;\;\;d1 \cdot d3\\
\end{array}
\end{array}
if d2 < -15000Initial program 94.1%
cancel-sign-sub94.1%
+-commutative94.1%
*-commutative94.1%
distribute-lft-out100.0%
distribute-lft-neg-out100.0%
distribute-rgt-neg-in100.0%
distribute-lft-out--100.0%
associate-+r+100.0%
+-commutative100.0%
associate--l+100.0%
sub-neg100.0%
metadata-eval100.0%
metadata-eval100.0%
associate-+l+100.0%
metadata-eval100.0%
Simplified100.0%
Taylor expanded in d2 around inf 76.1%
if -15000 < d2 < -1.4999999999999999e-82 or -1.2000000000000001e-148 < d2 < -4.19999999999999964e-251 or 2.4500000000000001e-307 < d2 < 6.9999999999999993e-272Initial program 99.9%
cancel-sign-sub99.9%
+-commutative99.9%
*-commutative99.9%
distribute-lft-out99.9%
distribute-lft-neg-out99.9%
distribute-rgt-neg-in99.9%
distribute-lft-out--100.0%
associate-+r+100.0%
+-commutative100.0%
associate--l+100.0%
sub-neg100.0%
metadata-eval100.0%
metadata-eval100.0%
associate-+l+99.9%
metadata-eval99.9%
Simplified99.9%
Taylor expanded in d3 around 0 54.0%
Taylor expanded in d2 around 0 51.5%
if -1.4999999999999999e-82 < d2 < -1.2000000000000001e-148 or -4.19999999999999964e-251 < d2 < 2.4500000000000001e-307 or 6.9999999999999993e-272 < d2 Initial program 99.2%
cancel-sign-sub99.2%
+-commutative99.2%
*-commutative99.2%
distribute-lft-out100.0%
distribute-lft-neg-out100.0%
distribute-rgt-neg-in100.0%
distribute-lft-out--100.0%
associate-+r+100.0%
+-commutative100.0%
associate--l+100.0%
sub-neg100.0%
metadata-eval100.0%
metadata-eval100.0%
associate-+l+100.0%
metadata-eval100.0%
Simplified100.0%
Taylor expanded in d3 around inf 41.5%
Final simplification53.1%
(FPCore (d1 d2 d3) :precision binary64 (if (<= d3 128000.0) (* d1 (+ d2 37.0)) (if (or (<= d3 1.8e+81) (not (<= d3 2.2e+82))) (* d1 d3) (* d1 d2))))
double code(double d1, double d2, double d3) {
double tmp;
if (d3 <= 128000.0) {
tmp = d1 * (d2 + 37.0);
} else if ((d3 <= 1.8e+81) || !(d3 <= 2.2e+82)) {
tmp = d1 * d3;
} else {
tmp = d1 * d2;
}
return tmp;
}
real(8) function code(d1, d2, d3)
real(8), intent (in) :: d1
real(8), intent (in) :: d2
real(8), intent (in) :: d3
real(8) :: tmp
if (d3 <= 128000.0d0) then
tmp = d1 * (d2 + 37.0d0)
else if ((d3 <= 1.8d+81) .or. (.not. (d3 <= 2.2d+82))) then
tmp = d1 * d3
else
tmp = d1 * d2
end if
code = tmp
end function
public static double code(double d1, double d2, double d3) {
double tmp;
if (d3 <= 128000.0) {
tmp = d1 * (d2 + 37.0);
} else if ((d3 <= 1.8e+81) || !(d3 <= 2.2e+82)) {
tmp = d1 * d3;
} else {
tmp = d1 * d2;
}
return tmp;
}
def code(d1, d2, d3): tmp = 0 if d3 <= 128000.0: tmp = d1 * (d2 + 37.0) elif (d3 <= 1.8e+81) or not (d3 <= 2.2e+82): tmp = d1 * d3 else: tmp = d1 * d2 return tmp
function code(d1, d2, d3) tmp = 0.0 if (d3 <= 128000.0) tmp = Float64(d1 * Float64(d2 + 37.0)); elseif ((d3 <= 1.8e+81) || !(d3 <= 2.2e+82)) tmp = Float64(d1 * d3); else tmp = Float64(d1 * d2); end return tmp end
function tmp_2 = code(d1, d2, d3) tmp = 0.0; if (d3 <= 128000.0) tmp = d1 * (d2 + 37.0); elseif ((d3 <= 1.8e+81) || ~((d3 <= 2.2e+82))) tmp = d1 * d3; else tmp = d1 * d2; end tmp_2 = tmp; end
code[d1_, d2_, d3_] := If[LessEqual[d3, 128000.0], N[(d1 * N[(d2 + 37.0), $MachinePrecision]), $MachinePrecision], If[Or[LessEqual[d3, 1.8e+81], N[Not[LessEqual[d3, 2.2e+82]], $MachinePrecision]], N[(d1 * d3), $MachinePrecision], N[(d1 * d2), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;d3 \leq 128000:\\
\;\;\;\;d1 \cdot \left(d2 + 37\right)\\
\mathbf{elif}\;d3 \leq 1.8 \cdot 10^{+81} \lor \neg \left(d3 \leq 2.2 \cdot 10^{+82}\right):\\
\;\;\;\;d1 \cdot d3\\
\mathbf{else}:\\
\;\;\;\;d1 \cdot d2\\
\end{array}
\end{array}
if d3 < 128000Initial program 99.5%
cancel-sign-sub99.5%
+-commutative99.5%
*-commutative99.5%
distribute-lft-out100.0%
distribute-lft-neg-out100.0%
distribute-rgt-neg-in100.0%
distribute-lft-out--100.0%
associate-+r+100.0%
+-commutative100.0%
associate--l+100.0%
sub-neg100.0%
metadata-eval100.0%
metadata-eval100.0%
associate-+l+100.0%
metadata-eval100.0%
Simplified100.0%
Taylor expanded in d3 around 0 74.5%
if 128000 < d3 < 1.80000000000000003e81 or 2.2000000000000001e82 < d3 Initial program 93.3%
cancel-sign-sub93.3%
+-commutative93.3%
*-commutative93.3%
distribute-lft-out100.0%
distribute-lft-neg-out100.0%
distribute-rgt-neg-in100.0%
distribute-lft-out--100.0%
associate-+r+100.0%
+-commutative100.0%
associate--l+100.0%
sub-neg100.0%
metadata-eval100.0%
metadata-eval100.0%
associate-+l+100.0%
metadata-eval100.0%
Simplified100.0%
Taylor expanded in d3 around inf 76.0%
if 1.80000000000000003e81 < d3 < 2.2000000000000001e82Initial program 98.0%
cancel-sign-sub98.0%
+-commutative98.0%
*-commutative98.0%
distribute-lft-out100.0%
distribute-lft-neg-out100.0%
distribute-rgt-neg-in100.0%
distribute-lft-out--100.0%
associate-+r+100.0%
+-commutative100.0%
associate--l+100.0%
sub-neg100.0%
metadata-eval100.0%
metadata-eval100.0%
associate-+l+100.0%
metadata-eval100.0%
Simplified100.0%
Taylor expanded in d2 around inf 41.9%
Final simplification74.8%
(FPCore (d1 d2 d3) :precision binary64 (if (<= d3 6.2e-13) (* d1 (+ d2 37.0)) (* d1 (+ d3 d2))))
double code(double d1, double d2, double d3) {
double tmp;
if (d3 <= 6.2e-13) {
tmp = d1 * (d2 + 37.0);
} else {
tmp = d1 * (d3 + d2);
}
return tmp;
}
real(8) function code(d1, d2, d3)
real(8), intent (in) :: d1
real(8), intent (in) :: d2
real(8), intent (in) :: d3
real(8) :: tmp
if (d3 <= 6.2d-13) then
tmp = d1 * (d2 + 37.0d0)
else
tmp = d1 * (d3 + d2)
end if
code = tmp
end function
public static double code(double d1, double d2, double d3) {
double tmp;
if (d3 <= 6.2e-13) {
tmp = d1 * (d2 + 37.0);
} else {
tmp = d1 * (d3 + d2);
}
return tmp;
}
def code(d1, d2, d3): tmp = 0 if d3 <= 6.2e-13: tmp = d1 * (d2 + 37.0) else: tmp = d1 * (d3 + d2) return tmp
function code(d1, d2, d3) tmp = 0.0 if (d3 <= 6.2e-13) tmp = Float64(d1 * Float64(d2 + 37.0)); else tmp = Float64(d1 * Float64(d3 + d2)); end return tmp end
function tmp_2 = code(d1, d2, d3) tmp = 0.0; if (d3 <= 6.2e-13) tmp = d1 * (d2 + 37.0); else tmp = d1 * (d3 + d2); end tmp_2 = tmp; end
code[d1_, d2_, d3_] := If[LessEqual[d3, 6.2e-13], N[(d1 * N[(d2 + 37.0), $MachinePrecision]), $MachinePrecision], N[(d1 * N[(d3 + d2), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;d3 \leq 6.2 \cdot 10^{-13}:\\
\;\;\;\;d1 \cdot \left(d2 + 37\right)\\
\mathbf{else}:\\
\;\;\;\;d1 \cdot \left(d3 + d2\right)\\
\end{array}
\end{array}
if d3 < 6.1999999999999998e-13Initial program 99.4%
cancel-sign-sub99.4%
+-commutative99.4%
*-commutative99.4%
distribute-lft-out100.0%
distribute-lft-neg-out100.0%
distribute-rgt-neg-in100.0%
distribute-lft-out--100.0%
associate-+r+100.0%
+-commutative100.0%
associate--l+100.0%
sub-neg100.0%
metadata-eval100.0%
metadata-eval100.0%
associate-+l+100.0%
metadata-eval100.0%
Simplified100.0%
Taylor expanded in d3 around 0 74.9%
if 6.1999999999999998e-13 < d3 Initial program 93.9%
cancel-sign-sub93.9%
+-commutative93.9%
*-commutative93.9%
distribute-lft-out100.0%
distribute-lft-neg-out100.0%
distribute-rgt-neg-in100.0%
distribute-lft-out--100.0%
associate-+r+100.0%
+-commutative100.0%
associate--l+100.0%
sub-neg100.0%
metadata-eval100.0%
metadata-eval100.0%
associate-+l+100.0%
metadata-eval100.0%
Simplified100.0%
Taylor expanded in d2 around inf 88.6%
Taylor expanded in d3 around inf 84.4%
Taylor expanded in d2 around 0 87.0%
+-commutative87.0%
distribute-lft-out93.1%
Simplified93.1%
Final simplification79.6%
(FPCore (d1 d2 d3) :precision binary64 (if (<= d3 1.2e-51) (* d1 (+ d2 37.0)) (* d1 (+ d3 37.0))))
double code(double d1, double d2, double d3) {
double tmp;
if (d3 <= 1.2e-51) {
tmp = d1 * (d2 + 37.0);
} else {
tmp = d1 * (d3 + 37.0);
}
return tmp;
}
real(8) function code(d1, d2, d3)
real(8), intent (in) :: d1
real(8), intent (in) :: d2
real(8), intent (in) :: d3
real(8) :: tmp
if (d3 <= 1.2d-51) then
tmp = d1 * (d2 + 37.0d0)
else
tmp = d1 * (d3 + 37.0d0)
end if
code = tmp
end function
public static double code(double d1, double d2, double d3) {
double tmp;
if (d3 <= 1.2e-51) {
tmp = d1 * (d2 + 37.0);
} else {
tmp = d1 * (d3 + 37.0);
}
return tmp;
}
def code(d1, d2, d3): tmp = 0 if d3 <= 1.2e-51: tmp = d1 * (d2 + 37.0) else: tmp = d1 * (d3 + 37.0) return tmp
function code(d1, d2, d3) tmp = 0.0 if (d3 <= 1.2e-51) tmp = Float64(d1 * Float64(d2 + 37.0)); else tmp = Float64(d1 * Float64(d3 + 37.0)); end return tmp end
function tmp_2 = code(d1, d2, d3) tmp = 0.0; if (d3 <= 1.2e-51) tmp = d1 * (d2 + 37.0); else tmp = d1 * (d3 + 37.0); end tmp_2 = tmp; end
code[d1_, d2_, d3_] := If[LessEqual[d3, 1.2e-51], N[(d1 * N[(d2 + 37.0), $MachinePrecision]), $MachinePrecision], N[(d1 * N[(d3 + 37.0), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;d3 \leq 1.2 \cdot 10^{-51}:\\
\;\;\;\;d1 \cdot \left(d2 + 37\right)\\
\mathbf{else}:\\
\;\;\;\;d1 \cdot \left(d3 + 37\right)\\
\end{array}
\end{array}
if d3 < 1.2e-51Initial program 99.4%
cancel-sign-sub99.4%
+-commutative99.4%
*-commutative99.4%
distribute-lft-out100.0%
distribute-lft-neg-out100.0%
distribute-rgt-neg-in100.0%
distribute-lft-out--100.0%
associate-+r+100.0%
+-commutative100.0%
associate--l+100.0%
sub-neg100.0%
metadata-eval100.0%
metadata-eval100.0%
associate-+l+100.0%
metadata-eval100.0%
Simplified100.0%
Taylor expanded in d3 around 0 74.3%
if 1.2e-51 < d3 Initial program 94.2%
cancel-sign-sub94.2%
+-commutative94.2%
*-commutative94.2%
distribute-lft-out100.0%
distribute-lft-neg-out100.0%
distribute-rgt-neg-in100.0%
distribute-lft-out--100.0%
associate-+r+100.0%
+-commutative100.0%
associate--l+100.0%
sub-neg100.0%
metadata-eval100.0%
metadata-eval100.0%
associate-+l+100.0%
metadata-eval100.0%
Simplified100.0%
Taylor expanded in d2 around 0 74.0%
Final simplification74.3%
(FPCore (d1 d2 d3) :precision binary64 (if (<= d2 -15000.0) (* d1 d2) (* d1 37.0)))
double code(double d1, double d2, double d3) {
double tmp;
if (d2 <= -15000.0) {
tmp = d1 * d2;
} else {
tmp = d1 * 37.0;
}
return tmp;
}
real(8) function code(d1, d2, d3)
real(8), intent (in) :: d1
real(8), intent (in) :: d2
real(8), intent (in) :: d3
real(8) :: tmp
if (d2 <= (-15000.0d0)) then
tmp = d1 * d2
else
tmp = d1 * 37.0d0
end if
code = tmp
end function
public static double code(double d1, double d2, double d3) {
double tmp;
if (d2 <= -15000.0) {
tmp = d1 * d2;
} else {
tmp = d1 * 37.0;
}
return tmp;
}
def code(d1, d2, d3): tmp = 0 if d2 <= -15000.0: tmp = d1 * d2 else: tmp = d1 * 37.0 return tmp
function code(d1, d2, d3) tmp = 0.0 if (d2 <= -15000.0) tmp = Float64(d1 * d2); else tmp = Float64(d1 * 37.0); end return tmp end
function tmp_2 = code(d1, d2, d3) tmp = 0.0; if (d2 <= -15000.0) tmp = d1 * d2; else tmp = d1 * 37.0; end tmp_2 = tmp; end
code[d1_, d2_, d3_] := If[LessEqual[d2, -15000.0], N[(d1 * d2), $MachinePrecision], N[(d1 * 37.0), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;d2 \leq -15000:\\
\;\;\;\;d1 \cdot d2\\
\mathbf{else}:\\
\;\;\;\;d1 \cdot 37\\
\end{array}
\end{array}
if d2 < -15000Initial program 94.1%
cancel-sign-sub94.1%
+-commutative94.1%
*-commutative94.1%
distribute-lft-out100.0%
distribute-lft-neg-out100.0%
distribute-rgt-neg-in100.0%
distribute-lft-out--100.0%
associate-+r+100.0%
+-commutative100.0%
associate--l+100.0%
sub-neg100.0%
metadata-eval100.0%
metadata-eval100.0%
associate-+l+100.0%
metadata-eval100.0%
Simplified100.0%
Taylor expanded in d2 around inf 76.1%
if -15000 < d2 Initial program 99.4%
cancel-sign-sub99.4%
+-commutative99.4%
*-commutative99.4%
distribute-lft-out100.0%
distribute-lft-neg-out100.0%
distribute-rgt-neg-in100.0%
distribute-lft-out--100.0%
associate-+r+100.0%
+-commutative100.0%
associate--l+100.0%
sub-neg100.0%
metadata-eval100.0%
metadata-eval100.0%
associate-+l+100.0%
metadata-eval100.0%
Simplified100.0%
Taylor expanded in d3 around 0 59.5%
Taylor expanded in d2 around 0 33.2%
Final simplification44.6%
(FPCore (d1 d2 d3) :precision binary64 (* d1 37.0))
double code(double d1, double d2, double d3) {
return d1 * 37.0;
}
real(8) function code(d1, d2, d3)
real(8), intent (in) :: d1
real(8), intent (in) :: d2
real(8), intent (in) :: d3
code = d1 * 37.0d0
end function
public static double code(double d1, double d2, double d3) {
return d1 * 37.0;
}
def code(d1, d2, d3): return d1 * 37.0
function code(d1, d2, d3) return Float64(d1 * 37.0) end
function tmp = code(d1, d2, d3) tmp = d1 * 37.0; end
code[d1_, d2_, d3_] := N[(d1 * 37.0), $MachinePrecision]
\begin{array}{l}
\\
d1 \cdot 37
\end{array}
Initial program 98.0%
cancel-sign-sub98.0%
+-commutative98.0%
*-commutative98.0%
distribute-lft-out100.0%
distribute-lft-neg-out100.0%
distribute-rgt-neg-in100.0%
distribute-lft-out--100.0%
associate-+r+100.0%
+-commutative100.0%
associate--l+100.0%
sub-neg100.0%
metadata-eval100.0%
metadata-eval100.0%
associate-+l+100.0%
metadata-eval100.0%
Simplified100.0%
Taylor expanded in d3 around 0 64.3%
Taylor expanded in d2 around 0 24.9%
Final simplification24.9%
(FPCore (d1 d2 d3) :precision binary64 (* d1 (+ (+ 37.0 d3) d2)))
double code(double d1, double d2, double d3) {
return d1 * ((37.0 + d3) + d2);
}
real(8) function code(d1, d2, d3)
real(8), intent (in) :: d1
real(8), intent (in) :: d2
real(8), intent (in) :: d3
code = d1 * ((37.0d0 + d3) + d2)
end function
public static double code(double d1, double d2, double d3) {
return d1 * ((37.0 + d3) + d2);
}
def code(d1, d2, d3): return d1 * ((37.0 + d3) + d2)
function code(d1, d2, d3) return Float64(d1 * Float64(Float64(37.0 + d3) + d2)) end
function tmp = code(d1, d2, d3) tmp = d1 * ((37.0 + d3) + d2); end
code[d1_, d2_, d3_] := N[(d1 * N[(N[(37.0 + d3), $MachinePrecision] + d2), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
d1 \cdot \left(\left(37 + d3\right) + d2\right)
\end{array}
herbie shell --seed 2024107
(FPCore (d1 d2 d3)
:name "FastMath dist3"
:precision binary64
:alt
(* d1 (+ (+ 37.0 d3) d2))
(+ (+ (* d1 d2) (* (+ d3 5.0) d1)) (* d1 32.0)))