
(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 13 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--87.9%
distribute-rgt-out--91.4%
distribute-lft-out100.0%
Simplified100.0%
Final simplification100.0%
(FPCore (d1 d2 d3 d4)
:precision binary64
(let* ((t_0 (* d1 (- d2 d3))) (t_1 (* d1 (- d4 d1))))
(if (<= d2 -9.8e+61)
t_0
(if (<= d2 -2700000.0)
t_1
(if (<= d2 -7.2e-54)
t_0
(if (or (<= d2 -1.7e-144) (not (<= d2 -1.35e-167)))
t_1
(* d1 (- d3))))))))
double code(double d1, double d2, double d3, double d4) {
double t_0 = d1 * (d2 - d3);
double t_1 = d1 * (d4 - d1);
double tmp;
if (d2 <= -9.8e+61) {
tmp = t_0;
} else if (d2 <= -2700000.0) {
tmp = t_1;
} else if (d2 <= -7.2e-54) {
tmp = t_0;
} else if ((d2 <= -1.7e-144) || !(d2 <= -1.35e-167)) {
tmp = t_1;
} else {
tmp = d1 * -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) :: t_1
real(8) :: tmp
t_0 = d1 * (d2 - d3)
t_1 = d1 * (d4 - d1)
if (d2 <= (-9.8d+61)) then
tmp = t_0
else if (d2 <= (-2700000.0d0)) then
tmp = t_1
else if (d2 <= (-7.2d-54)) then
tmp = t_0
else if ((d2 <= (-1.7d-144)) .or. (.not. (d2 <= (-1.35d-167)))) then
tmp = t_1
else
tmp = d1 * -d3
end if
code = tmp
end function
public static double code(double d1, double d2, double d3, double d4) {
double t_0 = d1 * (d2 - d3);
double t_1 = d1 * (d4 - d1);
double tmp;
if (d2 <= -9.8e+61) {
tmp = t_0;
} else if (d2 <= -2700000.0) {
tmp = t_1;
} else if (d2 <= -7.2e-54) {
tmp = t_0;
} else if ((d2 <= -1.7e-144) || !(d2 <= -1.35e-167)) {
tmp = t_1;
} else {
tmp = d1 * -d3;
}
return tmp;
}
def code(d1, d2, d3, d4): t_0 = d1 * (d2 - d3) t_1 = d1 * (d4 - d1) tmp = 0 if d2 <= -9.8e+61: tmp = t_0 elif d2 <= -2700000.0: tmp = t_1 elif d2 <= -7.2e-54: tmp = t_0 elif (d2 <= -1.7e-144) or not (d2 <= -1.35e-167): tmp = t_1 else: tmp = d1 * -d3 return tmp
function code(d1, d2, d3, d4) t_0 = Float64(d1 * Float64(d2 - d3)) t_1 = Float64(d1 * Float64(d4 - d1)) tmp = 0.0 if (d2 <= -9.8e+61) tmp = t_0; elseif (d2 <= -2700000.0) tmp = t_1; elseif (d2 <= -7.2e-54) tmp = t_0; elseif ((d2 <= -1.7e-144) || !(d2 <= -1.35e-167)) tmp = t_1; else tmp = Float64(d1 * Float64(-d3)); end return tmp end
function tmp_2 = code(d1, d2, d3, d4) t_0 = d1 * (d2 - d3); t_1 = d1 * (d4 - d1); tmp = 0.0; if (d2 <= -9.8e+61) tmp = t_0; elseif (d2 <= -2700000.0) tmp = t_1; elseif (d2 <= -7.2e-54) tmp = t_0; elseif ((d2 <= -1.7e-144) || ~((d2 <= -1.35e-167))) tmp = t_1; else tmp = d1 * -d3; end tmp_2 = tmp; end
code[d1_, d2_, d3_, d4_] := Block[{t$95$0 = N[(d1 * N[(d2 - d3), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$1 = N[(d1 * N[(d4 - d1), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[d2, -9.8e+61], t$95$0, If[LessEqual[d2, -2700000.0], t$95$1, If[LessEqual[d2, -7.2e-54], t$95$0, If[Or[LessEqual[d2, -1.7e-144], N[Not[LessEqual[d2, -1.35e-167]], $MachinePrecision]], t$95$1, N[(d1 * (-d3)), $MachinePrecision]]]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := d1 \cdot \left(d2 - d3\right)\\
t_1 := d1 \cdot \left(d4 - d1\right)\\
\mathbf{if}\;d2 \leq -9.8 \cdot 10^{+61}:\\
\;\;\;\;t\_0\\
\mathbf{elif}\;d2 \leq -2700000:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;d2 \leq -7.2 \cdot 10^{-54}:\\
\;\;\;\;t\_0\\
\mathbf{elif}\;d2 \leq -1.7 \cdot 10^{-144} \lor \neg \left(d2 \leq -1.35 \cdot 10^{-167}\right):\\
\;\;\;\;t\_1\\
\mathbf{else}:\\
\;\;\;\;d1 \cdot \left(-d3\right)\\
\end{array}
\end{array}
if d2 < -9.8000000000000005e61 or -2.7e6 < d2 < -7.19999999999999953e-54Initial program 84.4%
associate--l+84.4%
distribute-lft-out--86.2%
distribute-rgt-out--87.9%
distribute-lft-out99.9%
Simplified99.9%
Taylor expanded in d4 around 0 80.0%
+-commutative80.0%
associate--r+80.0%
Simplified80.0%
Taylor expanded in d1 around 0 73.2%
if -9.8000000000000005e61 < d2 < -2.7e6 or -7.19999999999999953e-54 < d2 < -1.70000000000000009e-144 or -1.35e-167 < d2 Initial program 86.9%
associate--l+86.9%
distribute-lft-out--88.4%
distribute-rgt-out--92.6%
distribute-lft-out100.0%
Simplified100.0%
+-commutative100.0%
distribute-lft-in92.6%
Applied egg-rr92.6%
Taylor expanded in d3 around 0 74.7%
Taylor expanded in d2 around 0 62.5%
if -1.70000000000000009e-144 < d2 < -1.35e-167Initial program 85.7%
associate--l+85.7%
distribute-lft-out--85.7%
distribute-rgt-out--85.7%
distribute-lft-out100.0%
Simplified100.0%
Taylor expanded in d3 around inf 81.4%
associate-*r*81.4%
neg-mul-181.4%
Simplified81.4%
Final simplification65.5%
(FPCore (d1 d2 d3 d4)
:precision binary64
(if (or (<= d3 -1.2e+206)
(and (not (<= d3 -5.5e+124))
(or (<= d3 -1.15e+118) (not (<= d3 1.55e+92)))))
(* d1 (- d3))
(* d1 (+ d2 d4))))
double code(double d1, double d2, double d3, double d4) {
double tmp;
if ((d3 <= -1.2e+206) || (!(d3 <= -5.5e+124) && ((d3 <= -1.15e+118) || !(d3 <= 1.55e+92)))) {
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.2d+206)) .or. (.not. (d3 <= (-5.5d+124))) .and. (d3 <= (-1.15d+118)) .or. (.not. (d3 <= 1.55d+92))) 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.2e+206) || (!(d3 <= -5.5e+124) && ((d3 <= -1.15e+118) || !(d3 <= 1.55e+92)))) {
tmp = d1 * -d3;
} else {
tmp = d1 * (d2 + d4);
}
return tmp;
}
def code(d1, d2, d3, d4): tmp = 0 if (d3 <= -1.2e+206) or (not (d3 <= -5.5e+124) and ((d3 <= -1.15e+118) or not (d3 <= 1.55e+92))): tmp = d1 * -d3 else: tmp = d1 * (d2 + d4) return tmp
function code(d1, d2, d3, d4) tmp = 0.0 if ((d3 <= -1.2e+206) || (!(d3 <= -5.5e+124) && ((d3 <= -1.15e+118) || !(d3 <= 1.55e+92)))) 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.2e+206) || (~((d3 <= -5.5e+124)) && ((d3 <= -1.15e+118) || ~((d3 <= 1.55e+92))))) tmp = d1 * -d3; else tmp = d1 * (d2 + d4); end tmp_2 = tmp; end
code[d1_, d2_, d3_, d4_] := If[Or[LessEqual[d3, -1.2e+206], And[N[Not[LessEqual[d3, -5.5e+124]], $MachinePrecision], Or[LessEqual[d3, -1.15e+118], N[Not[LessEqual[d3, 1.55e+92]], $MachinePrecision]]]], N[(d1 * (-d3)), $MachinePrecision], N[(d1 * N[(d2 + d4), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;d3 \leq -1.2 \cdot 10^{+206} \lor \neg \left(d3 \leq -5.5 \cdot 10^{+124}\right) \land \left(d3 \leq -1.15 \cdot 10^{+118} \lor \neg \left(d3 \leq 1.55 \cdot 10^{+92}\right)\right):\\
\;\;\;\;d1 \cdot \left(-d3\right)\\
\mathbf{else}:\\
\;\;\;\;d1 \cdot \left(d2 + d4\right)\\
\end{array}
\end{array}
if d3 < -1.2e206 or -5.49999999999999977e124 < d3 < -1.15000000000000008e118 or 1.5500000000000001e92 < d3 Initial program 83.8%
associate--l+83.8%
distribute-lft-out--88.2%
distribute-rgt-out--91.1%
distribute-lft-out99.9%
Simplified99.9%
Taylor expanded in d3 around inf 80.3%
associate-*r*80.3%
neg-mul-180.3%
Simplified80.3%
if -1.2e206 < d3 < -5.49999999999999977e124 or -1.15000000000000008e118 < d3 < 1.5500000000000001e92Initial program 87.2%
sub-neg87.2%
associate-+l+87.2%
*-commutative87.2%
+-commutative87.2%
*-commutative87.2%
sub-neg87.2%
+-commutative87.2%
associate--l+87.2%
distribute-lft-out--88.3%
fma-define92.5%
distribute-rgt-out--99.4%
Simplified99.4%
Taylor expanded in d3 around 0 89.3%
Taylor expanded in d1 around 0 72.5%
Final simplification74.6%
(FPCore (d1 d2 d3 d4)
:precision binary64
(if (<= d4 5.4e-157)
(* d1 (- d2 d3))
(if (<= d4 5.5e-34)
(* d1 (- d2 d1))
(if (or (<= d4 3.2e+109) (not (<= d4 1.85e+152)))
(* d1 (- d4 d3))
(* d1 (+ d2 d4))))))
double code(double d1, double d2, double d3, double d4) {
double tmp;
if (d4 <= 5.4e-157) {
tmp = d1 * (d2 - d3);
} else if (d4 <= 5.5e-34) {
tmp = d1 * (d2 - d1);
} else if ((d4 <= 3.2e+109) || !(d4 <= 1.85e+152)) {
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) :: tmp
if (d4 <= 5.4d-157) then
tmp = d1 * (d2 - d3)
else if (d4 <= 5.5d-34) then
tmp = d1 * (d2 - d1)
else if ((d4 <= 3.2d+109) .or. (.not. (d4 <= 1.85d+152))) 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 tmp;
if (d4 <= 5.4e-157) {
tmp = d1 * (d2 - d3);
} else if (d4 <= 5.5e-34) {
tmp = d1 * (d2 - d1);
} else if ((d4 <= 3.2e+109) || !(d4 <= 1.85e+152)) {
tmp = d1 * (d4 - d3);
} else {
tmp = d1 * (d2 + d4);
}
return tmp;
}
def code(d1, d2, d3, d4): tmp = 0 if d4 <= 5.4e-157: tmp = d1 * (d2 - d3) elif d4 <= 5.5e-34: tmp = d1 * (d2 - d1) elif (d4 <= 3.2e+109) or not (d4 <= 1.85e+152): tmp = d1 * (d4 - d3) else: tmp = d1 * (d2 + d4) return tmp
function code(d1, d2, d3, d4) tmp = 0.0 if (d4 <= 5.4e-157) tmp = Float64(d1 * Float64(d2 - d3)); elseif (d4 <= 5.5e-34) tmp = Float64(d1 * Float64(d2 - d1)); elseif ((d4 <= 3.2e+109) || !(d4 <= 1.85e+152)) 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) tmp = 0.0; if (d4 <= 5.4e-157) tmp = d1 * (d2 - d3); elseif (d4 <= 5.5e-34) tmp = d1 * (d2 - d1); elseif ((d4 <= 3.2e+109) || ~((d4 <= 1.85e+152))) tmp = d1 * (d4 - d3); else tmp = d1 * (d2 + d4); end tmp_2 = tmp; end
code[d1_, d2_, d3_, d4_] := If[LessEqual[d4, 5.4e-157], N[(d1 * N[(d2 - d3), $MachinePrecision]), $MachinePrecision], If[LessEqual[d4, 5.5e-34], N[(d1 * N[(d2 - d1), $MachinePrecision]), $MachinePrecision], If[Or[LessEqual[d4, 3.2e+109], N[Not[LessEqual[d4, 1.85e+152]], $MachinePrecision]], N[(d1 * N[(d4 - d3), $MachinePrecision]), $MachinePrecision], N[(d1 * N[(d2 + d4), $MachinePrecision]), $MachinePrecision]]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;d4 \leq 5.4 \cdot 10^{-157}:\\
\;\;\;\;d1 \cdot \left(d2 - d3\right)\\
\mathbf{elif}\;d4 \leq 5.5 \cdot 10^{-34}:\\
\;\;\;\;d1 \cdot \left(d2 - d1\right)\\
\mathbf{elif}\;d4 \leq 3.2 \cdot 10^{+109} \lor \neg \left(d4 \leq 1.85 \cdot 10^{+152}\right):\\
\;\;\;\;d1 \cdot \left(d4 - d3\right)\\
\mathbf{else}:\\
\;\;\;\;d1 \cdot \left(d2 + d4\right)\\
\end{array}
\end{array}
if d4 < 5.4e-157Initial program 87.7%
associate--l+87.7%
distribute-lft-out--89.7%
distribute-rgt-out--92.5%
distribute-lft-out99.9%
Simplified99.9%
Taylor expanded in d4 around 0 81.6%
+-commutative81.6%
associate--r+81.6%
Simplified81.6%
Taylor expanded in d1 around 0 60.7%
if 5.4e-157 < d4 < 5.50000000000000014e-34Initial program 79.2%
associate--l+79.2%
distribute-lft-out--79.2%
distribute-rgt-out--79.2%
distribute-lft-out99.9%
Simplified99.9%
Taylor expanded in d4 around 0 88.6%
+-commutative88.6%
associate--r+88.6%
Simplified88.6%
Taylor expanded in d3 around 0 65.5%
if 5.50000000000000014e-34 < d4 < 3.2000000000000001e109 or 1.84999999999999998e152 < d4 Initial program 83.6%
associate--l+83.6%
distribute-lft-out--84.9%
distribute-rgt-out--91.8%
distribute-lft-out100.0%
Simplified100.0%
Taylor expanded in d2 around 0 83.7%
+-commutative83.7%
associate--r+83.7%
Simplified83.7%
Taylor expanded in d1 around 0 73.1%
if 3.2000000000000001e109 < d4 < 1.84999999999999998e152Initial 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 91.9%
Taylor expanded in d1 around 0 91.9%
Final simplification66.2%
(FPCore (d1 d2 d3 d4)
:precision binary64
(if (<= d2 -7.6e+134)
(* d1 d2)
(if (or (<= d2 -7e-54) (and (not (<= d2 -3.4e-114)) (<= d2 -9.2e-169)))
(* d1 (- d3))
(* d1 d4))))
double code(double d1, double d2, double d3, double d4) {
double tmp;
if (d2 <= -7.6e+134) {
tmp = d1 * d2;
} else if ((d2 <= -7e-54) || (!(d2 <= -3.4e-114) && (d2 <= -9.2e-169))) {
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 (d2 <= (-7.6d+134)) then
tmp = d1 * d2
else if ((d2 <= (-7d-54)) .or. (.not. (d2 <= (-3.4d-114))) .and. (d2 <= (-9.2d-169))) 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 (d2 <= -7.6e+134) {
tmp = d1 * d2;
} else if ((d2 <= -7e-54) || (!(d2 <= -3.4e-114) && (d2 <= -9.2e-169))) {
tmp = d1 * -d3;
} else {
tmp = d1 * d4;
}
return tmp;
}
def code(d1, d2, d3, d4): tmp = 0 if d2 <= -7.6e+134: tmp = d1 * d2 elif (d2 <= -7e-54) or (not (d2 <= -3.4e-114) and (d2 <= -9.2e-169)): tmp = d1 * -d3 else: tmp = d1 * d4 return tmp
function code(d1, d2, d3, d4) tmp = 0.0 if (d2 <= -7.6e+134) tmp = Float64(d1 * d2); elseif ((d2 <= -7e-54) || (!(d2 <= -3.4e-114) && (d2 <= -9.2e-169))) 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 (d2 <= -7.6e+134) tmp = d1 * d2; elseif ((d2 <= -7e-54) || (~((d2 <= -3.4e-114)) && (d2 <= -9.2e-169))) tmp = d1 * -d3; else tmp = d1 * d4; end tmp_2 = tmp; end
code[d1_, d2_, d3_, d4_] := If[LessEqual[d2, -7.6e+134], N[(d1 * d2), $MachinePrecision], If[Or[LessEqual[d2, -7e-54], And[N[Not[LessEqual[d2, -3.4e-114]], $MachinePrecision], LessEqual[d2, -9.2e-169]]], N[(d1 * (-d3)), $MachinePrecision], N[(d1 * d4), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;d2 \leq -7.6 \cdot 10^{+134}:\\
\;\;\;\;d1 \cdot d2\\
\mathbf{elif}\;d2 \leq -7 \cdot 10^{-54} \lor \neg \left(d2 \leq -3.4 \cdot 10^{-114}\right) \land d2 \leq -9.2 \cdot 10^{-169}:\\
\;\;\;\;d1 \cdot \left(-d3\right)\\
\mathbf{else}:\\
\;\;\;\;d1 \cdot d4\\
\end{array}
\end{array}
if d2 < -7.59999999999999997e134Initial program 83.7%
associate--l+83.7%
distribute-lft-out--86.4%
distribute-rgt-out--86.4%
distribute-lft-out99.9%
Simplified99.9%
Taylor expanded in d2 around inf 73.3%
if -7.59999999999999997e134 < d2 < -6.99999999999999964e-54 or -3.39999999999999981e-114 < d2 < -9.2000000000000004e-169Initial program 86.3%
associate--l+86.3%
distribute-lft-out--88.6%
distribute-rgt-out--90.8%
distribute-lft-out99.9%
Simplified99.9%
Taylor expanded in d3 around inf 48.0%
associate-*r*48.0%
neg-mul-148.0%
Simplified48.0%
if -6.99999999999999964e-54 < d2 < -3.39999999999999981e-114 or -9.2000000000000004e-169 < d2 Initial program 86.8%
associate--l+86.8%
distribute-lft-out--88.0%
distribute-rgt-out--92.5%
distribute-lft-out100.0%
Simplified100.0%
Taylor expanded in d4 around inf 37.9%
Final simplification44.7%
(FPCore (d1 d2 d3 d4)
:precision binary64
(let* ((t_0 (* d1 (- d2 d3))))
(if (<= d4 2.9e-158)
t_0
(if (<= d4 1.4e-35)
(* d1 (- d2 d1))
(if (<= d4 2.75e+85) t_0 (* d1 (+ d2 d4)))))))
double code(double d1, double d2, double d3, double d4) {
double t_0 = d1 * (d2 - d3);
double tmp;
if (d4 <= 2.9e-158) {
tmp = t_0;
} else if (d4 <= 1.4e-35) {
tmp = d1 * (d2 - d1);
} else if (d4 <= 2.75e+85) {
tmp = t_0;
} 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) :: tmp
t_0 = d1 * (d2 - d3)
if (d4 <= 2.9d-158) then
tmp = t_0
else if (d4 <= 1.4d-35) then
tmp = d1 * (d2 - d1)
else if (d4 <= 2.75d+85) then
tmp = t_0
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 - d3);
double tmp;
if (d4 <= 2.9e-158) {
tmp = t_0;
} else if (d4 <= 1.4e-35) {
tmp = d1 * (d2 - d1);
} else if (d4 <= 2.75e+85) {
tmp = t_0;
} else {
tmp = d1 * (d2 + d4);
}
return tmp;
}
def code(d1, d2, d3, d4): t_0 = d1 * (d2 - d3) tmp = 0 if d4 <= 2.9e-158: tmp = t_0 elif d4 <= 1.4e-35: tmp = d1 * (d2 - d1) elif d4 <= 2.75e+85: tmp = t_0 else: tmp = d1 * (d2 + d4) return tmp
function code(d1, d2, d3, d4) t_0 = Float64(d1 * Float64(d2 - d3)) tmp = 0.0 if (d4 <= 2.9e-158) tmp = t_0; elseif (d4 <= 1.4e-35) tmp = Float64(d1 * Float64(d2 - d1)); elseif (d4 <= 2.75e+85) tmp = t_0; else tmp = Float64(d1 * Float64(d2 + d4)); end return tmp end
function tmp_2 = code(d1, d2, d3, d4) t_0 = d1 * (d2 - d3); tmp = 0.0; if (d4 <= 2.9e-158) tmp = t_0; elseif (d4 <= 1.4e-35) tmp = d1 * (d2 - d1); elseif (d4 <= 2.75e+85) tmp = t_0; else tmp = d1 * (d2 + d4); end tmp_2 = tmp; end
code[d1_, d2_, d3_, d4_] := Block[{t$95$0 = N[(d1 * N[(d2 - d3), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[d4, 2.9e-158], t$95$0, If[LessEqual[d4, 1.4e-35], N[(d1 * N[(d2 - d1), $MachinePrecision]), $MachinePrecision], If[LessEqual[d4, 2.75e+85], t$95$0, N[(d1 * N[(d2 + d4), $MachinePrecision]), $MachinePrecision]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := d1 \cdot \left(d2 - d3\right)\\
\mathbf{if}\;d4 \leq 2.9 \cdot 10^{-158}:\\
\;\;\;\;t\_0\\
\mathbf{elif}\;d4 \leq 1.4 \cdot 10^{-35}:\\
\;\;\;\;d1 \cdot \left(d2 - d1\right)\\
\mathbf{elif}\;d4 \leq 2.75 \cdot 10^{+85}:\\
\;\;\;\;t\_0\\
\mathbf{else}:\\
\;\;\;\;d1 \cdot \left(d2 + d4\right)\\
\end{array}
\end{array}
if d4 < 2.8999999999999998e-158 or 1.4e-35 < d4 < 2.75000000000000004e85Initial program 86.9%
associate--l+86.9%
distribute-lft-out--88.6%
distribute-rgt-out--91.6%
distribute-lft-out100.0%
Simplified100.0%
Taylor expanded in d4 around 0 82.6%
+-commutative82.6%
associate--r+82.6%
Simplified82.6%
Taylor expanded in d1 around 0 61.3%
if 2.8999999999999998e-158 < d4 < 1.4e-35Initial program 79.2%
associate--l+79.2%
distribute-lft-out--79.2%
distribute-rgt-out--79.2%
distribute-lft-out99.9%
Simplified99.9%
Taylor expanded in d4 around 0 88.6%
+-commutative88.6%
associate--r+88.6%
Simplified88.6%
Taylor expanded in d3 around 0 65.5%
if 2.75000000000000004e85 < d4 Initial program 87.5%
sub-neg87.5%
associate-+l+87.5%
*-commutative87.5%
+-commutative87.5%
*-commutative87.5%
sub-neg87.5%
+-commutative87.5%
associate--l+87.5%
distribute-lft-out--90.6%
fma-define93.7%
distribute-rgt-out--96.9%
Simplified96.9%
Taylor expanded in d3 around 0 87.4%
Taylor expanded in d1 around 0 87.4%
Final simplification68.3%
(FPCore (d1 d2 d3 d4) :precision binary64 (if (<= d3 -7.5e+117) (* d1 (- d2 d3)) (if (<= d3 2.2e+98) (* d1 (- (+ d2 d4) d1)) (* d1 (- d4 d3)))))
double code(double d1, double d2, double d3, double d4) {
double tmp;
if (d3 <= -7.5e+117) {
tmp = d1 * (d2 - d3);
} else if (d3 <= 2.2e+98) {
tmp = d1 * ((d2 + d4) - 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 (d3 <= (-7.5d+117)) then
tmp = d1 * (d2 - d3)
else if (d3 <= 2.2d+98) then
tmp = d1 * ((d2 + d4) - 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 (d3 <= -7.5e+117) {
tmp = d1 * (d2 - d3);
} else if (d3 <= 2.2e+98) {
tmp = d1 * ((d2 + d4) - d1);
} else {
tmp = d1 * (d4 - d3);
}
return tmp;
}
def code(d1, d2, d3, d4): tmp = 0 if d3 <= -7.5e+117: tmp = d1 * (d2 - d3) elif d3 <= 2.2e+98: tmp = d1 * ((d2 + d4) - d1) else: tmp = d1 * (d4 - d3) return tmp
function code(d1, d2, d3, d4) tmp = 0.0 if (d3 <= -7.5e+117) tmp = Float64(d1 * Float64(d2 - d3)); elseif (d3 <= 2.2e+98) tmp = Float64(d1 * Float64(Float64(d2 + d4) - d1)); else tmp = Float64(d1 * Float64(d4 - d3)); end return tmp end
function tmp_2 = code(d1, d2, d3, d4) tmp = 0.0; if (d3 <= -7.5e+117) tmp = d1 * (d2 - d3); elseif (d3 <= 2.2e+98) tmp = d1 * ((d2 + d4) - d1); else tmp = d1 * (d4 - d3); end tmp_2 = tmp; end
code[d1_, d2_, d3_, d4_] := If[LessEqual[d3, -7.5e+117], N[(d1 * N[(d2 - d3), $MachinePrecision]), $MachinePrecision], If[LessEqual[d3, 2.2e+98], N[(d1 * N[(N[(d2 + d4), $MachinePrecision] - d1), $MachinePrecision]), $MachinePrecision], N[(d1 * N[(d4 - d3), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;d3 \leq -7.5 \cdot 10^{+117}:\\
\;\;\;\;d1 \cdot \left(d2 - d3\right)\\
\mathbf{elif}\;d3 \leq 2.2 \cdot 10^{+98}:\\
\;\;\;\;d1 \cdot \left(\left(d2 + d4\right) - d1\right)\\
\mathbf{else}:\\
\;\;\;\;d1 \cdot \left(d4 - d3\right)\\
\end{array}
\end{array}
if d3 < -7.5e117Initial program 81.0%
associate--l+81.0%
distribute-lft-out--86.4%
distribute-rgt-out--89.1%
distribute-lft-out99.9%
Simplified99.9%
Taylor expanded in d4 around 0 81.6%
+-commutative81.6%
associate--r+81.6%
Simplified81.6%
Taylor expanded in d1 around 0 76.0%
if -7.5e117 < d3 < 2.20000000000000009e98Initial program 86.5%
associate--l+86.5%
distribute-lft-out--87.1%
distribute-rgt-out--91.0%
distribute-lft-out100.0%
Simplified100.0%
Taylor expanded in d3 around 0 94.8%
if 2.20000000000000009e98 < d3 Initial program 90.2%
associate--l+90.2%
distribute-lft-out--92.6%
distribute-rgt-out--95.1%
distribute-lft-out99.9%
Simplified99.9%
Taylor expanded in d2 around 0 89.5%
+-commutative89.5%
associate--r+89.5%
Simplified89.5%
Taylor expanded in d1 around 0 87.4%
Final simplification90.9%
(FPCore (d1 d2 d3 d4) :precision binary64 (if (<= d3 -2.35e+117) (* d1 (- (- d2 d3) d1)) (if (<= d3 2.05e+95) (* d1 (- (+ d2 d4) d1)) (* d1 (- d4 d3)))))
double code(double d1, double d2, double d3, double d4) {
double tmp;
if (d3 <= -2.35e+117) {
tmp = d1 * ((d2 - d3) - d1);
} else if (d3 <= 2.05e+95) {
tmp = d1 * ((d2 + d4) - 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 (d3 <= (-2.35d+117)) then
tmp = d1 * ((d2 - d3) - d1)
else if (d3 <= 2.05d+95) then
tmp = d1 * ((d2 + d4) - 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 (d3 <= -2.35e+117) {
tmp = d1 * ((d2 - d3) - d1);
} else if (d3 <= 2.05e+95) {
tmp = d1 * ((d2 + d4) - d1);
} else {
tmp = d1 * (d4 - d3);
}
return tmp;
}
def code(d1, d2, d3, d4): tmp = 0 if d3 <= -2.35e+117: tmp = d1 * ((d2 - d3) - d1) elif d3 <= 2.05e+95: tmp = d1 * ((d2 + d4) - d1) else: tmp = d1 * (d4 - d3) return tmp
function code(d1, d2, d3, d4) tmp = 0.0 if (d3 <= -2.35e+117) tmp = Float64(d1 * Float64(Float64(d2 - d3) - d1)); elseif (d3 <= 2.05e+95) tmp = Float64(d1 * Float64(Float64(d2 + d4) - d1)); else tmp = Float64(d1 * Float64(d4 - d3)); end return tmp end
function tmp_2 = code(d1, d2, d3, d4) tmp = 0.0; if (d3 <= -2.35e+117) tmp = d1 * ((d2 - d3) - d1); elseif (d3 <= 2.05e+95) tmp = d1 * ((d2 + d4) - d1); else tmp = d1 * (d4 - d3); end tmp_2 = tmp; end
code[d1_, d2_, d3_, d4_] := If[LessEqual[d3, -2.35e+117], N[(d1 * N[(N[(d2 - d3), $MachinePrecision] - d1), $MachinePrecision]), $MachinePrecision], If[LessEqual[d3, 2.05e+95], N[(d1 * N[(N[(d2 + d4), $MachinePrecision] - d1), $MachinePrecision]), $MachinePrecision], N[(d1 * N[(d4 - d3), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;d3 \leq -2.35 \cdot 10^{+117}:\\
\;\;\;\;d1 \cdot \left(\left(d2 - d3\right) - d1\right)\\
\mathbf{elif}\;d3 \leq 2.05 \cdot 10^{+95}:\\
\;\;\;\;d1 \cdot \left(\left(d2 + d4\right) - d1\right)\\
\mathbf{else}:\\
\;\;\;\;d1 \cdot \left(d4 - d3\right)\\
\end{array}
\end{array}
if d3 < -2.35000000000000003e117Initial program 81.0%
associate--l+81.0%
distribute-lft-out--86.4%
distribute-rgt-out--89.1%
distribute-lft-out99.9%
Simplified99.9%
Taylor expanded in d4 around 0 81.6%
+-commutative81.6%
associate--r+81.6%
Simplified81.6%
if -2.35000000000000003e117 < d3 < 2.04999999999999993e95Initial program 86.5%
associate--l+86.5%
distribute-lft-out--87.1%
distribute-rgt-out--91.0%
distribute-lft-out100.0%
Simplified100.0%
Taylor expanded in d3 around 0 94.8%
if 2.04999999999999993e95 < d3 Initial program 90.2%
associate--l+90.2%
distribute-lft-out--92.6%
distribute-rgt-out--95.1%
distribute-lft-out99.9%
Simplified99.9%
Taylor expanded in d2 around 0 89.5%
+-commutative89.5%
associate--r+89.5%
Simplified89.5%
Taylor expanded in d1 around 0 87.4%
Final simplification91.7%
(FPCore (d1 d2 d3 d4) :precision binary64 (if (<= d3 -6.2e+118) (* d1 (- (- d2 d3) d1)) (if (<= d3 2.06e+55) (* d1 (- (+ d2 d4) d1)) (* d1 (- (- d4 d3) d1)))))
double code(double d1, double d2, double d3, double d4) {
double tmp;
if (d3 <= -6.2e+118) {
tmp = d1 * ((d2 - d3) - d1);
} else if (d3 <= 2.06e+55) {
tmp = d1 * ((d2 + d4) - 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 (d3 <= (-6.2d+118)) then
tmp = d1 * ((d2 - d3) - d1)
else if (d3 <= 2.06d+55) then
tmp = d1 * ((d2 + d4) - 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 (d3 <= -6.2e+118) {
tmp = d1 * ((d2 - d3) - d1);
} else if (d3 <= 2.06e+55) {
tmp = d1 * ((d2 + d4) - d1);
} else {
tmp = d1 * ((d4 - d3) - d1);
}
return tmp;
}
def code(d1, d2, d3, d4): tmp = 0 if d3 <= -6.2e+118: tmp = d1 * ((d2 - d3) - d1) elif d3 <= 2.06e+55: tmp = d1 * ((d2 + d4) - d1) else: tmp = d1 * ((d4 - d3) - d1) return tmp
function code(d1, d2, d3, d4) tmp = 0.0 if (d3 <= -6.2e+118) tmp = Float64(d1 * Float64(Float64(d2 - d3) - d1)); elseif (d3 <= 2.06e+55) tmp = Float64(d1 * Float64(Float64(d2 + d4) - 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 (d3 <= -6.2e+118) tmp = d1 * ((d2 - d3) - d1); elseif (d3 <= 2.06e+55) tmp = d1 * ((d2 + d4) - d1); else tmp = d1 * ((d4 - d3) - d1); end tmp_2 = tmp; end
code[d1_, d2_, d3_, d4_] := If[LessEqual[d3, -6.2e+118], N[(d1 * N[(N[(d2 - d3), $MachinePrecision] - d1), $MachinePrecision]), $MachinePrecision], If[LessEqual[d3, 2.06e+55], N[(d1 * N[(N[(d2 + d4), $MachinePrecision] - d1), $MachinePrecision]), $MachinePrecision], N[(d1 * N[(N[(d4 - d3), $MachinePrecision] - d1), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;d3 \leq -6.2 \cdot 10^{+118}:\\
\;\;\;\;d1 \cdot \left(\left(d2 - d3\right) - d1\right)\\
\mathbf{elif}\;d3 \leq 2.06 \cdot 10^{+55}:\\
\;\;\;\;d1 \cdot \left(\left(d2 + d4\right) - d1\right)\\
\mathbf{else}:\\
\;\;\;\;d1 \cdot \left(\left(d4 - d3\right) - d1\right)\\
\end{array}
\end{array}
if d3 < -6.19999999999999973e118Initial program 81.0%
associate--l+81.0%
distribute-lft-out--86.4%
distribute-rgt-out--89.1%
distribute-lft-out99.9%
Simplified99.9%
Taylor expanded in d4 around 0 81.6%
+-commutative81.6%
associate--r+81.6%
Simplified81.6%
if -6.19999999999999973e118 < d3 < 2.06e55Initial program 87.5%
associate--l+87.5%
distribute-lft-out--87.5%
distribute-rgt-out--91.0%
distribute-lft-out100.0%
Simplified100.0%
Taylor expanded in d3 around 0 95.6%
if 2.06e55 < d3 Initial program 86.2%
associate--l+86.2%
distribute-lft-out--90.2%
distribute-rgt-out--94.1%
distribute-lft-out99.9%
Simplified99.9%
Taylor expanded in d2 around 0 87.7%
+-commutative87.7%
associate--r+87.7%
Simplified87.7%
Final simplification92.0%
(FPCore (d1 d2 d3 d4) :precision binary64 (if (<= d4 2.45e-142) (* d1 (- d2 d3)) (if (<= d4 4.5e+60) (* d1 (- (- d3) d1)) (* d1 (- d4 d3)))))
double code(double d1, double d2, double d3, double d4) {
double tmp;
if (d4 <= 2.45e-142) {
tmp = d1 * (d2 - d3);
} else if (d4 <= 4.5e+60) {
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 (d4 <= 2.45d-142) then
tmp = d1 * (d2 - d3)
else if (d4 <= 4.5d+60) 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 (d4 <= 2.45e-142) {
tmp = d1 * (d2 - d3);
} else if (d4 <= 4.5e+60) {
tmp = d1 * (-d3 - d1);
} else {
tmp = d1 * (d4 - d3);
}
return tmp;
}
def code(d1, d2, d3, d4): tmp = 0 if d4 <= 2.45e-142: tmp = d1 * (d2 - d3) elif d4 <= 4.5e+60: tmp = d1 * (-d3 - d1) else: tmp = d1 * (d4 - d3) return tmp
function code(d1, d2, d3, d4) tmp = 0.0 if (d4 <= 2.45e-142) tmp = Float64(d1 * Float64(d2 - d3)); elseif (d4 <= 4.5e+60) tmp = Float64(d1 * Float64(Float64(-d3) - d1)); else tmp = Float64(d1 * Float64(d4 - d3)); end return tmp end
function tmp_2 = code(d1, d2, d3, d4) tmp = 0.0; if (d4 <= 2.45e-142) tmp = d1 * (d2 - d3); elseif (d4 <= 4.5e+60) tmp = d1 * (-d3 - d1); else tmp = d1 * (d4 - d3); end tmp_2 = tmp; end
code[d1_, d2_, d3_, d4_] := If[LessEqual[d4, 2.45e-142], N[(d1 * N[(d2 - d3), $MachinePrecision]), $MachinePrecision], If[LessEqual[d4, 4.5e+60], N[(d1 * N[((-d3) - d1), $MachinePrecision]), $MachinePrecision], N[(d1 * N[(d4 - d3), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;d4 \leq 2.45 \cdot 10^{-142}:\\
\;\;\;\;d1 \cdot \left(d2 - d3\right)\\
\mathbf{elif}\;d4 \leq 4.5 \cdot 10^{+60}:\\
\;\;\;\;d1 \cdot \left(\left(-d3\right) - d1\right)\\
\mathbf{else}:\\
\;\;\;\;d1 \cdot \left(d4 - d3\right)\\
\end{array}
\end{array}
if d4 < 2.4500000000000002e-142Initial program 86.7%
associate--l+86.7%
distribute-lft-out--88.7%
distribute-rgt-out--91.3%
distribute-lft-out99.9%
Simplified99.9%
Taylor expanded in d4 around 0 82.1%
+-commutative82.1%
associate--r+82.1%
Simplified82.1%
Taylor expanded in d1 around 0 61.1%
if 2.4500000000000002e-142 < d4 < 4.50000000000000013e60Initial program 82.4%
associate--l+82.4%
distribute-lft-out--82.4%
distribute-rgt-out--85.3%
distribute-lft-out100.0%
Simplified100.0%
Taylor expanded in d4 around 0 86.3%
+-commutative86.3%
associate--r+86.3%
Simplified86.3%
Taylor expanded in d2 around 0 61.9%
associate-*r*61.9%
neg-mul-161.9%
Simplified61.9%
if 4.50000000000000013e60 < d4 Initial program 87.3%
associate--l+87.3%
distribute-lft-out--88.7%
distribute-rgt-out--94.4%
distribute-lft-out100.0%
Simplified100.0%
Taylor expanded in d2 around 0 79.9%
+-commutative79.9%
associate--r+79.9%
Simplified79.9%
Taylor expanded in d1 around 0 74.5%
Final simplification64.9%
(FPCore (d1 d2 d3 d4) :precision binary64 (if (<= d4 1.26e+85) (* d1 (- d2 d1)) (* d1 (+ d2 d4))))
double code(double d1, double d2, double d3, double d4) {
double tmp;
if (d4 <= 1.26e+85) {
tmp = d1 * (d2 - 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 (d4 <= 1.26d+85) then
tmp = d1 * (d2 - 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 (d4 <= 1.26e+85) {
tmp = d1 * (d2 - d1);
} else {
tmp = d1 * (d2 + d4);
}
return tmp;
}
def code(d1, d2, d3, d4): tmp = 0 if d4 <= 1.26e+85: tmp = d1 * (d2 - d1) else: tmp = d1 * (d2 + d4) return tmp
function code(d1, d2, d3, d4) tmp = 0.0 if (d4 <= 1.26e+85) tmp = Float64(d1 * Float64(d2 - d1)); else tmp = Float64(d1 * Float64(d2 + d4)); end return tmp end
function tmp_2 = code(d1, d2, d3, d4) tmp = 0.0; if (d4 <= 1.26e+85) tmp = d1 * (d2 - d1); else tmp = d1 * (d2 + d4); end tmp_2 = tmp; end
code[d1_, d2_, d3_, d4_] := If[LessEqual[d4, 1.26e+85], N[(d1 * N[(d2 - d1), $MachinePrecision]), $MachinePrecision], N[(d1 * N[(d2 + d4), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;d4 \leq 1.26 \cdot 10^{+85}:\\
\;\;\;\;d1 \cdot \left(d2 - d1\right)\\
\mathbf{else}:\\
\;\;\;\;d1 \cdot \left(d2 + d4\right)\\
\end{array}
\end{array}
if d4 < 1.26000000000000003e85Initial program 85.9%
associate--l+85.9%
distribute-lft-out--87.5%
distribute-rgt-out--90.1%
distribute-lft-out100.0%
Simplified100.0%
Taylor expanded in d4 around 0 83.3%
+-commutative83.3%
associate--r+83.3%
Simplified83.3%
Taylor expanded in d3 around 0 58.7%
if 1.26000000000000003e85 < d4 Initial program 87.5%
sub-neg87.5%
associate-+l+87.5%
*-commutative87.5%
+-commutative87.5%
*-commutative87.5%
sub-neg87.5%
+-commutative87.5%
associate--l+87.5%
distribute-lft-out--90.6%
fma-define93.7%
distribute-rgt-out--96.9%
Simplified96.9%
Taylor expanded in d3 around 0 87.4%
Taylor expanded in d1 around 0 87.4%
Final simplification65.9%
(FPCore (d1 d2 d3 d4) :precision binary64 (if (<= d2 -1e+51) (* d1 d2) (* d1 d4)))
double code(double d1, double d2, double d3, double d4) {
double tmp;
if (d2 <= -1e+51) {
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 <= (-1d+51)) 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 <= -1e+51) {
tmp = d1 * d2;
} else {
tmp = d1 * d4;
}
return tmp;
}
def code(d1, d2, d3, d4): tmp = 0 if d2 <= -1e+51: tmp = d1 * d2 else: tmp = d1 * d4 return tmp
function code(d1, d2, d3, d4) tmp = 0.0 if (d2 <= -1e+51) 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 <= -1e+51) tmp = d1 * d2; else tmp = d1 * d4; end tmp_2 = tmp; end
code[d1_, d2_, d3_, d4_] := If[LessEqual[d2, -1e+51], N[(d1 * d2), $MachinePrecision], N[(d1 * d4), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;d2 \leq -1 \cdot 10^{+51}:\\
\;\;\;\;d1 \cdot d2\\
\mathbf{else}:\\
\;\;\;\;d1 \cdot d4\\
\end{array}
\end{array}
if d2 < -1e51Initial program 86.9%
associate--l+86.9%
distribute-lft-out--89.0%
distribute-rgt-out--89.0%
distribute-lft-out99.9%
Simplified99.9%
Taylor expanded in d2 around inf 65.4%
if -1e51 < d2 Initial program 86.2%
associate--l+86.2%
distribute-lft-out--87.6%
distribute-rgt-out--91.9%
distribute-lft-out100.0%
Simplified100.0%
Taylor expanded in d4 around inf 37.6%
Final simplification42.6%
(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--87.9%
distribute-rgt-out--91.4%
distribute-lft-out100.0%
Simplified100.0%
Taylor expanded in d2 around inf 31.0%
Final simplification31.0%
(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 2024044
(FPCore (d1 d2 d3 d4)
:name "FastMath dist4"
:precision binary64
:alt
(* d1 (- (+ (- d2 d3) d4) d1))
(- (+ (- (* d1 d2) (* d1 d3)) (* d4 d1)) (* d1 d1)))