
(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 86.3%
associate--l+86.3%
distribute-lft-out--86.7%
distribute-rgt-out--89.4%
distribute-lft-out100.0%
Simplified100.0%
(FPCore (d1 d2 d3 d4)
:precision binary64
(let* ((t_0 (* d1 (- d2 d1))) (t_1 (* d1 (- d2 d3))))
(if (<= d4 5.5e-170)
t_0
(if (<= d4 6.2e-85)
t_1
(if (<= d4 2e-44)
t_0
(if (<= d4 2.4e-30)
t_1
(if (or (<= d4 4.2e+28) (not (<= d4 4.1e+66)))
(* d1 (- d4 d3))
(* d1 (+ d2 d4)))))))))
double code(double d1, double d2, double d3, double d4) {
double t_0 = d1 * (d2 - d1);
double t_1 = d1 * (d2 - d3);
double tmp;
if (d4 <= 5.5e-170) {
tmp = t_0;
} else if (d4 <= 6.2e-85) {
tmp = t_1;
} else if (d4 <= 2e-44) {
tmp = t_0;
} else if (d4 <= 2.4e-30) {
tmp = t_1;
} else if ((d4 <= 4.2e+28) || !(d4 <= 4.1e+66)) {
tmp = d1 * (d4 - d3);
} 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) :: t_0
real(8) :: t_1
real(8) :: tmp
t_0 = d1 * (d2 - d1)
t_1 = d1 * (d2 - d3)
if (d4 <= 5.5d-170) then
tmp = t_0
else if (d4 <= 6.2d-85) then
tmp = t_1
else if (d4 <= 2d-44) then
tmp = t_0
else if (d4 <= 2.4d-30) then
tmp = t_1
else if ((d4 <= 4.2d+28) .or. (.not. (d4 <= 4.1d+66))) then
tmp = d1 * (d4 - d3)
else
tmp = d1 * (d2 + d4)
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 t_1 = d1 * (d2 - d3);
double tmp;
if (d4 <= 5.5e-170) {
tmp = t_0;
} else if (d4 <= 6.2e-85) {
tmp = t_1;
} else if (d4 <= 2e-44) {
tmp = t_0;
} else if (d4 <= 2.4e-30) {
tmp = t_1;
} else if ((d4 <= 4.2e+28) || !(d4 <= 4.1e+66)) {
tmp = d1 * (d4 - d3);
} else {
tmp = d1 * (d2 + d4);
}
return tmp;
}
def code(d1, d2, d3, d4): t_0 = d1 * (d2 - d1) t_1 = d1 * (d2 - d3) tmp = 0 if d4 <= 5.5e-170: tmp = t_0 elif d4 <= 6.2e-85: tmp = t_1 elif d4 <= 2e-44: tmp = t_0 elif d4 <= 2.4e-30: tmp = t_1 elif (d4 <= 4.2e+28) or not (d4 <= 4.1e+66): tmp = d1 * (d4 - d3) else: tmp = d1 * (d2 + d4) return tmp
function code(d1, d2, d3, d4) t_0 = Float64(d1 * Float64(d2 - d1)) t_1 = Float64(d1 * Float64(d2 - d3)) tmp = 0.0 if (d4 <= 5.5e-170) tmp = t_0; elseif (d4 <= 6.2e-85) tmp = t_1; elseif (d4 <= 2e-44) tmp = t_0; elseif (d4 <= 2.4e-30) tmp = t_1; elseif ((d4 <= 4.2e+28) || !(d4 <= 4.1e+66)) tmp = Float64(d1 * Float64(d4 - d3)); else tmp = Float64(d1 * Float64(d2 + d4)); end return tmp end
function tmp_2 = code(d1, d2, d3, d4) t_0 = d1 * (d2 - d1); t_1 = d1 * (d2 - d3); tmp = 0.0; if (d4 <= 5.5e-170) tmp = t_0; elseif (d4 <= 6.2e-85) tmp = t_1; elseif (d4 <= 2e-44) tmp = t_0; elseif (d4 <= 2.4e-30) tmp = t_1; elseif ((d4 <= 4.2e+28) || ~((d4 <= 4.1e+66))) tmp = d1 * (d4 - d3); else tmp = d1 * (d2 + d4); end tmp_2 = tmp; end
code[d1_, d2_, d3_, d4_] := Block[{t$95$0 = N[(d1 * N[(d2 - d1), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$1 = N[(d1 * N[(d2 - d3), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[d4, 5.5e-170], t$95$0, If[LessEqual[d4, 6.2e-85], t$95$1, If[LessEqual[d4, 2e-44], t$95$0, If[LessEqual[d4, 2.4e-30], t$95$1, If[Or[LessEqual[d4, 4.2e+28], N[Not[LessEqual[d4, 4.1e+66]], $MachinePrecision]], N[(d1 * N[(d4 - d3), $MachinePrecision]), $MachinePrecision], N[(d1 * N[(d2 + d4), $MachinePrecision]), $MachinePrecision]]]]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := d1 \cdot \left(d2 - d1\right)\\
t_1 := d1 \cdot \left(d2 - d3\right)\\
\mathbf{if}\;d4 \leq 5.5 \cdot 10^{-170}:\\
\;\;\;\;t\_0\\
\mathbf{elif}\;d4 \leq 6.2 \cdot 10^{-85}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;d4 \leq 2 \cdot 10^{-44}:\\
\;\;\;\;t\_0\\
\mathbf{elif}\;d4 \leq 2.4 \cdot 10^{-30}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;d4 \leq 4.2 \cdot 10^{+28} \lor \neg \left(d4 \leq 4.1 \cdot 10^{+66}\right):\\
\;\;\;\;d1 \cdot \left(d4 - d3\right)\\
\mathbf{else}:\\
\;\;\;\;d1 \cdot \left(d2 + d4\right)\\
\end{array}
\end{array}
if d4 < 5.50000000000000018e-170 or 6.2000000000000005e-85 < d4 < 1.99999999999999991e-44Initial program 87.9%
Taylor expanded in d4 around 0 75.7%
Taylor expanded in d3 around 0 57.1%
unpow257.1%
distribute-lft-out--62.5%
Simplified62.5%
if 5.50000000000000018e-170 < d4 < 6.2000000000000005e-85 or 1.99999999999999991e-44 < d4 < 2.39999999999999985e-30Initial program 91.3%
Taylor expanded in d4 around 0 91.3%
Taylor expanded in d1 around 0 83.5%
if 2.39999999999999985e-30 < d4 < 4.19999999999999978e28 or 4.09999999999999994e66 < d4 Initial program 79.9%
associate--l+79.9%
distribute-lft-out--79.9%
distribute-rgt-out--86.6%
distribute-lft-out99.9%
Simplified99.9%
Taylor expanded in d2 around 0 86.8%
+-commutative86.8%
associate--r+86.8%
Simplified86.8%
Taylor expanded in d1 around 0 85.1%
if 4.19999999999999978e28 < d4 < 4.09999999999999994e66Initial program 85.7%
sub-neg85.7%
associate-+l+85.7%
*-commutative85.7%
+-commutative85.7%
*-commutative85.7%
sub-neg85.7%
+-commutative85.7%
associate--l+85.7%
distribute-lft-out--100.0%
fma-define100.0%
distribute-rgt-out--100.0%
Simplified100.0%
Taylor expanded in d3 around 0 100.0%
Taylor expanded in d1 around 0 100.0%
Final simplification70.7%
(FPCore (d1 d2 d3 d4)
:precision binary64
(let* ((t_0 (* d1 (- d2 d1))) (t_1 (* d1 (- d2 d3))))
(if (<= d4 1.25e-167)
t_0
(if (<= d4 1.8e-83)
t_1
(if (<= d4 1.65e-44)
t_0
(if (or (<= d4 2.7e-29) (and (not (<= d4 1e+69)) (<= d4 1.35e+85)))
t_1
(* d1 (+ d2 d4))))))))
double code(double d1, double d2, double d3, double d4) {
double t_0 = d1 * (d2 - d1);
double t_1 = d1 * (d2 - d3);
double tmp;
if (d4 <= 1.25e-167) {
tmp = t_0;
} else if (d4 <= 1.8e-83) {
tmp = t_1;
} else if (d4 <= 1.65e-44) {
tmp = t_0;
} else if ((d4 <= 2.7e-29) || (!(d4 <= 1e+69) && (d4 <= 1.35e+85))) {
tmp = t_1;
} 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) :: t_0
real(8) :: t_1
real(8) :: tmp
t_0 = d1 * (d2 - d1)
t_1 = d1 * (d2 - d3)
if (d4 <= 1.25d-167) then
tmp = t_0
else if (d4 <= 1.8d-83) then
tmp = t_1
else if (d4 <= 1.65d-44) then
tmp = t_0
else if ((d4 <= 2.7d-29) .or. (.not. (d4 <= 1d+69)) .and. (d4 <= 1.35d+85)) then
tmp = t_1
else
tmp = d1 * (d2 + d4)
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 t_1 = d1 * (d2 - d3);
double tmp;
if (d4 <= 1.25e-167) {
tmp = t_0;
} else if (d4 <= 1.8e-83) {
tmp = t_1;
} else if (d4 <= 1.65e-44) {
tmp = t_0;
} else if ((d4 <= 2.7e-29) || (!(d4 <= 1e+69) && (d4 <= 1.35e+85))) {
tmp = t_1;
} else {
tmp = d1 * (d2 + d4);
}
return tmp;
}
def code(d1, d2, d3, d4): t_0 = d1 * (d2 - d1) t_1 = d1 * (d2 - d3) tmp = 0 if d4 <= 1.25e-167: tmp = t_0 elif d4 <= 1.8e-83: tmp = t_1 elif d4 <= 1.65e-44: tmp = t_0 elif (d4 <= 2.7e-29) or (not (d4 <= 1e+69) and (d4 <= 1.35e+85)): tmp = t_1 else: tmp = d1 * (d2 + d4) return tmp
function code(d1, d2, d3, d4) t_0 = Float64(d1 * Float64(d2 - d1)) t_1 = Float64(d1 * Float64(d2 - d3)) tmp = 0.0 if (d4 <= 1.25e-167) tmp = t_0; elseif (d4 <= 1.8e-83) tmp = t_1; elseif (d4 <= 1.65e-44) tmp = t_0; elseif ((d4 <= 2.7e-29) || (!(d4 <= 1e+69) && (d4 <= 1.35e+85))) tmp = t_1; else tmp = Float64(d1 * Float64(d2 + d4)); end return tmp end
function tmp_2 = code(d1, d2, d3, d4) t_0 = d1 * (d2 - d1); t_1 = d1 * (d2 - d3); tmp = 0.0; if (d4 <= 1.25e-167) tmp = t_0; elseif (d4 <= 1.8e-83) tmp = t_1; elseif (d4 <= 1.65e-44) tmp = t_0; elseif ((d4 <= 2.7e-29) || (~((d4 <= 1e+69)) && (d4 <= 1.35e+85))) tmp = t_1; else tmp = d1 * (d2 + d4); end tmp_2 = tmp; end
code[d1_, d2_, d3_, d4_] := Block[{t$95$0 = N[(d1 * N[(d2 - d1), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$1 = N[(d1 * N[(d2 - d3), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[d4, 1.25e-167], t$95$0, If[LessEqual[d4, 1.8e-83], t$95$1, If[LessEqual[d4, 1.65e-44], t$95$0, If[Or[LessEqual[d4, 2.7e-29], And[N[Not[LessEqual[d4, 1e+69]], $MachinePrecision], LessEqual[d4, 1.35e+85]]], t$95$1, N[(d1 * N[(d2 + d4), $MachinePrecision]), $MachinePrecision]]]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := d1 \cdot \left(d2 - d1\right)\\
t_1 := d1 \cdot \left(d2 - d3\right)\\
\mathbf{if}\;d4 \leq 1.25 \cdot 10^{-167}:\\
\;\;\;\;t\_0\\
\mathbf{elif}\;d4 \leq 1.8 \cdot 10^{-83}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;d4 \leq 1.65 \cdot 10^{-44}:\\
\;\;\;\;t\_0\\
\mathbf{elif}\;d4 \leq 2.7 \cdot 10^{-29} \lor \neg \left(d4 \leq 10^{+69}\right) \land d4 \leq 1.35 \cdot 10^{+85}:\\
\;\;\;\;t\_1\\
\mathbf{else}:\\
\;\;\;\;d1 \cdot \left(d2 + d4\right)\\
\end{array}
\end{array}
if d4 < 1.25000000000000005e-167 or 1.80000000000000006e-83 < d4 < 1.65000000000000003e-44Initial program 87.9%
Taylor expanded in d4 around 0 75.7%
Taylor expanded in d3 around 0 57.1%
unpow257.1%
distribute-lft-out--62.5%
Simplified62.5%
if 1.25000000000000005e-167 < d4 < 1.80000000000000006e-83 or 1.65000000000000003e-44 < d4 < 2.70000000000000023e-29 or 1.0000000000000001e69 < d4 < 1.34999999999999992e85Initial program 92.2%
Taylor expanded in d4 around 0 92.2%
Taylor expanded in d1 around 0 85.3%
if 2.70000000000000023e-29 < d4 < 1.0000000000000001e69 or 1.34999999999999992e85 < d4 Initial program 79.7%
sub-neg79.7%
associate-+l+79.7%
*-commutative79.7%
+-commutative79.7%
*-commutative79.7%
sub-neg79.7%
+-commutative79.7%
associate--l+79.7%
distribute-lft-out--82.8%
fma-define89.1%
distribute-rgt-out--93.8%
Simplified93.8%
Taylor expanded in d3 around 0 76.7%
Taylor expanded in d1 around 0 84.5%
Final simplification70.3%
(FPCore (d1 d2 d3 d4)
:precision binary64
(let* ((t_0 (* d1 (- (- d1) d3))))
(if (<= d2 -7e+98)
(* d1 (- d2 d3))
(if (<= d2 -1.38e+48)
t_0
(if (<= d2 -5.1e+14)
(* d1 (+ d2 d4))
(if (<= d2 -2.5e-103) t_0 (* d1 (- d4 d3))))))))
double code(double d1, double d2, double d3, double d4) {
double t_0 = d1 * (-d1 - d3);
double tmp;
if (d2 <= -7e+98) {
tmp = d1 * (d2 - d3);
} else if (d2 <= -1.38e+48) {
tmp = t_0;
} else if (d2 <= -5.1e+14) {
tmp = d1 * (d2 + d4);
} else if (d2 <= -2.5e-103) {
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 * (-d1 - d3)
if (d2 <= (-7d+98)) then
tmp = d1 * (d2 - d3)
else if (d2 <= (-1.38d+48)) then
tmp = t_0
else if (d2 <= (-5.1d+14)) then
tmp = d1 * (d2 + d4)
else if (d2 <= (-2.5d-103)) 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 * (-d1 - d3);
double tmp;
if (d2 <= -7e+98) {
tmp = d1 * (d2 - d3);
} else if (d2 <= -1.38e+48) {
tmp = t_0;
} else if (d2 <= -5.1e+14) {
tmp = d1 * (d2 + d4);
} else if (d2 <= -2.5e-103) {
tmp = t_0;
} else {
tmp = d1 * (d4 - d3);
}
return tmp;
}
def code(d1, d2, d3, d4): t_0 = d1 * (-d1 - d3) tmp = 0 if d2 <= -7e+98: tmp = d1 * (d2 - d3) elif d2 <= -1.38e+48: tmp = t_0 elif d2 <= -5.1e+14: tmp = d1 * (d2 + d4) elif d2 <= -2.5e-103: tmp = t_0 else: tmp = d1 * (d4 - d3) return tmp
function code(d1, d2, d3, d4) t_0 = Float64(d1 * Float64(Float64(-d1) - d3)) tmp = 0.0 if (d2 <= -7e+98) tmp = Float64(d1 * Float64(d2 - d3)); elseif (d2 <= -1.38e+48) tmp = t_0; elseif (d2 <= -5.1e+14) tmp = Float64(d1 * Float64(d2 + d4)); elseif (d2 <= -2.5e-103) 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 * (-d1 - d3); tmp = 0.0; if (d2 <= -7e+98) tmp = d1 * (d2 - d3); elseif (d2 <= -1.38e+48) tmp = t_0; elseif (d2 <= -5.1e+14) tmp = d1 * (d2 + d4); elseif (d2 <= -2.5e-103) 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[((-d1) - d3), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[d2, -7e+98], N[(d1 * N[(d2 - d3), $MachinePrecision]), $MachinePrecision], If[LessEqual[d2, -1.38e+48], t$95$0, If[LessEqual[d2, -5.1e+14], N[(d1 * N[(d2 + d4), $MachinePrecision]), $MachinePrecision], If[LessEqual[d2, -2.5e-103], t$95$0, N[(d1 * N[(d4 - d3), $MachinePrecision]), $MachinePrecision]]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := d1 \cdot \left(\left(-d1\right) - d3\right)\\
\mathbf{if}\;d2 \leq -7 \cdot 10^{+98}:\\
\;\;\;\;d1 \cdot \left(d2 - d3\right)\\
\mathbf{elif}\;d2 \leq -1.38 \cdot 10^{+48}:\\
\;\;\;\;t\_0\\
\mathbf{elif}\;d2 \leq -5.1 \cdot 10^{+14}:\\
\;\;\;\;d1 \cdot \left(d2 + d4\right)\\
\mathbf{elif}\;d2 \leq -2.5 \cdot 10^{-103}:\\
\;\;\;\;t\_0\\
\mathbf{else}:\\
\;\;\;\;d1 \cdot \left(d4 - d3\right)\\
\end{array}
\end{array}
if d2 < -7e98Initial program 73.3%
Taylor expanded in d4 around 0 65.1%
Taylor expanded in d1 around 0 78.4%
if -7e98 < d2 < -1.3800000000000001e48 or -5.1e14 < d2 < -2.49999999999999983e-103Initial program 90.7%
associate--l+90.7%
distribute-lft-out--90.7%
distribute-rgt-out--90.7%
distribute-lft-out100.0%
Simplified100.0%
Taylor expanded in d2 around 0 90.5%
+-commutative90.5%
associate--r+90.5%
Simplified90.5%
Taylor expanded in d4 around 0 79.2%
associate-*r*79.2%
mul-1-neg79.2%
Simplified79.2%
if -1.3800000000000001e48 < d2 < -5.1e14Initial program 100.0%
sub-neg100.0%
associate-+l+100.0%
*-commutative100.0%
+-commutative100.0%
*-commutative100.0%
sub-neg100.0%
+-commutative100.0%
associate--l+100.0%
distribute-lft-out--100.0%
fma-define100.0%
distribute-rgt-out--100.0%
Simplified100.0%
Taylor expanded in d3 around 0 100.0%
Taylor expanded in d1 around 0 85.9%
if -2.49999999999999983e-103 < d2 Initial program 88.2%
associate--l+88.2%
distribute-lft-out--88.2%
distribute-rgt-out--91.9%
distribute-lft-out100.0%
Simplified100.0%
Taylor expanded in d2 around 0 75.2%
+-commutative75.2%
associate--r+75.2%
Simplified75.2%
Taylor expanded in d1 around 0 54.8%
Final simplification63.9%
(FPCore (d1 d2 d3 d4)
:precision binary64
(if (or (<= d3 -1.48e+116)
(not
(or (<= d3 1.5e+82) (and (not (<= d3 1.95e+132)) (<= d3 2e+138)))))
(* d1 (- d3))
(* d1 (+ d2 d4))))
double code(double d1, double d2, double d3, double d4) {
double tmp;
if ((d3 <= -1.48e+116) || !((d3 <= 1.5e+82) || (!(d3 <= 1.95e+132) && (d3 <= 2e+138)))) {
tmp = d1 * -d3;
} 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 ((d3 <= (-1.48d+116)) .or. (.not. (d3 <= 1.5d+82) .or. (.not. (d3 <= 1.95d+132)) .and. (d3 <= 2d+138))) then
tmp = d1 * -d3
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 ((d3 <= -1.48e+116) || !((d3 <= 1.5e+82) || (!(d3 <= 1.95e+132) && (d3 <= 2e+138)))) {
tmp = d1 * -d3;
} else {
tmp = d1 * (d2 + d4);
}
return tmp;
}
def code(d1, d2, d3, d4): tmp = 0 if (d3 <= -1.48e+116) or not ((d3 <= 1.5e+82) or (not (d3 <= 1.95e+132) and (d3 <= 2e+138))): tmp = d1 * -d3 else: tmp = d1 * (d2 + d4) return tmp
function code(d1, d2, d3, d4) tmp = 0.0 if ((d3 <= -1.48e+116) || !((d3 <= 1.5e+82) || (!(d3 <= 1.95e+132) && (d3 <= 2e+138)))) tmp = Float64(d1 * Float64(-d3)); else tmp = Float64(d1 * Float64(d2 + d4)); end return tmp end
function tmp_2 = code(d1, d2, d3, d4) tmp = 0.0; if ((d3 <= -1.48e+116) || ~(((d3 <= 1.5e+82) || (~((d3 <= 1.95e+132)) && (d3 <= 2e+138))))) tmp = d1 * -d3; else tmp = d1 * (d2 + d4); end tmp_2 = tmp; end
code[d1_, d2_, d3_, d4_] := If[Or[LessEqual[d3, -1.48e+116], N[Not[Or[LessEqual[d3, 1.5e+82], And[N[Not[LessEqual[d3, 1.95e+132]], $MachinePrecision], LessEqual[d3, 2e+138]]]], $MachinePrecision]], N[(d1 * (-d3)), $MachinePrecision], N[(d1 * N[(d2 + d4), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;d3 \leq -1.48 \cdot 10^{+116} \lor \neg \left(d3 \leq 1.5 \cdot 10^{+82} \lor \neg \left(d3 \leq 1.95 \cdot 10^{+132}\right) \land d3 \leq 2 \cdot 10^{+138}\right):\\
\;\;\;\;d1 \cdot \left(-d3\right)\\
\mathbf{else}:\\
\;\;\;\;d1 \cdot \left(d2 + d4\right)\\
\end{array}
\end{array}
if d3 < -1.48000000000000002e116 or 1.49999999999999995e82 < d3 < 1.95000000000000001e132 or 2.0000000000000001e138 < d3 Initial program 81.3%
associate--l+81.3%
distribute-lft-out--82.5%
distribute-rgt-out--83.7%
distribute-lft-out99.9%
Simplified99.9%
Taylor expanded in d3 around inf 66.5%
mul-1-neg66.5%
distribute-rgt-neg-out66.5%
Simplified66.5%
if -1.48000000000000002e116 < d3 < 1.49999999999999995e82 or 1.95000000000000001e132 < d3 < 2.0000000000000001e138Initial program 88.8%
sub-neg88.8%
associate-+l+88.8%
*-commutative88.8%
+-commutative88.8%
*-commutative88.8%
sub-neg88.8%
+-commutative88.8%
associate--l+88.8%
distribute-lft-out--90.0%
fma-define92.9%
distribute-rgt-out--98.2%
Simplified98.2%
Taylor expanded in d3 around 0 89.6%
Taylor expanded in d1 around 0 72.3%
Final simplification70.3%
(FPCore (d1 d2 d3 d4)
:precision binary64
(let* ((t_0 (* d1 (- d4 d3))))
(if (<= d3 -1e+116)
t_0
(if (<= d3 7.2e+96)
(* d1 (- (+ d2 d4) d1))
(if (or (<= d3 1e+149) (not (<= d3 1.7e+149))) t_0 (* d1 (- d2 d1)))))))
double code(double d1, double d2, double d3, double d4) {
double t_0 = d1 * (d4 - d3);
double tmp;
if (d3 <= -1e+116) {
tmp = t_0;
} else if (d3 <= 7.2e+96) {
tmp = d1 * ((d2 + d4) - d1);
} else if ((d3 <= 1e+149) || !(d3 <= 1.7e+149)) {
tmp = t_0;
} else {
tmp = d1 * (d2 - 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) :: t_0
real(8) :: tmp
t_0 = d1 * (d4 - d3)
if (d3 <= (-1d+116)) then
tmp = t_0
else if (d3 <= 7.2d+96) then
tmp = d1 * ((d2 + d4) - d1)
else if ((d3 <= 1d+149) .or. (.not. (d3 <= 1.7d+149))) then
tmp = t_0
else
tmp = d1 * (d2 - d1)
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 tmp;
if (d3 <= -1e+116) {
tmp = t_0;
} else if (d3 <= 7.2e+96) {
tmp = d1 * ((d2 + d4) - d1);
} else if ((d3 <= 1e+149) || !(d3 <= 1.7e+149)) {
tmp = t_0;
} else {
tmp = d1 * (d2 - d1);
}
return tmp;
}
def code(d1, d2, d3, d4): t_0 = d1 * (d4 - d3) tmp = 0 if d3 <= -1e+116: tmp = t_0 elif d3 <= 7.2e+96: tmp = d1 * ((d2 + d4) - d1) elif (d3 <= 1e+149) or not (d3 <= 1.7e+149): tmp = t_0 else: tmp = d1 * (d2 - d1) return tmp
function code(d1, d2, d3, d4) t_0 = Float64(d1 * Float64(d4 - d3)) tmp = 0.0 if (d3 <= -1e+116) tmp = t_0; elseif (d3 <= 7.2e+96) tmp = Float64(d1 * Float64(Float64(d2 + d4) - d1)); elseif ((d3 <= 1e+149) || !(d3 <= 1.7e+149)) tmp = t_0; else tmp = Float64(d1 * Float64(d2 - d1)); end return tmp end
function tmp_2 = code(d1, d2, d3, d4) t_0 = d1 * (d4 - d3); tmp = 0.0; if (d3 <= -1e+116) tmp = t_0; elseif (d3 <= 7.2e+96) tmp = d1 * ((d2 + d4) - d1); elseif ((d3 <= 1e+149) || ~((d3 <= 1.7e+149))) tmp = t_0; else tmp = d1 * (d2 - d1); end tmp_2 = tmp; end
code[d1_, d2_, d3_, d4_] := Block[{t$95$0 = N[(d1 * N[(d4 - d3), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[d3, -1e+116], t$95$0, If[LessEqual[d3, 7.2e+96], N[(d1 * N[(N[(d2 + d4), $MachinePrecision] - d1), $MachinePrecision]), $MachinePrecision], If[Or[LessEqual[d3, 1e+149], N[Not[LessEqual[d3, 1.7e+149]], $MachinePrecision]], t$95$0, N[(d1 * N[(d2 - d1), $MachinePrecision]), $MachinePrecision]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := d1 \cdot \left(d4 - d3\right)\\
\mathbf{if}\;d3 \leq -1 \cdot 10^{+116}:\\
\;\;\;\;t\_0\\
\mathbf{elif}\;d3 \leq 7.2 \cdot 10^{+96}:\\
\;\;\;\;d1 \cdot \left(\left(d2 + d4\right) - d1\right)\\
\mathbf{elif}\;d3 \leq 10^{+149} \lor \neg \left(d3 \leq 1.7 \cdot 10^{+149}\right):\\
\;\;\;\;t\_0\\
\mathbf{else}:\\
\;\;\;\;d1 \cdot \left(d2 - d1\right)\\
\end{array}
\end{array}
if d3 < -1.00000000000000002e116 or 7.20000000000000026e96 < d3 < 1.00000000000000005e149 or 1.6999999999999999e149 < d3 Initial program 81.5%
associate--l+81.5%
distribute-lft-out--82.7%
distribute-rgt-out--83.9%
distribute-lft-out99.9%
Simplified99.9%
Taylor expanded in d2 around 0 86.5%
+-commutative86.5%
associate--r+86.5%
Simplified86.5%
Taylor expanded in d1 around 0 77.3%
if -1.00000000000000002e116 < d3 < 7.20000000000000026e96Initial program 89.3%
associate--l+89.3%
distribute-lft-out--89.3%
distribute-rgt-out--92.8%
distribute-lft-out100.0%
Simplified100.0%
Taylor expanded in d3 around 0 94.8%
if 1.00000000000000005e149 < d3 < 1.6999999999999999e149Initial program 0.0%
Taylor expanded in d4 around 0 0.0%
Taylor expanded in d3 around 0 100.0%
unpow2100.0%
distribute-lft-out--100.0%
Simplified100.0%
Final simplification88.9%
(FPCore (d1 d2 d3 d4)
:precision binary64
(if (<= d4 3.9e-44)
(* d1 (- d2 d1))
(if (or (<= d4 7e-24) (and (not (<= d4 3.8e+77)) (<= d4 1.18e+85)))
(* d1 (- d3))
(* d1 (+ d2 d4)))))
double code(double d1, double d2, double d3, double d4) {
double tmp;
if (d4 <= 3.9e-44) {
tmp = d1 * (d2 - d1);
} else if ((d4 <= 7e-24) || (!(d4 <= 3.8e+77) && (d4 <= 1.18e+85))) {
tmp = d1 * -d3;
} 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 (d4 <= 3.9d-44) then
tmp = d1 * (d2 - d1)
else if ((d4 <= 7d-24) .or. (.not. (d4 <= 3.8d+77)) .and. (d4 <= 1.18d+85)) then
tmp = d1 * -d3
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 (d4 <= 3.9e-44) {
tmp = d1 * (d2 - d1);
} else if ((d4 <= 7e-24) || (!(d4 <= 3.8e+77) && (d4 <= 1.18e+85))) {
tmp = d1 * -d3;
} else {
tmp = d1 * (d2 + d4);
}
return tmp;
}
def code(d1, d2, d3, d4): tmp = 0 if d4 <= 3.9e-44: tmp = d1 * (d2 - d1) elif (d4 <= 7e-24) or (not (d4 <= 3.8e+77) and (d4 <= 1.18e+85)): tmp = d1 * -d3 else: tmp = d1 * (d2 + d4) return tmp
function code(d1, d2, d3, d4) tmp = 0.0 if (d4 <= 3.9e-44) tmp = Float64(d1 * Float64(d2 - d1)); elseif ((d4 <= 7e-24) || (!(d4 <= 3.8e+77) && (d4 <= 1.18e+85))) tmp = Float64(d1 * Float64(-d3)); else tmp = Float64(d1 * Float64(d2 + d4)); end return tmp end
function tmp_2 = code(d1, d2, d3, d4) tmp = 0.0; if (d4 <= 3.9e-44) tmp = d1 * (d2 - d1); elseif ((d4 <= 7e-24) || (~((d4 <= 3.8e+77)) && (d4 <= 1.18e+85))) tmp = d1 * -d3; else tmp = d1 * (d2 + d4); end tmp_2 = tmp; end
code[d1_, d2_, d3_, d4_] := If[LessEqual[d4, 3.9e-44], N[(d1 * N[(d2 - d1), $MachinePrecision]), $MachinePrecision], If[Or[LessEqual[d4, 7e-24], And[N[Not[LessEqual[d4, 3.8e+77]], $MachinePrecision], LessEqual[d4, 1.18e+85]]], N[(d1 * (-d3)), $MachinePrecision], N[(d1 * N[(d2 + d4), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;d4 \leq 3.9 \cdot 10^{-44}:\\
\;\;\;\;d1 \cdot \left(d2 - d1\right)\\
\mathbf{elif}\;d4 \leq 7 \cdot 10^{-24} \lor \neg \left(d4 \leq 3.8 \cdot 10^{+77}\right) \land d4 \leq 1.18 \cdot 10^{+85}:\\
\;\;\;\;d1 \cdot \left(-d3\right)\\
\mathbf{else}:\\
\;\;\;\;d1 \cdot \left(d2 + d4\right)\\
\end{array}
\end{array}
if d4 < 3.9000000000000002e-44Initial program 88.6%
Taylor expanded in d4 around 0 77.5%
Taylor expanded in d3 around 0 56.6%
unpow256.6%
distribute-lft-out--62.0%
Simplified62.0%
if 3.9000000000000002e-44 < d4 < 6.9999999999999993e-24 or 3.8000000000000001e77 < d4 < 1.17999999999999997e85Initial program 88.9%
associate--l+88.9%
distribute-lft-out--88.9%
distribute-rgt-out--88.9%
distribute-lft-out100.0%
Simplified100.0%
Taylor expanded in d3 around inf 89.5%
mul-1-neg89.5%
distribute-rgt-neg-out89.5%
Simplified89.5%
if 6.9999999999999993e-24 < d4 < 3.8000000000000001e77 or 1.17999999999999997e85 < d4 Initial program 79.3%
sub-neg79.3%
associate-+l+79.3%
*-commutative79.3%
+-commutative79.3%
*-commutative79.3%
sub-neg79.3%
+-commutative79.3%
associate--l+79.3%
distribute-lft-out--82.5%
fma-define88.9%
distribute-rgt-out--93.6%
Simplified93.6%
Taylor expanded in d3 around 0 75.4%
Taylor expanded in d1 around 0 83.3%
Final simplification68.2%
(FPCore (d1 d2 d3 d4)
:precision binary64
(if (<= d4 2.6e-248)
(* d1 d2)
(if (or (<= d4 1.9e-23) (and (not (<= d4 1.72e+69)) (<= d4 3.8e+85)))
(* d1 (- d3))
(* d1 d4))))
double code(double d1, double d2, double d3, double d4) {
double tmp;
if (d4 <= 2.6e-248) {
tmp = d1 * d2;
} else if ((d4 <= 1.9e-23) || (!(d4 <= 1.72e+69) && (d4 <= 3.8e+85))) {
tmp = d1 * -d3;
} 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 (d4 <= 2.6d-248) then
tmp = d1 * d2
else if ((d4 <= 1.9d-23) .or. (.not. (d4 <= 1.72d+69)) .and. (d4 <= 3.8d+85)) then
tmp = d1 * -d3
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 (d4 <= 2.6e-248) {
tmp = d1 * d2;
} else if ((d4 <= 1.9e-23) || (!(d4 <= 1.72e+69) && (d4 <= 3.8e+85))) {
tmp = d1 * -d3;
} else {
tmp = d1 * d4;
}
return tmp;
}
def code(d1, d2, d3, d4): tmp = 0 if d4 <= 2.6e-248: tmp = d1 * d2 elif (d4 <= 1.9e-23) or (not (d4 <= 1.72e+69) and (d4 <= 3.8e+85)): tmp = d1 * -d3 else: tmp = d1 * d4 return tmp
function code(d1, d2, d3, d4) tmp = 0.0 if (d4 <= 2.6e-248) tmp = Float64(d1 * d2); elseif ((d4 <= 1.9e-23) || (!(d4 <= 1.72e+69) && (d4 <= 3.8e+85))) tmp = Float64(d1 * Float64(-d3)); else tmp = Float64(d1 * d4); end return tmp end
function tmp_2 = code(d1, d2, d3, d4) tmp = 0.0; if (d4 <= 2.6e-248) tmp = d1 * d2; elseif ((d4 <= 1.9e-23) || (~((d4 <= 1.72e+69)) && (d4 <= 3.8e+85))) tmp = d1 * -d3; else tmp = d1 * d4; end tmp_2 = tmp; end
code[d1_, d2_, d3_, d4_] := If[LessEqual[d4, 2.6e-248], N[(d1 * d2), $MachinePrecision], If[Or[LessEqual[d4, 1.9e-23], And[N[Not[LessEqual[d4, 1.72e+69]], $MachinePrecision], LessEqual[d4, 3.8e+85]]], N[(d1 * (-d3)), $MachinePrecision], N[(d1 * d4), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;d4 \leq 2.6 \cdot 10^{-248}:\\
\;\;\;\;d1 \cdot d2\\
\mathbf{elif}\;d4 \leq 1.9 \cdot 10^{-23} \lor \neg \left(d4 \leq 1.72 \cdot 10^{+69}\right) \land d4 \leq 3.8 \cdot 10^{+85}:\\
\;\;\;\;d1 \cdot \left(-d3\right)\\
\mathbf{else}:\\
\;\;\;\;d1 \cdot d4\\
\end{array}
\end{array}
if d4 < 2.60000000000000007e-248Initial program 88.2%
associate--l+88.2%
distribute-lft-out--89.0%
distribute-rgt-out--91.3%
distribute-lft-out100.0%
Simplified100.0%
Taylor expanded in d2 around inf 35.9%
if 2.60000000000000007e-248 < d4 < 1.90000000000000006e-23 or 1.72e69 < d4 < 3.79999999999999992e85Initial program 89.5%
associate--l+89.5%
distribute-lft-out--89.5%
distribute-rgt-out--89.5%
distribute-lft-out99.9%
Simplified99.9%
Taylor expanded in d3 around inf 39.9%
mul-1-neg39.9%
distribute-rgt-neg-out39.9%
Simplified39.9%
if 1.90000000000000006e-23 < d4 < 1.72e69 or 3.79999999999999992e85 < d4 Initial program 79.0%
associate--l+79.0%
distribute-lft-out--79.0%
distribute-rgt-out--85.5%
distribute-lft-out100.0%
Simplified100.0%
Taylor expanded in d4 around inf 71.8%
Final simplification45.6%
(FPCore (d1 d2 d3 d4)
:precision binary64
(if (<= d4 3.7e+14)
(* d1 (- (- d2 d3) d1))
(if (or (<= d4 1.58e+190) (not (<= d4 2.6e+274)))
(* d1 (- d4 d3))
(* d1 (- (+ d2 d4) d1)))))
double code(double d1, double d2, double d3, double d4) {
double tmp;
if (d4 <= 3.7e+14) {
tmp = d1 * ((d2 - d3) - d1);
} else if ((d4 <= 1.58e+190) || !(d4 <= 2.6e+274)) {
tmp = d1 * (d4 - d3);
} else {
tmp = d1 * ((d2 + d4) - 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 (d4 <= 3.7d+14) then
tmp = d1 * ((d2 - d3) - d1)
else if ((d4 <= 1.58d+190) .or. (.not. (d4 <= 2.6d+274))) then
tmp = d1 * (d4 - d3)
else
tmp = d1 * ((d2 + d4) - d1)
end if
code = tmp
end function
public static double code(double d1, double d2, double d3, double d4) {
double tmp;
if (d4 <= 3.7e+14) {
tmp = d1 * ((d2 - d3) - d1);
} else if ((d4 <= 1.58e+190) || !(d4 <= 2.6e+274)) {
tmp = d1 * (d4 - d3);
} else {
tmp = d1 * ((d2 + d4) - d1);
}
return tmp;
}
def code(d1, d2, d3, d4): tmp = 0 if d4 <= 3.7e+14: tmp = d1 * ((d2 - d3) - d1) elif (d4 <= 1.58e+190) or not (d4 <= 2.6e+274): tmp = d1 * (d4 - d3) else: tmp = d1 * ((d2 + d4) - d1) return tmp
function code(d1, d2, d3, d4) tmp = 0.0 if (d4 <= 3.7e+14) tmp = Float64(d1 * Float64(Float64(d2 - d3) - d1)); elseif ((d4 <= 1.58e+190) || !(d4 <= 2.6e+274)) tmp = Float64(d1 * Float64(d4 - d3)); else tmp = Float64(d1 * Float64(Float64(d2 + d4) - d1)); end return tmp end
function tmp_2 = code(d1, d2, d3, d4) tmp = 0.0; if (d4 <= 3.7e+14) tmp = d1 * ((d2 - d3) - d1); elseif ((d4 <= 1.58e+190) || ~((d4 <= 2.6e+274))) tmp = d1 * (d4 - d3); else tmp = d1 * ((d2 + d4) - d1); end tmp_2 = tmp; end
code[d1_, d2_, d3_, d4_] := If[LessEqual[d4, 3.7e+14], N[(d1 * N[(N[(d2 - d3), $MachinePrecision] - d1), $MachinePrecision]), $MachinePrecision], If[Or[LessEqual[d4, 1.58e+190], N[Not[LessEqual[d4, 2.6e+274]], $MachinePrecision]], N[(d1 * N[(d4 - d3), $MachinePrecision]), $MachinePrecision], N[(d1 * N[(N[(d2 + d4), $MachinePrecision] - d1), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;d4 \leq 3.7 \cdot 10^{+14}:\\
\;\;\;\;d1 \cdot \left(\left(d2 - d3\right) - d1\right)\\
\mathbf{elif}\;d4 \leq 1.58 \cdot 10^{+190} \lor \neg \left(d4 \leq 2.6 \cdot 10^{+274}\right):\\
\;\;\;\;d1 \cdot \left(d4 - d3\right)\\
\mathbf{else}:\\
\;\;\;\;d1 \cdot \left(\left(d2 + d4\right) - d1\right)\\
\end{array}
\end{array}
if d4 < 3.7e14Initial program 88.6%
associate--l+88.6%
distribute-lft-out--89.1%
distribute-rgt-out--90.6%
distribute-lft-out100.0%
Simplified100.0%
Taylor expanded in d4 around 0 86.9%
+-commutative86.9%
associate--r+86.9%
Simplified86.9%
if 3.7e14 < d4 < 1.58000000000000001e190 or 2.5999999999999998e274 < d4 Initial program 86.3%
associate--l+86.3%
distribute-lft-out--86.3%
distribute-rgt-out--90.9%
distribute-lft-out100.0%
Simplified100.0%
Taylor expanded in d2 around 0 82.5%
+-commutative82.5%
associate--r+82.5%
Simplified82.5%
Taylor expanded in d1 around 0 84.7%
if 1.58000000000000001e190 < d4 < 2.5999999999999998e274Initial program 63.1%
associate--l+63.1%
distribute-lft-out--63.1%
distribute-rgt-out--73.6%
distribute-lft-out99.9%
Simplified99.9%
Taylor expanded in d3 around 0 99.9%
Final simplification87.5%
(FPCore (d1 d2 d3 d4) :precision binary64 (if (<= d2 -4.45e+98) (* d1 (- (- d2 d3) d1)) (* d1 (- (- d4 d3) d1))))
double code(double d1, double d2, double d3, double d4) {
double tmp;
if (d2 <= -4.45e+98) {
tmp = d1 * ((d2 - d3) - d1);
} else {
tmp = d1 * ((d4 - 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 (d2 <= (-4.45d+98)) then
tmp = d1 * ((d2 - d3) - d1)
else
tmp = d1 * ((d4 - d3) - d1)
end if
code = tmp
end function
public static double code(double d1, double d2, double d3, double d4) {
double tmp;
if (d2 <= -4.45e+98) {
tmp = d1 * ((d2 - d3) - d1);
} else {
tmp = d1 * ((d4 - d3) - d1);
}
return tmp;
}
def code(d1, d2, d3, d4): tmp = 0 if d2 <= -4.45e+98: tmp = d1 * ((d2 - d3) - d1) else: tmp = d1 * ((d4 - d3) - d1) return tmp
function code(d1, d2, d3, d4) tmp = 0.0 if (d2 <= -4.45e+98) tmp = Float64(d1 * Float64(Float64(d2 - d3) - d1)); else tmp = Float64(d1 * Float64(Float64(d4 - d3) - d1)); end return tmp end
function tmp_2 = code(d1, d2, d3, d4) tmp = 0.0; if (d2 <= -4.45e+98) tmp = d1 * ((d2 - d3) - d1); else tmp = d1 * ((d4 - d3) - d1); end tmp_2 = tmp; end
code[d1_, d2_, d3_, d4_] := If[LessEqual[d2, -4.45e+98], N[(d1 * N[(N[(d2 - d3), $MachinePrecision] - d1), $MachinePrecision]), $MachinePrecision], N[(d1 * N[(N[(d4 - d3), $MachinePrecision] - d1), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;d2 \leq -4.45 \cdot 10^{+98}:\\
\;\;\;\;d1 \cdot \left(\left(d2 - d3\right) - d1\right)\\
\mathbf{else}:\\
\;\;\;\;d1 \cdot \left(\left(d4 - d3\right) - d1\right)\\
\end{array}
\end{array}
if d2 < -4.44999999999999989e98Initial program 73.3%
associate--l+73.3%
distribute-lft-out--75.5%
distribute-rgt-out--77.7%
distribute-lft-out99.9%
Simplified99.9%
Taylor expanded in d4 around 0 85.1%
+-commutative85.1%
associate--r+85.1%
Simplified85.1%
if -4.44999999999999989e98 < d2 Initial program 89.1%
associate--l+89.1%
distribute-lft-out--89.1%
distribute-rgt-out--91.9%
distribute-lft-out100.0%
Simplified100.0%
Taylor expanded in d2 around 0 79.1%
+-commutative79.1%
associate--r+79.1%
Simplified79.1%
(FPCore (d1 d2 d3 d4) :precision binary64 (if (<= d4 5.2e-91) (* d1 d2) (* d1 d4)))
double code(double d1, double d2, double d3, double d4) {
double tmp;
if (d4 <= 5.2e-91) {
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 (d4 <= 5.2d-91) 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 (d4 <= 5.2e-91) {
tmp = d1 * d2;
} else {
tmp = d1 * d4;
}
return tmp;
}
def code(d1, d2, d3, d4): tmp = 0 if d4 <= 5.2e-91: tmp = d1 * d2 else: tmp = d1 * d4 return tmp
function code(d1, d2, d3, d4) tmp = 0.0 if (d4 <= 5.2e-91) 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 (d4 <= 5.2e-91) tmp = d1 * d2; else tmp = d1 * d4; end tmp_2 = tmp; end
code[d1_, d2_, d3_, d4_] := If[LessEqual[d4, 5.2e-91], N[(d1 * d2), $MachinePrecision], N[(d1 * d4), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;d4 \leq 5.2 \cdot 10^{-91}:\\
\;\;\;\;d1 \cdot d2\\
\mathbf{else}:\\
\;\;\;\;d1 \cdot d4\\
\end{array}
\end{array}
if d4 < 5.20000000000000028e-91Initial program 88.9%
associate--l+88.9%
distribute-lft-out--89.5%
distribute-rgt-out--91.3%
distribute-lft-out100.0%
Simplified100.0%
Taylor expanded in d2 around inf 35.5%
if 5.20000000000000028e-91 < d4 Initial program 80.9%
associate--l+80.9%
distribute-lft-out--80.9%
distribute-rgt-out--85.7%
distribute-lft-out100.0%
Simplified100.0%
Taylor expanded in d4 around inf 55.0%
(FPCore (d1 d2 d3 d4) :precision binary64 (* d1 d2))
double code(double d1, double d2, double d3, double d4) {
return d1 * d2;
}
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
end function
public static double code(double d1, double d2, double d3, double d4) {
return d1 * d2;
}
def code(d1, d2, d3, d4): return d1 * d2
function code(d1, d2, d3, d4) return Float64(d1 * d2) end
function tmp = code(d1, d2, d3, d4) tmp = d1 * d2; end
code[d1_, d2_, d3_, d4_] := N[(d1 * d2), $MachinePrecision]
\begin{array}{l}
\\
d1 \cdot d2
\end{array}
Initial program 86.3%
associate--l+86.3%
distribute-lft-out--86.7%
distribute-rgt-out--89.4%
distribute-lft-out100.0%
Simplified100.0%
Taylor expanded in d2 around inf 31.9%
(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 2024107
(FPCore (d1 d2 d3 d4)
:name "FastMath dist4"
:precision binary64
:alt
(* d1 (- (+ (- d2 d3) d4) d1))
(- (+ (- (* d1 d2) (* d1 d3)) (* d4 d1)) (* d1 d1)))