
(FPCore (d1 d2 d3 d4) :precision binary64 (- (+ (- (* d1 d2) (* d1 d3)) (* d4 d1)) (* d1 d1)))
double code(double d1, double d2, double d3, double d4) {
return (((d1 * d2) - (d1 * d3)) + (d4 * d1)) - (d1 * d1);
}
real(8) function code(d1, d2, d3, d4)
real(8), intent (in) :: d1
real(8), intent (in) :: d2
real(8), intent (in) :: d3
real(8), intent (in) :: d4
code = (((d1 * d2) - (d1 * d3)) + (d4 * d1)) - (d1 * d1)
end function
public static double code(double d1, double d2, double d3, double d4) {
return (((d1 * d2) - (d1 * d3)) + (d4 * d1)) - (d1 * d1);
}
def code(d1, d2, d3, d4): return (((d1 * d2) - (d1 * d3)) + (d4 * d1)) - (d1 * d1)
function code(d1, d2, d3, d4) return Float64(Float64(Float64(Float64(d1 * d2) - Float64(d1 * d3)) + Float64(d4 * d1)) - Float64(d1 * d1)) end
function tmp = code(d1, d2, d3, d4) tmp = (((d1 * d2) - (d1 * d3)) + (d4 * d1)) - (d1 * d1); end
code[d1_, d2_, d3_, d4_] := N[(N[(N[(N[(d1 * d2), $MachinePrecision] - N[(d1 * d3), $MachinePrecision]), $MachinePrecision] + N[(d4 * d1), $MachinePrecision]), $MachinePrecision] - N[(d1 * d1), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
\left(\left(d1 \cdot d2 - d1 \cdot d3\right) + d4 \cdot d1\right) - d1 \cdot d1
\end{array}
Sampling outcomes in binary64 precision:
Herbie found 12 alternatives:
| Alternative | Accuracy | Speedup |
|---|
(FPCore (d1 d2 d3 d4) :precision binary64 (- (+ (- (* d1 d2) (* d1 d3)) (* d4 d1)) (* d1 d1)))
double code(double d1, double d2, double d3, double d4) {
return (((d1 * d2) - (d1 * d3)) + (d4 * d1)) - (d1 * d1);
}
real(8) function code(d1, d2, d3, d4)
real(8), intent (in) :: d1
real(8), intent (in) :: d2
real(8), intent (in) :: d3
real(8), intent (in) :: d4
code = (((d1 * d2) - (d1 * d3)) + (d4 * d1)) - (d1 * d1)
end function
public static double code(double d1, double d2, double d3, double d4) {
return (((d1 * d2) - (d1 * d3)) + (d4 * d1)) - (d1 * d1);
}
def code(d1, d2, d3, d4): return (((d1 * d2) - (d1 * d3)) + (d4 * d1)) - (d1 * d1)
function code(d1, d2, d3, d4) return Float64(Float64(Float64(Float64(d1 * d2) - Float64(d1 * d3)) + Float64(d4 * d1)) - Float64(d1 * d1)) end
function tmp = code(d1, d2, d3, d4) tmp = (((d1 * d2) - (d1 * d3)) + (d4 * d1)) - (d1 * d1); end
code[d1_, d2_, d3_, d4_] := N[(N[(N[(N[(d1 * d2), $MachinePrecision] - N[(d1 * d3), $MachinePrecision]), $MachinePrecision] + N[(d4 * d1), $MachinePrecision]), $MachinePrecision] - N[(d1 * d1), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
\left(\left(d1 \cdot d2 - d1 \cdot d3\right) + d4 \cdot d1\right) - d1 \cdot d1
\end{array}
(FPCore (d1 d2 d3 d4) :precision binary64 (* d1 (+ (- d2 d3) (- d4 d1))))
double code(double d1, double d2, double d3, double d4) {
return d1 * ((d2 - d3) + (d4 - d1));
}
real(8) function code(d1, d2, d3, d4)
real(8), intent (in) :: d1
real(8), intent (in) :: d2
real(8), intent (in) :: d3
real(8), intent (in) :: d4
code = d1 * ((d2 - d3) + (d4 - d1))
end function
public static double code(double d1, double d2, double d3, double d4) {
return d1 * ((d2 - d3) + (d4 - d1));
}
def code(d1, d2, d3, d4): return d1 * ((d2 - d3) + (d4 - d1))
function code(d1, d2, d3, d4) return Float64(d1 * Float64(Float64(d2 - d3) + Float64(d4 - d1))) end
function tmp = code(d1, d2, d3, d4) tmp = d1 * ((d2 - d3) + (d4 - d1)); end
code[d1_, d2_, d3_, d4_] := N[(d1 * N[(N[(d2 - d3), $MachinePrecision] + N[(d4 - d1), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
d1 \cdot \left(\left(d2 - d3\right) + \left(d4 - d1\right)\right)
\end{array}
Initial program 87.5%
associate--l+87.5%
distribute-lft-out--88.6%
distribute-rgt-out--92.2%
distribute-lft-out100.0%
Simplified100.0%
Final simplification100.0%
(FPCore (d1 d2 d3 d4)
:precision binary64
(let* ((t_0 (* d1 (- d1))) (t_1 (* d1 (- d4 d3))))
(if (<= d1 -5.4e+107)
t_0
(if (<= d1 -2.1e+54)
t_1
(if (<= d1 5.6e-248) (* d1 (+ d2 d4)) (if (<= d1 7e+116) t_1 t_0))))))
double code(double d1, double d2, double d3, double d4) {
double t_0 = d1 * -d1;
double t_1 = d1 * (d4 - d3);
double tmp;
if (d1 <= -5.4e+107) {
tmp = t_0;
} else if (d1 <= -2.1e+54) {
tmp = t_1;
} else if (d1 <= 5.6e-248) {
tmp = d1 * (d2 + d4);
} else if (d1 <= 7e+116) {
tmp = t_1;
} else {
tmp = t_0;
}
return tmp;
}
real(8) function code(d1, d2, d3, d4)
real(8), intent (in) :: d1
real(8), intent (in) :: d2
real(8), intent (in) :: d3
real(8), intent (in) :: d4
real(8) :: t_0
real(8) :: t_1
real(8) :: tmp
t_0 = d1 * -d1
t_1 = d1 * (d4 - d3)
if (d1 <= (-5.4d+107)) then
tmp = t_0
else if (d1 <= (-2.1d+54)) then
tmp = t_1
else if (d1 <= 5.6d-248) then
tmp = d1 * (d2 + d4)
else if (d1 <= 7d+116) then
tmp = t_1
else
tmp = t_0
end if
code = tmp
end function
public static double code(double d1, double d2, double d3, double d4) {
double t_0 = d1 * -d1;
double t_1 = d1 * (d4 - d3);
double tmp;
if (d1 <= -5.4e+107) {
tmp = t_0;
} else if (d1 <= -2.1e+54) {
tmp = t_1;
} else if (d1 <= 5.6e-248) {
tmp = d1 * (d2 + d4);
} else if (d1 <= 7e+116) {
tmp = t_1;
} else {
tmp = t_0;
}
return tmp;
}
def code(d1, d2, d3, d4): t_0 = d1 * -d1 t_1 = d1 * (d4 - d3) tmp = 0 if d1 <= -5.4e+107: tmp = t_0 elif d1 <= -2.1e+54: tmp = t_1 elif d1 <= 5.6e-248: tmp = d1 * (d2 + d4) elif d1 <= 7e+116: tmp = t_1 else: tmp = t_0 return tmp
function code(d1, d2, d3, d4) t_0 = Float64(d1 * Float64(-d1)) t_1 = Float64(d1 * Float64(d4 - d3)) tmp = 0.0 if (d1 <= -5.4e+107) tmp = t_0; elseif (d1 <= -2.1e+54) tmp = t_1; elseif (d1 <= 5.6e-248) tmp = Float64(d1 * Float64(d2 + d4)); elseif (d1 <= 7e+116) tmp = t_1; else tmp = t_0; end return tmp end
function tmp_2 = code(d1, d2, d3, d4) t_0 = d1 * -d1; t_1 = d1 * (d4 - d3); tmp = 0.0; if (d1 <= -5.4e+107) tmp = t_0; elseif (d1 <= -2.1e+54) tmp = t_1; elseif (d1 <= 5.6e-248) tmp = d1 * (d2 + d4); elseif (d1 <= 7e+116) tmp = t_1; else tmp = t_0; end tmp_2 = tmp; end
code[d1_, d2_, d3_, d4_] := Block[{t$95$0 = N[(d1 * (-d1)), $MachinePrecision]}, Block[{t$95$1 = N[(d1 * N[(d4 - d3), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[d1, -5.4e+107], t$95$0, If[LessEqual[d1, -2.1e+54], t$95$1, If[LessEqual[d1, 5.6e-248], N[(d1 * N[(d2 + d4), $MachinePrecision]), $MachinePrecision], If[LessEqual[d1, 7e+116], t$95$1, t$95$0]]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := d1 \cdot \left(-d1\right)\\
t_1 := d1 \cdot \left(d4 - d3\right)\\
\mathbf{if}\;d1 \leq -5.4 \cdot 10^{+107}:\\
\;\;\;\;t_0\\
\mathbf{elif}\;d1 \leq -2.1 \cdot 10^{+54}:\\
\;\;\;\;t_1\\
\mathbf{elif}\;d1 \leq 5.6 \cdot 10^{-248}:\\
\;\;\;\;d1 \cdot \left(d2 + d4\right)\\
\mathbf{elif}\;d1 \leq 7 \cdot 10^{+116}:\\
\;\;\;\;t_1\\
\mathbf{else}:\\
\;\;\;\;t_0\\
\end{array}
\end{array}
if d1 < -5.4000000000000003e107 or 6.99999999999999993e116 < d1 Initial program 65.5%
associate--l+65.5%
distribute-lft-out--66.7%
distribute-rgt-out--77.0%
distribute-lft-out100.0%
Simplified100.0%
Taylor expanded in d1 around inf 82.0%
neg-mul-182.0%
Simplified82.0%
if -5.4000000000000003e107 < d1 < -2.09999999999999986e54 or 5.6000000000000002e-248 < d1 < 6.99999999999999993e116Initial program 97.6%
associate--l+97.6%
distribute-lft-out--100.0%
distribute-rgt-out--100.0%
distribute-lft-out100.0%
Simplified100.0%
Taylor expanded in d1 around 0 91.6%
Taylor expanded in d2 around 0 69.2%
if -2.09999999999999986e54 < d1 < 5.6000000000000002e-248Initial program 100.0%
associate--l+100.0%
distribute-lft-out--99.9%
distribute-rgt-out--99.9%
distribute-lft-out99.9%
Simplified99.9%
Taylor expanded in d1 around 0 92.1%
Taylor expanded in d3 around 0 72.3%
Final simplification74.5%
(FPCore (d1 d2 d3 d4)
:precision binary64
(let* ((t_0 (* d1 (- d4 d3))) (t_1 (* d1 (- d2 d1))))
(if (<= d3 -2.15e+71)
t_0
(if (<= d3 -1.65e-288)
t_1
(if (<= d3 1.45e-251)
(* d1 (+ d2 d4))
(if (<= d3 2.05e+20) t_1 t_0))))))
double code(double d1, double d2, double d3, double d4) {
double t_0 = d1 * (d4 - d3);
double t_1 = d1 * (d2 - d1);
double tmp;
if (d3 <= -2.15e+71) {
tmp = t_0;
} else if (d3 <= -1.65e-288) {
tmp = t_1;
} else if (d3 <= 1.45e-251) {
tmp = d1 * (d2 + d4);
} else if (d3 <= 2.05e+20) {
tmp = t_1;
} else {
tmp = t_0;
}
return tmp;
}
real(8) function code(d1, d2, d3, d4)
real(8), intent (in) :: d1
real(8), intent (in) :: d2
real(8), intent (in) :: d3
real(8), intent (in) :: d4
real(8) :: t_0
real(8) :: t_1
real(8) :: tmp
t_0 = d1 * (d4 - d3)
t_1 = d1 * (d2 - d1)
if (d3 <= (-2.15d+71)) then
tmp = t_0
else if (d3 <= (-1.65d-288)) then
tmp = t_1
else if (d3 <= 1.45d-251) then
tmp = d1 * (d2 + d4)
else if (d3 <= 2.05d+20) then
tmp = t_1
else
tmp = t_0
end if
code = tmp
end function
public static double code(double d1, double d2, double d3, double d4) {
double t_0 = d1 * (d4 - d3);
double t_1 = d1 * (d2 - d1);
double tmp;
if (d3 <= -2.15e+71) {
tmp = t_0;
} else if (d3 <= -1.65e-288) {
tmp = t_1;
} else if (d3 <= 1.45e-251) {
tmp = d1 * (d2 + d4);
} else if (d3 <= 2.05e+20) {
tmp = t_1;
} else {
tmp = t_0;
}
return tmp;
}
def code(d1, d2, d3, d4): t_0 = d1 * (d4 - d3) t_1 = d1 * (d2 - d1) tmp = 0 if d3 <= -2.15e+71: tmp = t_0 elif d3 <= -1.65e-288: tmp = t_1 elif d3 <= 1.45e-251: tmp = d1 * (d2 + d4) elif d3 <= 2.05e+20: tmp = t_1 else: tmp = t_0 return tmp
function code(d1, d2, d3, d4) t_0 = Float64(d1 * Float64(d4 - d3)) t_1 = Float64(d1 * Float64(d2 - d1)) tmp = 0.0 if (d3 <= -2.15e+71) tmp = t_0; elseif (d3 <= -1.65e-288) tmp = t_1; elseif (d3 <= 1.45e-251) tmp = Float64(d1 * Float64(d2 + d4)); elseif (d3 <= 2.05e+20) tmp = t_1; else tmp = t_0; end return tmp end
function tmp_2 = code(d1, d2, d3, d4) t_0 = d1 * (d4 - d3); t_1 = d1 * (d2 - d1); tmp = 0.0; if (d3 <= -2.15e+71) tmp = t_0; elseif (d3 <= -1.65e-288) tmp = t_1; elseif (d3 <= 1.45e-251) tmp = d1 * (d2 + d4); elseif (d3 <= 2.05e+20) tmp = t_1; else tmp = t_0; end tmp_2 = tmp; end
code[d1_, d2_, d3_, d4_] := Block[{t$95$0 = N[(d1 * N[(d4 - d3), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$1 = N[(d1 * N[(d2 - d1), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[d3, -2.15e+71], t$95$0, If[LessEqual[d3, -1.65e-288], t$95$1, If[LessEqual[d3, 1.45e-251], N[(d1 * N[(d2 + d4), $MachinePrecision]), $MachinePrecision], If[LessEqual[d3, 2.05e+20], t$95$1, t$95$0]]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := d1 \cdot \left(d4 - d3\right)\\
t_1 := d1 \cdot \left(d2 - d1\right)\\
\mathbf{if}\;d3 \leq -2.15 \cdot 10^{+71}:\\
\;\;\;\;t_0\\
\mathbf{elif}\;d3 \leq -1.65 \cdot 10^{-288}:\\
\;\;\;\;t_1\\
\mathbf{elif}\;d3 \leq 1.45 \cdot 10^{-251}:\\
\;\;\;\;d1 \cdot \left(d2 + d4\right)\\
\mathbf{elif}\;d3 \leq 2.05 \cdot 10^{+20}:\\
\;\;\;\;t_1\\
\mathbf{else}:\\
\;\;\;\;t_0\\
\end{array}
\end{array}
if d3 < -2.14999999999999992e71 or 2.05e20 < d3 Initial program 83.0%
associate--l+83.0%
distribute-lft-out--85.8%
distribute-rgt-out--86.7%
distribute-lft-out100.0%
Simplified100.0%
Taylor expanded in d1 around 0 89.1%
Taylor expanded in d2 around 0 72.9%
if -2.14999999999999992e71 < d3 < -1.64999999999999994e-288 or 1.45e-251 < d3 < 2.05e20Initial program 89.9%
associate--l+89.9%
distribute-lft-out--89.9%
distribute-rgt-out--95.3%
distribute-lft-out100.0%
Simplified100.0%
Taylor expanded in d4 around 0 72.7%
Taylor expanded in d3 around 0 72.2%
if -1.64999999999999994e-288 < d3 < 1.45e-251Initial program 95.2%
associate--l+95.2%
distribute-lft-out--95.2%
distribute-rgt-out--99.9%
distribute-lft-out99.9%
Simplified99.9%
Taylor expanded in d1 around 0 90.7%
Taylor expanded in d3 around 0 90.7%
Final simplification74.0%
(FPCore (d1 d2 d3 d4)
:precision binary64
(let* ((t_0 (* d1 (- d2 d1))))
(if (<= d3 -6e+78)
(* d1 (- d2 d3))
(if (<= d3 -1.7e-288)
t_0
(if (<= d3 5.8e-254)
(* d1 (+ d2 d4))
(if (<= d3 1.8e+16) t_0 (* d1 (- d4 d3))))))))
double code(double d1, double d2, double d3, double d4) {
double t_0 = d1 * (d2 - d1);
double tmp;
if (d3 <= -6e+78) {
tmp = d1 * (d2 - d3);
} else if (d3 <= -1.7e-288) {
tmp = t_0;
} else if (d3 <= 5.8e-254) {
tmp = d1 * (d2 + d4);
} else if (d3 <= 1.8e+16) {
tmp = t_0;
} else {
tmp = d1 * (d4 - d3);
}
return tmp;
}
real(8) function code(d1, d2, d3, d4)
real(8), intent (in) :: d1
real(8), intent (in) :: d2
real(8), intent (in) :: d3
real(8), intent (in) :: d4
real(8) :: t_0
real(8) :: tmp
t_0 = d1 * (d2 - d1)
if (d3 <= (-6d+78)) then
tmp = d1 * (d2 - d3)
else if (d3 <= (-1.7d-288)) then
tmp = t_0
else if (d3 <= 5.8d-254) then
tmp = d1 * (d2 + d4)
else if (d3 <= 1.8d+16) then
tmp = t_0
else
tmp = d1 * (d4 - d3)
end if
code = tmp
end function
public static double code(double d1, double d2, double d3, double d4) {
double t_0 = d1 * (d2 - d1);
double tmp;
if (d3 <= -6e+78) {
tmp = d1 * (d2 - d3);
} else if (d3 <= -1.7e-288) {
tmp = t_0;
} else if (d3 <= 5.8e-254) {
tmp = d1 * (d2 + d4);
} else if (d3 <= 1.8e+16) {
tmp = t_0;
} else {
tmp = d1 * (d4 - d3);
}
return tmp;
}
def code(d1, d2, d3, d4): t_0 = d1 * (d2 - d1) tmp = 0 if d3 <= -6e+78: tmp = d1 * (d2 - d3) elif d3 <= -1.7e-288: tmp = t_0 elif d3 <= 5.8e-254: tmp = d1 * (d2 + d4) elif d3 <= 1.8e+16: tmp = t_0 else: tmp = d1 * (d4 - d3) return tmp
function code(d1, d2, d3, d4) t_0 = Float64(d1 * Float64(d2 - d1)) tmp = 0.0 if (d3 <= -6e+78) tmp = Float64(d1 * Float64(d2 - d3)); elseif (d3 <= -1.7e-288) tmp = t_0; elseif (d3 <= 5.8e-254) tmp = Float64(d1 * Float64(d2 + d4)); elseif (d3 <= 1.8e+16) tmp = t_0; else tmp = Float64(d1 * Float64(d4 - d3)); end return tmp end
function tmp_2 = code(d1, d2, d3, d4) t_0 = d1 * (d2 - d1); tmp = 0.0; if (d3 <= -6e+78) tmp = d1 * (d2 - d3); elseif (d3 <= -1.7e-288) tmp = t_0; elseif (d3 <= 5.8e-254) tmp = d1 * (d2 + d4); elseif (d3 <= 1.8e+16) tmp = t_0; else tmp = d1 * (d4 - d3); end tmp_2 = tmp; end
code[d1_, d2_, d3_, d4_] := Block[{t$95$0 = N[(d1 * N[(d2 - d1), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[d3, -6e+78], N[(d1 * N[(d2 - d3), $MachinePrecision]), $MachinePrecision], If[LessEqual[d3, -1.7e-288], t$95$0, If[LessEqual[d3, 5.8e-254], N[(d1 * N[(d2 + d4), $MachinePrecision]), $MachinePrecision], If[LessEqual[d3, 1.8e+16], t$95$0, N[(d1 * N[(d4 - d3), $MachinePrecision]), $MachinePrecision]]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := d1 \cdot \left(d2 - d1\right)\\
\mathbf{if}\;d3 \leq -6 \cdot 10^{+78}:\\
\;\;\;\;d1 \cdot \left(d2 - d3\right)\\
\mathbf{elif}\;d3 \leq -1.7 \cdot 10^{-288}:\\
\;\;\;\;t_0\\
\mathbf{elif}\;d3 \leq 5.8 \cdot 10^{-254}:\\
\;\;\;\;d1 \cdot \left(d2 + d4\right)\\
\mathbf{elif}\;d3 \leq 1.8 \cdot 10^{+16}:\\
\;\;\;\;t_0\\
\mathbf{else}:\\
\;\;\;\;d1 \cdot \left(d4 - d3\right)\\
\end{array}
\end{array}
if d3 < -5.99999999999999964e78Initial program 76.5%
associate--l+76.5%
distribute-lft-out--78.6%
distribute-rgt-out--80.8%
distribute-lft-out99.9%
Simplified99.9%
Taylor expanded in d1 around 0 88.1%
Taylor expanded in d4 around 0 77.7%
if -5.99999999999999964e78 < d3 < -1.69999999999999986e-288 or 5.7999999999999999e-254 < d3 < 1.8e16Initial program 90.0%
associate--l+90.0%
distribute-lft-out--90.0%
distribute-rgt-out--95.4%
distribute-lft-out100.0%
Simplified100.0%
Taylor expanded in d4 around 0 72.9%
Taylor expanded in d3 around 0 72.4%
if -1.69999999999999986e-288 < d3 < 5.7999999999999999e-254Initial program 95.2%
associate--l+95.2%
distribute-lft-out--95.2%
distribute-rgt-out--99.9%
distribute-lft-out99.9%
Simplified99.9%
Taylor expanded in d1 around 0 90.7%
Taylor expanded in d3 around 0 90.7%
if 1.8e16 < d3 Initial program 87.9%
associate--l+87.9%
distribute-lft-out--91.4%
distribute-rgt-out--91.4%
distribute-lft-out100.0%
Simplified100.0%
Taylor expanded in d1 around 0 89.7%
Taylor expanded in d2 around 0 75.6%
Final simplification75.6%
(FPCore (d1 d2 d3 d4) :precision binary64 (if (<= d1 -1.6e+109) (* d1 (- d2 d1)) (if (<= d1 2.7e+116) (* d1 (- (+ d2 d4) d3)) (* (+ d1 d3) (- d1)))))
double code(double d1, double d2, double d3, double d4) {
double tmp;
if (d1 <= -1.6e+109) {
tmp = d1 * (d2 - d1);
} else if (d1 <= 2.7e+116) {
tmp = d1 * ((d2 + d4) - d3);
} else {
tmp = (d1 + d3) * -d1;
}
return tmp;
}
real(8) function code(d1, d2, d3, d4)
real(8), intent (in) :: d1
real(8), intent (in) :: d2
real(8), intent (in) :: d3
real(8), intent (in) :: d4
real(8) :: tmp
if (d1 <= (-1.6d+109)) then
tmp = d1 * (d2 - d1)
else if (d1 <= 2.7d+116) then
tmp = d1 * ((d2 + d4) - d3)
else
tmp = (d1 + d3) * -d1
end if
code = tmp
end function
public static double code(double d1, double d2, double d3, double d4) {
double tmp;
if (d1 <= -1.6e+109) {
tmp = d1 * (d2 - d1);
} else if (d1 <= 2.7e+116) {
tmp = d1 * ((d2 + d4) - d3);
} else {
tmp = (d1 + d3) * -d1;
}
return tmp;
}
def code(d1, d2, d3, d4): tmp = 0 if d1 <= -1.6e+109: tmp = d1 * (d2 - d1) elif d1 <= 2.7e+116: tmp = d1 * ((d2 + d4) - d3) else: tmp = (d1 + d3) * -d1 return tmp
function code(d1, d2, d3, d4) tmp = 0.0 if (d1 <= -1.6e+109) tmp = Float64(d1 * Float64(d2 - d1)); elseif (d1 <= 2.7e+116) tmp = Float64(d1 * Float64(Float64(d2 + d4) - d3)); else tmp = Float64(Float64(d1 + d3) * Float64(-d1)); end return tmp end
function tmp_2 = code(d1, d2, d3, d4) tmp = 0.0; if (d1 <= -1.6e+109) tmp = d1 * (d2 - d1); elseif (d1 <= 2.7e+116) tmp = d1 * ((d2 + d4) - d3); else tmp = (d1 + d3) * -d1; end tmp_2 = tmp; end
code[d1_, d2_, d3_, d4_] := If[LessEqual[d1, -1.6e+109], N[(d1 * N[(d2 - d1), $MachinePrecision]), $MachinePrecision], If[LessEqual[d1, 2.7e+116], N[(d1 * N[(N[(d2 + d4), $MachinePrecision] - d3), $MachinePrecision]), $MachinePrecision], N[(N[(d1 + d3), $MachinePrecision] * (-d1)), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;d1 \leq -1.6 \cdot 10^{+109}:\\
\;\;\;\;d1 \cdot \left(d2 - d1\right)\\
\mathbf{elif}\;d1 \leq 2.7 \cdot 10^{+116}:\\
\;\;\;\;d1 \cdot \left(\left(d2 + d4\right) - d3\right)\\
\mathbf{else}:\\
\;\;\;\;\left(d1 + d3\right) \cdot \left(-d1\right)\\
\end{array}
\end{array}
if d1 < -1.6000000000000001e109Initial program 75.0%
associate--l+75.0%
distribute-lft-out--75.0%
distribute-rgt-out--77.8%
distribute-lft-out100.0%
Simplified100.0%
Taylor expanded in d4 around 0 94.4%
Taylor expanded in d3 around 0 88.9%
if -1.6000000000000001e109 < d1 < 2.7e116Initial program 98.8%
associate--l+98.8%
distribute-lft-out--100.0%
distribute-rgt-out--100.0%
distribute-lft-out100.0%
Simplified100.0%
Taylor expanded in d1 around 0 91.9%
if 2.7e116 < d1 Initial program 58.8%
associate--l+58.8%
distribute-lft-out--60.8%
distribute-rgt-out--76.5%
distribute-lft-out100.0%
Simplified100.0%
Taylor expanded in d4 around 0 90.3%
Taylor expanded in d2 around 0 90.3%
neg-mul-190.3%
+-commutative90.3%
distribute-neg-in90.3%
sub-neg90.3%
Simplified90.3%
Final simplification91.1%
(FPCore (d1 d2 d3 d4)
:precision binary64
(if (<= d2 -1.9e+80)
(* d1 d2)
(if (<= d2 -1.3e-136)
(* d1 (- d3))
(if (<= d2 2.2e-142) (* d1 (- d1)) (* d1 d4)))))
double code(double d1, double d2, double d3, double d4) {
double tmp;
if (d2 <= -1.9e+80) {
tmp = d1 * d2;
} else if (d2 <= -1.3e-136) {
tmp = d1 * -d3;
} else if (d2 <= 2.2e-142) {
tmp = d1 * -d1;
} else {
tmp = d1 * d4;
}
return tmp;
}
real(8) function code(d1, d2, d3, d4)
real(8), intent (in) :: d1
real(8), intent (in) :: d2
real(8), intent (in) :: d3
real(8), intent (in) :: d4
real(8) :: tmp
if (d2 <= (-1.9d+80)) then
tmp = d1 * d2
else if (d2 <= (-1.3d-136)) then
tmp = d1 * -d3
else if (d2 <= 2.2d-142) then
tmp = d1 * -d1
else
tmp = d1 * d4
end if
code = tmp
end function
public static double code(double d1, double d2, double d3, double d4) {
double tmp;
if (d2 <= -1.9e+80) {
tmp = d1 * d2;
} else if (d2 <= -1.3e-136) {
tmp = d1 * -d3;
} else if (d2 <= 2.2e-142) {
tmp = d1 * -d1;
} else {
tmp = d1 * d4;
}
return tmp;
}
def code(d1, d2, d3, d4): tmp = 0 if d2 <= -1.9e+80: tmp = d1 * d2 elif d2 <= -1.3e-136: tmp = d1 * -d3 elif d2 <= 2.2e-142: tmp = d1 * -d1 else: tmp = d1 * d4 return tmp
function code(d1, d2, d3, d4) tmp = 0.0 if (d2 <= -1.9e+80) tmp = Float64(d1 * d2); elseif (d2 <= -1.3e-136) tmp = Float64(d1 * Float64(-d3)); elseif (d2 <= 2.2e-142) tmp = Float64(d1 * Float64(-d1)); else tmp = Float64(d1 * d4); end return tmp end
function tmp_2 = code(d1, d2, d3, d4) tmp = 0.0; if (d2 <= -1.9e+80) tmp = d1 * d2; elseif (d2 <= -1.3e-136) tmp = d1 * -d3; elseif (d2 <= 2.2e-142) tmp = d1 * -d1; else tmp = d1 * d4; end tmp_2 = tmp; end
code[d1_, d2_, d3_, d4_] := If[LessEqual[d2, -1.9e+80], N[(d1 * d2), $MachinePrecision], If[LessEqual[d2, -1.3e-136], N[(d1 * (-d3)), $MachinePrecision], If[LessEqual[d2, 2.2e-142], N[(d1 * (-d1)), $MachinePrecision], N[(d1 * d4), $MachinePrecision]]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;d2 \leq -1.9 \cdot 10^{+80}:\\
\;\;\;\;d1 \cdot d2\\
\mathbf{elif}\;d2 \leq -1.3 \cdot 10^{-136}:\\
\;\;\;\;d1 \cdot \left(-d3\right)\\
\mathbf{elif}\;d2 \leq 2.2 \cdot 10^{-142}:\\
\;\;\;\;d1 \cdot \left(-d1\right)\\
\mathbf{else}:\\
\;\;\;\;d1 \cdot d4\\
\end{array}
\end{array}
if d2 < -1.89999999999999999e80Initial program 84.7%
associate--l+84.7%
distribute-lft-out--86.9%
distribute-rgt-out--89.1%
distribute-lft-out100.0%
Simplified100.0%
Taylor expanded in d2 around inf 71.0%
if -1.89999999999999999e80 < d2 < -1.29999999999999998e-136Initial program 92.2%
associate--l+92.2%
distribute-lft-out--92.2%
distribute-rgt-out--97.4%
distribute-lft-out100.0%
Simplified100.0%
Taylor expanded in d3 around inf 45.9%
mul-1-neg45.9%
distribute-rgt-neg-out45.9%
Simplified45.9%
if -1.29999999999999998e-136 < d2 < 2.20000000000000016e-142Initial program 88.3%
associate--l+88.3%
distribute-lft-out--88.3%
distribute-rgt-out--90.9%
distribute-lft-out100.0%
Simplified100.0%
Taylor expanded in d1 around inf 54.2%
neg-mul-154.2%
Simplified54.2%
if 2.20000000000000016e-142 < d2 Initial program 86.2%
associate--l+86.2%
distribute-lft-out--88.3%
distribute-rgt-out--92.5%
distribute-lft-out100.0%
Simplified100.0%
Taylor expanded in d4 around inf 27.9%
Final simplification46.3%
(FPCore (d1 d2 d3 d4) :precision binary64 (if (<= d2 -2.4e+81) (* d1 (- d2 d3)) (if (<= d2 1.5e-136) (* (+ d1 d3) (- d1)) (* d1 (- d4 d3)))))
double code(double d1, double d2, double d3, double d4) {
double tmp;
if (d2 <= -2.4e+81) {
tmp = d1 * (d2 - d3);
} else if (d2 <= 1.5e-136) {
tmp = (d1 + d3) * -d1;
} else {
tmp = d1 * (d4 - d3);
}
return tmp;
}
real(8) function code(d1, d2, d3, d4)
real(8), intent (in) :: d1
real(8), intent (in) :: d2
real(8), intent (in) :: d3
real(8), intent (in) :: d4
real(8) :: tmp
if (d2 <= (-2.4d+81)) then
tmp = d1 * (d2 - d3)
else if (d2 <= 1.5d-136) then
tmp = (d1 + d3) * -d1
else
tmp = d1 * (d4 - d3)
end if
code = tmp
end function
public static double code(double d1, double d2, double d3, double d4) {
double tmp;
if (d2 <= -2.4e+81) {
tmp = d1 * (d2 - d3);
} else if (d2 <= 1.5e-136) {
tmp = (d1 + d3) * -d1;
} else {
tmp = d1 * (d4 - d3);
}
return tmp;
}
def code(d1, d2, d3, d4): tmp = 0 if d2 <= -2.4e+81: tmp = d1 * (d2 - d3) elif d2 <= 1.5e-136: tmp = (d1 + d3) * -d1 else: tmp = d1 * (d4 - d3) return tmp
function code(d1, d2, d3, d4) tmp = 0.0 if (d2 <= -2.4e+81) tmp = Float64(d1 * Float64(d2 - d3)); elseif (d2 <= 1.5e-136) tmp = Float64(Float64(d1 + d3) * Float64(-d1)); else tmp = Float64(d1 * Float64(d4 - d3)); end return tmp end
function tmp_2 = code(d1, d2, d3, d4) tmp = 0.0; if (d2 <= -2.4e+81) tmp = d1 * (d2 - d3); elseif (d2 <= 1.5e-136) tmp = (d1 + d3) * -d1; else tmp = d1 * (d4 - d3); end tmp_2 = tmp; end
code[d1_, d2_, d3_, d4_] := If[LessEqual[d2, -2.4e+81], N[(d1 * N[(d2 - d3), $MachinePrecision]), $MachinePrecision], If[LessEqual[d2, 1.5e-136], N[(N[(d1 + d3), $MachinePrecision] * (-d1)), $MachinePrecision], N[(d1 * N[(d4 - d3), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;d2 \leq -2.4 \cdot 10^{+81}:\\
\;\;\;\;d1 \cdot \left(d2 - d3\right)\\
\mathbf{elif}\;d2 \leq 1.5 \cdot 10^{-136}:\\
\;\;\;\;\left(d1 + d3\right) \cdot \left(-d1\right)\\
\mathbf{else}:\\
\;\;\;\;d1 \cdot \left(d4 - d3\right)\\
\end{array}
\end{array}
if d2 < -2.3999999999999999e81Initial program 84.7%
associate--l+84.7%
distribute-lft-out--86.9%
distribute-rgt-out--89.1%
distribute-lft-out100.0%
Simplified100.0%
Taylor expanded in d1 around 0 89.3%
Taylor expanded in d4 around 0 81.4%
if -2.3999999999999999e81 < d2 < 1.4999999999999999e-136Initial program 89.6%
associate--l+89.6%
distribute-lft-out--89.6%
distribute-rgt-out--93.1%
distribute-lft-out100.0%
Simplified100.0%
Taylor expanded in d4 around 0 75.4%
Taylor expanded in d2 around 0 73.6%
neg-mul-173.6%
+-commutative73.6%
distribute-neg-in73.6%
sub-neg73.6%
Simplified73.6%
if 1.4999999999999999e-136 < d2 Initial program 86.2%
associate--l+86.2%
distribute-lft-out--88.3%
distribute-rgt-out--92.5%
distribute-lft-out100.0%
Simplified100.0%
Taylor expanded in d1 around 0 83.4%
Taylor expanded in d2 around 0 48.6%
Final simplification65.8%
(FPCore (d1 d2 d3 d4) :precision binary64 (if (or (<= d1 -2.15e+99) (not (<= d1 8.2e+116))) (* d1 (- d1)) (* d1 (+ d2 d4))))
double code(double d1, double d2, double d3, double d4) {
double tmp;
if ((d1 <= -2.15e+99) || !(d1 <= 8.2e+116)) {
tmp = d1 * -d1;
} else {
tmp = d1 * (d2 + d4);
}
return tmp;
}
real(8) function code(d1, d2, d3, d4)
real(8), intent (in) :: d1
real(8), intent (in) :: d2
real(8), intent (in) :: d3
real(8), intent (in) :: d4
real(8) :: tmp
if ((d1 <= (-2.15d+99)) .or. (.not. (d1 <= 8.2d+116))) then
tmp = d1 * -d1
else
tmp = d1 * (d2 + d4)
end if
code = tmp
end function
public static double code(double d1, double d2, double d3, double d4) {
double tmp;
if ((d1 <= -2.15e+99) || !(d1 <= 8.2e+116)) {
tmp = d1 * -d1;
} else {
tmp = d1 * (d2 + d4);
}
return tmp;
}
def code(d1, d2, d3, d4): tmp = 0 if (d1 <= -2.15e+99) or not (d1 <= 8.2e+116): tmp = d1 * -d1 else: tmp = d1 * (d2 + d4) return tmp
function code(d1, d2, d3, d4) tmp = 0.0 if ((d1 <= -2.15e+99) || !(d1 <= 8.2e+116)) tmp = Float64(d1 * Float64(-d1)); else tmp = Float64(d1 * Float64(d2 + d4)); end return tmp end
function tmp_2 = code(d1, d2, d3, d4) tmp = 0.0; if ((d1 <= -2.15e+99) || ~((d1 <= 8.2e+116))) tmp = d1 * -d1; else tmp = d1 * (d2 + d4); end tmp_2 = tmp; end
code[d1_, d2_, d3_, d4_] := If[Or[LessEqual[d1, -2.15e+99], N[Not[LessEqual[d1, 8.2e+116]], $MachinePrecision]], N[(d1 * (-d1)), $MachinePrecision], N[(d1 * N[(d2 + d4), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;d1 \leq -2.15 \cdot 10^{+99} \lor \neg \left(d1 \leq 8.2 \cdot 10^{+116}\right):\\
\;\;\;\;d1 \cdot \left(-d1\right)\\
\mathbf{else}:\\
\;\;\;\;d1 \cdot \left(d2 + d4\right)\\
\end{array}
\end{array}
if d1 < -2.1500000000000001e99 or 8.1999999999999996e116 < d1 Initial program 64.8%
associate--l+64.8%
distribute-lft-out--67.0%
distribute-rgt-out--77.3%
distribute-lft-out100.0%
Simplified100.0%
Taylor expanded in d1 around inf 81.0%
neg-mul-181.0%
Simplified81.0%
if -2.1500000000000001e99 < d1 < 8.1999999999999996e116Initial program 99.4%
associate--l+99.4%
distribute-lft-out--100.0%
distribute-rgt-out--100.0%
distribute-lft-out100.0%
Simplified100.0%
Taylor expanded in d1 around 0 91.8%
Taylor expanded in d3 around 0 63.9%
Final simplification69.8%
(FPCore (d1 d2 d3 d4) :precision binary64 (if (<= d4 3.1e+57) (* d1 (- d2 (+ d1 d3))) (* d1 (- (+ d2 d4) d3))))
double code(double d1, double d2, double d3, double d4) {
double tmp;
if (d4 <= 3.1e+57) {
tmp = d1 * (d2 - (d1 + d3));
} else {
tmp = d1 * ((d2 + d4) - d3);
}
return tmp;
}
real(8) function code(d1, d2, d3, d4)
real(8), intent (in) :: d1
real(8), intent (in) :: d2
real(8), intent (in) :: d3
real(8), intent (in) :: d4
real(8) :: tmp
if (d4 <= 3.1d+57) then
tmp = d1 * (d2 - (d1 + d3))
else
tmp = d1 * ((d2 + d4) - d3)
end if
code = tmp
end function
public static double code(double d1, double d2, double d3, double d4) {
double tmp;
if (d4 <= 3.1e+57) {
tmp = d1 * (d2 - (d1 + d3));
} else {
tmp = d1 * ((d2 + d4) - d3);
}
return tmp;
}
def code(d1, d2, d3, d4): tmp = 0 if d4 <= 3.1e+57: tmp = d1 * (d2 - (d1 + d3)) else: tmp = d1 * ((d2 + d4) - d3) return tmp
function code(d1, d2, d3, d4) tmp = 0.0 if (d4 <= 3.1e+57) tmp = Float64(d1 * Float64(d2 - Float64(d1 + d3))); else tmp = Float64(d1 * Float64(Float64(d2 + d4) - d3)); end return tmp end
function tmp_2 = code(d1, d2, d3, d4) tmp = 0.0; if (d4 <= 3.1e+57) tmp = d1 * (d2 - (d1 + d3)); else tmp = d1 * ((d2 + d4) - d3); end tmp_2 = tmp; end
code[d1_, d2_, d3_, d4_] := If[LessEqual[d4, 3.1e+57], N[(d1 * N[(d2 - N[(d1 + d3), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(d1 * N[(N[(d2 + d4), $MachinePrecision] - d3), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;d4 \leq 3.1 \cdot 10^{+57}:\\
\;\;\;\;d1 \cdot \left(d2 - \left(d1 + d3\right)\right)\\
\mathbf{else}:\\
\;\;\;\;d1 \cdot \left(\left(d2 + d4\right) - d3\right)\\
\end{array}
\end{array}
if d4 < 3.10000000000000013e57Initial program 90.0%
associate--l+90.0%
distribute-lft-out--91.4%
distribute-rgt-out--92.3%
distribute-lft-out100.0%
Simplified100.0%
Taylor expanded in d4 around 0 84.6%
if 3.10000000000000013e57 < d4 Initial program 76.1%
associate--l+76.1%
distribute-lft-out--76.1%
distribute-rgt-out--91.3%
distribute-lft-out100.0%
Simplified100.0%
Taylor expanded in d1 around 0 87.0%
Final simplification85.0%
(FPCore (d1 d2 d3 d4) :precision binary64 (if (<= d2 -4.8e+78) (* d1 d2) (if (<= d2 3.1e-143) (* d1 (- d1)) (* d1 d4))))
double code(double d1, double d2, double d3, double d4) {
double tmp;
if (d2 <= -4.8e+78) {
tmp = d1 * d2;
} else if (d2 <= 3.1e-143) {
tmp = d1 * -d1;
} else {
tmp = d1 * d4;
}
return tmp;
}
real(8) function code(d1, d2, d3, d4)
real(8), intent (in) :: d1
real(8), intent (in) :: d2
real(8), intent (in) :: d3
real(8), intent (in) :: d4
real(8) :: tmp
if (d2 <= (-4.8d+78)) then
tmp = d1 * d2
else if (d2 <= 3.1d-143) then
tmp = d1 * -d1
else
tmp = d1 * d4
end if
code = tmp
end function
public static double code(double d1, double d2, double d3, double d4) {
double tmp;
if (d2 <= -4.8e+78) {
tmp = d1 * d2;
} else if (d2 <= 3.1e-143) {
tmp = d1 * -d1;
} else {
tmp = d1 * d4;
}
return tmp;
}
def code(d1, d2, d3, d4): tmp = 0 if d2 <= -4.8e+78: tmp = d1 * d2 elif d2 <= 3.1e-143: tmp = d1 * -d1 else: tmp = d1 * d4 return tmp
function code(d1, d2, d3, d4) tmp = 0.0 if (d2 <= -4.8e+78) tmp = Float64(d1 * d2); elseif (d2 <= 3.1e-143) tmp = Float64(d1 * Float64(-d1)); else tmp = Float64(d1 * d4); end return tmp end
function tmp_2 = code(d1, d2, d3, d4) tmp = 0.0; if (d2 <= -4.8e+78) tmp = d1 * d2; elseif (d2 <= 3.1e-143) tmp = d1 * -d1; else tmp = d1 * d4; end tmp_2 = tmp; end
code[d1_, d2_, d3_, d4_] := If[LessEqual[d2, -4.8e+78], N[(d1 * d2), $MachinePrecision], If[LessEqual[d2, 3.1e-143], N[(d1 * (-d1)), $MachinePrecision], N[(d1 * d4), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;d2 \leq -4.8 \cdot 10^{+78}:\\
\;\;\;\;d1 \cdot d2\\
\mathbf{elif}\;d2 \leq 3.1 \cdot 10^{-143}:\\
\;\;\;\;d1 \cdot \left(-d1\right)\\
\mathbf{else}:\\
\;\;\;\;d1 \cdot d4\\
\end{array}
\end{array}
if d2 < -4.7999999999999997e78Initial program 84.7%
associate--l+84.7%
distribute-lft-out--86.9%
distribute-rgt-out--89.1%
distribute-lft-out100.0%
Simplified100.0%
Taylor expanded in d2 around inf 71.0%
if -4.7999999999999997e78 < d2 < 3.10000000000000007e-143Initial program 89.6%
associate--l+89.6%
distribute-lft-out--89.6%
distribute-rgt-out--93.1%
distribute-lft-out100.0%
Simplified100.0%
Taylor expanded in d1 around inf 44.0%
neg-mul-144.0%
Simplified44.0%
if 3.10000000000000007e-143 < d2 Initial program 86.2%
associate--l+86.2%
distribute-lft-out--88.3%
distribute-rgt-out--92.5%
distribute-lft-out100.0%
Simplified100.0%
Taylor expanded in d4 around inf 27.9%
Final simplification42.9%
(FPCore (d1 d2 d3 d4) :precision binary64 (if (<= d2 -1.02e+71) (* d1 d2) (* d1 d4)))
double code(double d1, double d2, double d3, double d4) {
double tmp;
if (d2 <= -1.02e+71) {
tmp = d1 * d2;
} else {
tmp = d1 * d4;
}
return tmp;
}
real(8) function code(d1, d2, d3, d4)
real(8), intent (in) :: d1
real(8), intent (in) :: d2
real(8), intent (in) :: d3
real(8), intent (in) :: d4
real(8) :: tmp
if (d2 <= (-1.02d+71)) then
tmp = d1 * d2
else
tmp = d1 * d4
end if
code = tmp
end function
public static double code(double d1, double d2, double d3, double d4) {
double tmp;
if (d2 <= -1.02e+71) {
tmp = d1 * d2;
} else {
tmp = d1 * d4;
}
return tmp;
}
def code(d1, d2, d3, d4): tmp = 0 if d2 <= -1.02e+71: tmp = d1 * d2 else: tmp = d1 * d4 return tmp
function code(d1, d2, d3, d4) tmp = 0.0 if (d2 <= -1.02e+71) tmp = Float64(d1 * d2); else tmp = Float64(d1 * d4); end return tmp end
function tmp_2 = code(d1, d2, d3, d4) tmp = 0.0; if (d2 <= -1.02e+71) tmp = d1 * d2; else tmp = d1 * d4; end tmp_2 = tmp; end
code[d1_, d2_, d3_, d4_] := If[LessEqual[d2, -1.02e+71], N[(d1 * d2), $MachinePrecision], N[(d1 * d4), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;d2 \leq -1.02 \cdot 10^{+71}:\\
\;\;\;\;d1 \cdot d2\\
\mathbf{else}:\\
\;\;\;\;d1 \cdot d4\\
\end{array}
\end{array}
if d2 < -1.02000000000000003e71Initial program 85.1%
associate--l+85.1%
distribute-lft-out--87.2%
distribute-rgt-out--89.3%
distribute-lft-out100.0%
Simplified100.0%
Taylor expanded in d2 around inf 69.6%
if -1.02000000000000003e71 < d2 Initial program 88.0%
associate--l+88.0%
distribute-lft-out--89.0%
distribute-rgt-out--92.8%
distribute-lft-out100.0%
Simplified100.0%
Taylor expanded in d4 around inf 30.3%
Final simplification37.5%
(FPCore (d1 d2 d3 d4) :precision binary64 (* d1 d4))
double code(double d1, double d2, double d3, double d4) {
return d1 * d4;
}
real(8) function code(d1, d2, d3, d4)
real(8), intent (in) :: d1
real(8), intent (in) :: d2
real(8), intent (in) :: d3
real(8), intent (in) :: d4
code = d1 * d4
end function
public static double code(double d1, double d2, double d3, double d4) {
return d1 * d4;
}
def code(d1, d2, d3, d4): return d1 * d4
function code(d1, d2, d3, d4) return Float64(d1 * d4) end
function tmp = code(d1, d2, d3, d4) tmp = d1 * d4; end
code[d1_, d2_, d3_, d4_] := N[(d1 * d4), $MachinePrecision]
\begin{array}{l}
\\
d1 \cdot d4
\end{array}
Initial program 87.5%
associate--l+87.5%
distribute-lft-out--88.6%
distribute-rgt-out--92.2%
distribute-lft-out100.0%
Simplified100.0%
Taylor expanded in d4 around inf 28.4%
Final simplification28.4%
(FPCore (d1 d2 d3 d4) :precision binary64 (* d1 (- (+ (- d2 d3) d4) d1)))
double code(double d1, double d2, double d3, double d4) {
return d1 * (((d2 - d3) + d4) - d1);
}
real(8) function code(d1, d2, d3, d4)
real(8), intent (in) :: d1
real(8), intent (in) :: d2
real(8), intent (in) :: d3
real(8), intent (in) :: d4
code = d1 * (((d2 - d3) + d4) - d1)
end function
public static double code(double d1, double d2, double d3, double d4) {
return d1 * (((d2 - d3) + d4) - d1);
}
def code(d1, d2, d3, d4): return d1 * (((d2 - d3) + d4) - d1)
function code(d1, d2, d3, d4) return Float64(d1 * Float64(Float64(Float64(d2 - d3) + d4) - d1)) end
function tmp = code(d1, d2, d3, d4) tmp = d1 * (((d2 - d3) + d4) - d1); end
code[d1_, d2_, d3_, d4_] := N[(d1 * N[(N[(N[(d2 - d3), $MachinePrecision] + d4), $MachinePrecision] - d1), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
d1 \cdot \left(\left(\left(d2 - d3\right) + d4\right) - d1\right)
\end{array}
herbie shell --seed 2023174
(FPCore (d1 d2 d3 d4)
:name "FastMath dist4"
:precision binary64
:herbie-target
(* d1 (- (+ (- d2 d3) d4) d1))
(- (+ (- (* d1 d2) (* d1 d3)) (* d4 d1)) (* d1 d1)))