
(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 90.2%
associate--l+90.2%
distribute-lft-out--90.2%
distribute-rgt-out--92.6%
distribute-lft-out100.0%
Simplified100.0%
(FPCore (d1 d2 d3 d4)
:precision binary64
(let* ((t_0 (* d1 (- d2 d3))))
(if (<= d4 1.95e-272)
t_0
(if (<= d4 3.7e+16)
(* d1 (- (- d1) d3))
(if (<= d4 3.1e+60)
(* d1 (- d4 d1))
(if (<= d4 5.3e+113) 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 <= 1.95e-272) {
tmp = t_0;
} else if (d4 <= 3.7e+16) {
tmp = d1 * (-d1 - d3);
} else if (d4 <= 3.1e+60) {
tmp = d1 * (d4 - d1);
} else if (d4 <= 5.3e+113) {
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 <= 1.95d-272) then
tmp = t_0
else if (d4 <= 3.7d+16) then
tmp = d1 * (-d1 - d3)
else if (d4 <= 3.1d+60) then
tmp = d1 * (d4 - d1)
else if (d4 <= 5.3d+113) 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 <= 1.95e-272) {
tmp = t_0;
} else if (d4 <= 3.7e+16) {
tmp = d1 * (-d1 - d3);
} else if (d4 <= 3.1e+60) {
tmp = d1 * (d4 - d1);
} else if (d4 <= 5.3e+113) {
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 <= 1.95e-272: tmp = t_0 elif d4 <= 3.7e+16: tmp = d1 * (-d1 - d3) elif d4 <= 3.1e+60: tmp = d1 * (d4 - d1) elif d4 <= 5.3e+113: 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 <= 1.95e-272) tmp = t_0; elseif (d4 <= 3.7e+16) tmp = Float64(d1 * Float64(Float64(-d1) - d3)); elseif (d4 <= 3.1e+60) tmp = Float64(d1 * Float64(d4 - d1)); elseif (d4 <= 5.3e+113) 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 <= 1.95e-272) tmp = t_0; elseif (d4 <= 3.7e+16) tmp = d1 * (-d1 - d3); elseif (d4 <= 3.1e+60) tmp = d1 * (d4 - d1); elseif (d4 <= 5.3e+113) 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, 1.95e-272], t$95$0, If[LessEqual[d4, 3.7e+16], N[(d1 * N[((-d1) - d3), $MachinePrecision]), $MachinePrecision], If[LessEqual[d4, 3.1e+60], N[(d1 * N[(d4 - d1), $MachinePrecision]), $MachinePrecision], If[LessEqual[d4, 5.3e+113], 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 1.95 \cdot 10^{-272}:\\
\;\;\;\;t\_0\\
\mathbf{elif}\;d4 \leq 3.7 \cdot 10^{+16}:\\
\;\;\;\;d1 \cdot \left(\left(-d1\right) - d3\right)\\
\mathbf{elif}\;d4 \leq 3.1 \cdot 10^{+60}:\\
\;\;\;\;d1 \cdot \left(d4 - d1\right)\\
\mathbf{elif}\;d4 \leq 5.3 \cdot 10^{+113}:\\
\;\;\;\;t\_0\\
\mathbf{else}:\\
\;\;\;\;d1 \cdot \left(d2 + d4\right)\\
\end{array}
\end{array}
if d4 < 1.9499999999999999e-272 or 3.1000000000000001e60 < d4 < 5.29999999999999967e113Initial program 89.7%
associate--l+89.7%
distribute-lft-out--89.7%
distribute-rgt-out--91.7%
distribute-lft-out100.0%
Simplified100.0%
Taylor expanded in d1 around 0 83.7%
Taylor expanded in d4 around 0 61.7%
if 1.9499999999999999e-272 < d4 < 3.7e16Initial program 92.3%
associate--l+92.3%
distribute-lft-out--92.3%
distribute-rgt-out--92.3%
distribute-lft-out100.0%
Simplified100.0%
+-commutative100.0%
distribute-lft-in92.3%
Applied egg-rr92.3%
Taylor expanded in d2 around 0 70.3%
+-commutative70.3%
mul-1-neg70.3%
unsub-neg70.3%
distribute-lft-out--71.8%
Simplified71.8%
Taylor expanded in d4 around 0 70.4%
associate-*r*70.4%
mul-1-neg70.4%
Simplified70.4%
if 3.7e16 < d4 < 3.1000000000000001e60Initial program 100.0%
associate--l+100.0%
distribute-lft-out--100.0%
distribute-rgt-out--100.0%
distribute-lft-out100.0%
Simplified100.0%
+-commutative100.0%
distribute-lft-in100.0%
Applied egg-rr100.0%
Taylor expanded in d2 around 0 72.8%
+-commutative72.8%
mul-1-neg72.8%
unsub-neg72.8%
distribute-lft-out--72.8%
Simplified72.8%
Taylor expanded in d3 around 0 71.9%
if 5.29999999999999967e113 < d4 Initial program 85.7%
associate--l+85.7%
distribute-lft-out--85.7%
distribute-rgt-out--96.4%
distribute-lft-out100.0%
Simplified100.0%
Taylor expanded in d1 around 0 89.7%
Taylor expanded in d3 around 0 82.7%
+-commutative82.7%
Simplified82.7%
Final simplification66.5%
(FPCore (d1 d2 d3 d4)
:precision binary64
(let* ((t_0 (* d1 (- d3))) (t_1 (* d1 (+ d2 d4))))
(if (<= d3 -6.2e+153)
t_0
(if (<= d3 4.2e-86)
t_1
(if (<= d3 2.6e-39) (* d1 (- d1)) (if (<= d3 8.4e+129) t_1 t_0))))))
double code(double d1, double d2, double d3, double d4) {
double t_0 = d1 * -d3;
double t_1 = d1 * (d2 + d4);
double tmp;
if (d3 <= -6.2e+153) {
tmp = t_0;
} else if (d3 <= 4.2e-86) {
tmp = t_1;
} else if (d3 <= 2.6e-39) {
tmp = d1 * -d1;
} else if (d3 <= 8.4e+129) {
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 * -d3
t_1 = d1 * (d2 + d4)
if (d3 <= (-6.2d+153)) then
tmp = t_0
else if (d3 <= 4.2d-86) then
tmp = t_1
else if (d3 <= 2.6d-39) then
tmp = d1 * -d1
else if (d3 <= 8.4d+129) 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 * -d3;
double t_1 = d1 * (d2 + d4);
double tmp;
if (d3 <= -6.2e+153) {
tmp = t_0;
} else if (d3 <= 4.2e-86) {
tmp = t_1;
} else if (d3 <= 2.6e-39) {
tmp = d1 * -d1;
} else if (d3 <= 8.4e+129) {
tmp = t_1;
} else {
tmp = t_0;
}
return tmp;
}
def code(d1, d2, d3, d4): t_0 = d1 * -d3 t_1 = d1 * (d2 + d4) tmp = 0 if d3 <= -6.2e+153: tmp = t_0 elif d3 <= 4.2e-86: tmp = t_1 elif d3 <= 2.6e-39: tmp = d1 * -d1 elif d3 <= 8.4e+129: tmp = t_1 else: tmp = t_0 return tmp
function code(d1, d2, d3, d4) t_0 = Float64(d1 * Float64(-d3)) t_1 = Float64(d1 * Float64(d2 + d4)) tmp = 0.0 if (d3 <= -6.2e+153) tmp = t_0; elseif (d3 <= 4.2e-86) tmp = t_1; elseif (d3 <= 2.6e-39) tmp = Float64(d1 * Float64(-d1)); elseif (d3 <= 8.4e+129) tmp = t_1; else tmp = t_0; end return tmp end
function tmp_2 = code(d1, d2, d3, d4) t_0 = d1 * -d3; t_1 = d1 * (d2 + d4); tmp = 0.0; if (d3 <= -6.2e+153) tmp = t_0; elseif (d3 <= 4.2e-86) tmp = t_1; elseif (d3 <= 2.6e-39) tmp = d1 * -d1; elseif (d3 <= 8.4e+129) tmp = t_1; else tmp = t_0; end tmp_2 = tmp; end
code[d1_, d2_, d3_, d4_] := Block[{t$95$0 = N[(d1 * (-d3)), $MachinePrecision]}, Block[{t$95$1 = N[(d1 * N[(d2 + d4), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[d3, -6.2e+153], t$95$0, If[LessEqual[d3, 4.2e-86], t$95$1, If[LessEqual[d3, 2.6e-39], N[(d1 * (-d1)), $MachinePrecision], If[LessEqual[d3, 8.4e+129], t$95$1, t$95$0]]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := d1 \cdot \left(-d3\right)\\
t_1 := d1 \cdot \left(d2 + d4\right)\\
\mathbf{if}\;d3 \leq -6.2 \cdot 10^{+153}:\\
\;\;\;\;t\_0\\
\mathbf{elif}\;d3 \leq 4.2 \cdot 10^{-86}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;d3 \leq 2.6 \cdot 10^{-39}:\\
\;\;\;\;d1 \cdot \left(-d1\right)\\
\mathbf{elif}\;d3 \leq 8.4 \cdot 10^{+129}:\\
\;\;\;\;t\_1\\
\mathbf{else}:\\
\;\;\;\;t\_0\\
\end{array}
\end{array}
if d3 < -6.2e153 or 8.39999999999999986e129 < d3 Initial program 92.1%
associate--l+92.1%
distribute-lft-out--92.1%
distribute-rgt-out--92.1%
distribute-lft-out100.0%
Simplified100.0%
Taylor expanded in d3 around inf 86.1%
associate-*r*86.1%
neg-mul-186.1%
Simplified86.1%
if -6.2e153 < d3 < 4.2e-86 or 2.6e-39 < d3 < 8.39999999999999986e129Initial program 89.1%
associate--l+89.1%
distribute-lft-out--89.1%
distribute-rgt-out--92.4%
distribute-lft-out100.0%
Simplified100.0%
Taylor expanded in d1 around 0 75.6%
Taylor expanded in d3 around 0 71.5%
+-commutative71.5%
Simplified71.5%
if 4.2e-86 < d3 < 2.6e-39Initial program 100.0%
associate--l+100.0%
distribute-lft-out--100.0%
distribute-rgt-out--100.0%
distribute-lft-out100.0%
Simplified100.0%
Taylor expanded in d1 around inf 78.9%
neg-mul-178.9%
Simplified78.9%
Final simplification75.4%
(FPCore (d1 d2 d3 d4)
:precision binary64
(let* ((t_0 (* d1 (- d1))))
(if (<= d4 7.2e-273)
(* d1 d2)
(if (<= d4 6.7e-236)
t_0
(if (<= d4 2.35e-70)
(* d1 (- d3))
(if (<= d4 4.2e+28) t_0 (* d1 d4)))))))
double code(double d1, double d2, double d3, double d4) {
double t_0 = d1 * -d1;
double tmp;
if (d4 <= 7.2e-273) {
tmp = d1 * d2;
} else if (d4 <= 6.7e-236) {
tmp = t_0;
} else if (d4 <= 2.35e-70) {
tmp = d1 * -d3;
} else if (d4 <= 4.2e+28) {
tmp = t_0;
} 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) :: t_0
real(8) :: tmp
t_0 = d1 * -d1
if (d4 <= 7.2d-273) then
tmp = d1 * d2
else if (d4 <= 6.7d-236) then
tmp = t_0
else if (d4 <= 2.35d-70) then
tmp = d1 * -d3
else if (d4 <= 4.2d+28) then
tmp = t_0
else
tmp = d1 * d4
end if
code = tmp
end function
public static double code(double d1, double d2, double d3, double d4) {
double t_0 = d1 * -d1;
double tmp;
if (d4 <= 7.2e-273) {
tmp = d1 * d2;
} else if (d4 <= 6.7e-236) {
tmp = t_0;
} else if (d4 <= 2.35e-70) {
tmp = d1 * -d3;
} else if (d4 <= 4.2e+28) {
tmp = t_0;
} else {
tmp = d1 * d4;
}
return tmp;
}
def code(d1, d2, d3, d4): t_0 = d1 * -d1 tmp = 0 if d4 <= 7.2e-273: tmp = d1 * d2 elif d4 <= 6.7e-236: tmp = t_0 elif d4 <= 2.35e-70: tmp = d1 * -d3 elif d4 <= 4.2e+28: tmp = t_0 else: tmp = d1 * d4 return tmp
function code(d1, d2, d3, d4) t_0 = Float64(d1 * Float64(-d1)) tmp = 0.0 if (d4 <= 7.2e-273) tmp = Float64(d1 * d2); elseif (d4 <= 6.7e-236) tmp = t_0; elseif (d4 <= 2.35e-70) tmp = Float64(d1 * Float64(-d3)); elseif (d4 <= 4.2e+28) tmp = t_0; else tmp = Float64(d1 * d4); end return tmp end
function tmp_2 = code(d1, d2, d3, d4) t_0 = d1 * -d1; tmp = 0.0; if (d4 <= 7.2e-273) tmp = d1 * d2; elseif (d4 <= 6.7e-236) tmp = t_0; elseif (d4 <= 2.35e-70) tmp = d1 * -d3; elseif (d4 <= 4.2e+28) tmp = t_0; else tmp = d1 * d4; end tmp_2 = tmp; end
code[d1_, d2_, d3_, d4_] := Block[{t$95$0 = N[(d1 * (-d1)), $MachinePrecision]}, If[LessEqual[d4, 7.2e-273], N[(d1 * d2), $MachinePrecision], If[LessEqual[d4, 6.7e-236], t$95$0, If[LessEqual[d4, 2.35e-70], N[(d1 * (-d3)), $MachinePrecision], If[LessEqual[d4, 4.2e+28], t$95$0, N[(d1 * d4), $MachinePrecision]]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := d1 \cdot \left(-d1\right)\\
\mathbf{if}\;d4 \leq 7.2 \cdot 10^{-273}:\\
\;\;\;\;d1 \cdot d2\\
\mathbf{elif}\;d4 \leq 6.7 \cdot 10^{-236}:\\
\;\;\;\;t\_0\\
\mathbf{elif}\;d4 \leq 2.35 \cdot 10^{-70}:\\
\;\;\;\;d1 \cdot \left(-d3\right)\\
\mathbf{elif}\;d4 \leq 4.2 \cdot 10^{+28}:\\
\;\;\;\;t\_0\\
\mathbf{else}:\\
\;\;\;\;d1 \cdot d4\\
\end{array}
\end{array}
if d4 < 7.19999999999999986e-273Initial program 89.0%
associate--l+89.0%
distribute-lft-out--89.0%
distribute-rgt-out--91.1%
distribute-lft-out100.0%
Simplified100.0%
Taylor expanded in d2 around inf 33.7%
if 7.19999999999999986e-273 < d4 < 6.7000000000000003e-236 or 2.3499999999999999e-70 < d4 < 4.19999999999999978e28Initial program 91.2%
associate--l+91.2%
distribute-lft-out--91.2%
distribute-rgt-out--91.2%
distribute-lft-out100.0%
Simplified100.0%
Taylor expanded in d1 around inf 55.4%
neg-mul-155.4%
Simplified55.4%
if 6.7000000000000003e-236 < d4 < 2.3499999999999999e-70Initial program 94.1%
associate--l+94.1%
distribute-lft-out--94.1%
distribute-rgt-out--94.1%
distribute-lft-out100.0%
Simplified100.0%
Taylor expanded in d3 around inf 40.1%
associate-*r*40.1%
neg-mul-140.1%
Simplified40.1%
if 4.19999999999999978e28 < d4 Initial program 90.5%
associate--l+90.5%
distribute-lft-out--90.5%
distribute-rgt-out--97.6%
distribute-lft-out100.0%
Simplified100.0%
Taylor expanded in d4 around inf 53.9%
Final simplification40.7%
(FPCore (d1 d2 d3 d4)
:precision binary64
(if (<= d4 6e-274)
(* d1 d2)
(if (<= d4 3.3e+27)
(* d1 (- d1))
(if (or (<= d4 6.4e+63) (not (<= d4 1.26e+123))) (* d1 d4) (* d1 d2)))))
double code(double d1, double d2, double d3, double d4) {
double tmp;
if (d4 <= 6e-274) {
tmp = d1 * d2;
} else if (d4 <= 3.3e+27) {
tmp = d1 * -d1;
} else if ((d4 <= 6.4e+63) || !(d4 <= 1.26e+123)) {
tmp = d1 * d4;
} else {
tmp = d1 * d2;
}
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 <= 6d-274) then
tmp = d1 * d2
else if (d4 <= 3.3d+27) then
tmp = d1 * -d1
else if ((d4 <= 6.4d+63) .or. (.not. (d4 <= 1.26d+123))) then
tmp = d1 * d4
else
tmp = d1 * d2
end if
code = tmp
end function
public static double code(double d1, double d2, double d3, double d4) {
double tmp;
if (d4 <= 6e-274) {
tmp = d1 * d2;
} else if (d4 <= 3.3e+27) {
tmp = d1 * -d1;
} else if ((d4 <= 6.4e+63) || !(d4 <= 1.26e+123)) {
tmp = d1 * d4;
} else {
tmp = d1 * d2;
}
return tmp;
}
def code(d1, d2, d3, d4): tmp = 0 if d4 <= 6e-274: tmp = d1 * d2 elif d4 <= 3.3e+27: tmp = d1 * -d1 elif (d4 <= 6.4e+63) or not (d4 <= 1.26e+123): tmp = d1 * d4 else: tmp = d1 * d2 return tmp
function code(d1, d2, d3, d4) tmp = 0.0 if (d4 <= 6e-274) tmp = Float64(d1 * d2); elseif (d4 <= 3.3e+27) tmp = Float64(d1 * Float64(-d1)); elseif ((d4 <= 6.4e+63) || !(d4 <= 1.26e+123)) tmp = Float64(d1 * d4); else tmp = Float64(d1 * d2); end return tmp end
function tmp_2 = code(d1, d2, d3, d4) tmp = 0.0; if (d4 <= 6e-274) tmp = d1 * d2; elseif (d4 <= 3.3e+27) tmp = d1 * -d1; elseif ((d4 <= 6.4e+63) || ~((d4 <= 1.26e+123))) tmp = d1 * d4; else tmp = d1 * d2; end tmp_2 = tmp; end
code[d1_, d2_, d3_, d4_] := If[LessEqual[d4, 6e-274], N[(d1 * d2), $MachinePrecision], If[LessEqual[d4, 3.3e+27], N[(d1 * (-d1)), $MachinePrecision], If[Or[LessEqual[d4, 6.4e+63], N[Not[LessEqual[d4, 1.26e+123]], $MachinePrecision]], N[(d1 * d4), $MachinePrecision], N[(d1 * d2), $MachinePrecision]]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;d4 \leq 6 \cdot 10^{-274}:\\
\;\;\;\;d1 \cdot d2\\
\mathbf{elif}\;d4 \leq 3.3 \cdot 10^{+27}:\\
\;\;\;\;d1 \cdot \left(-d1\right)\\
\mathbf{elif}\;d4 \leq 6.4 \cdot 10^{+63} \lor \neg \left(d4 \leq 1.26 \cdot 10^{+123}\right):\\
\;\;\;\;d1 \cdot d4\\
\mathbf{else}:\\
\;\;\;\;d1 \cdot d2\\
\end{array}
\end{array}
if d4 < 5.99999999999999954e-274 or 6.40000000000000022e63 < d4 < 1.26e123Initial program 89.7%
associate--l+89.7%
distribute-lft-out--89.7%
distribute-rgt-out--91.7%
distribute-lft-out100.0%
Simplified100.0%
Taylor expanded in d2 around inf 34.2%
if 5.99999999999999954e-274 < d4 < 3.2999999999999998e27Initial program 92.6%
associate--l+92.6%
distribute-lft-out--92.6%
distribute-rgt-out--92.6%
distribute-lft-out100.0%
Simplified100.0%
Taylor expanded in d1 around inf 43.7%
neg-mul-143.7%
Simplified43.7%
if 3.2999999999999998e27 < d4 < 6.40000000000000022e63 or 1.26e123 < d4 Initial program 87.5%
associate--l+87.5%
distribute-lft-out--87.5%
distribute-rgt-out--96.9%
distribute-lft-out100.0%
Simplified100.0%
Taylor expanded in d4 around inf 67.0%
Final simplification40.8%
(FPCore (d1 d2 d3 d4)
:precision binary64
(let* ((t_0 (* d1 (- d2 d3))))
(if (<= d4 1.05e-69)
t_0
(if (<= d4 5.2e+64)
(* d1 (- d4 d1))
(if (<= d4 4e+116) 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 <= 1.05e-69) {
tmp = t_0;
} else if (d4 <= 5.2e+64) {
tmp = d1 * (d4 - d1);
} else if (d4 <= 4e+116) {
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 <= 1.05d-69) then
tmp = t_0
else if (d4 <= 5.2d+64) then
tmp = d1 * (d4 - d1)
else if (d4 <= 4d+116) 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 <= 1.05e-69) {
tmp = t_0;
} else if (d4 <= 5.2e+64) {
tmp = d1 * (d4 - d1);
} else if (d4 <= 4e+116) {
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 <= 1.05e-69: tmp = t_0 elif d4 <= 5.2e+64: tmp = d1 * (d4 - d1) elif d4 <= 4e+116: 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 <= 1.05e-69) tmp = t_0; elseif (d4 <= 5.2e+64) tmp = Float64(d1 * Float64(d4 - d1)); elseif (d4 <= 4e+116) 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 <= 1.05e-69) tmp = t_0; elseif (d4 <= 5.2e+64) tmp = d1 * (d4 - d1); elseif (d4 <= 4e+116) 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, 1.05e-69], t$95$0, If[LessEqual[d4, 5.2e+64], N[(d1 * N[(d4 - d1), $MachinePrecision]), $MachinePrecision], If[LessEqual[d4, 4e+116], 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 1.05 \cdot 10^{-69}:\\
\;\;\;\;t\_0\\
\mathbf{elif}\;d4 \leq 5.2 \cdot 10^{+64}:\\
\;\;\;\;d1 \cdot \left(d4 - d1\right)\\
\mathbf{elif}\;d4 \leq 4 \cdot 10^{+116}:\\
\;\;\;\;t\_0\\
\mathbf{else}:\\
\;\;\;\;d1 \cdot \left(d2 + d4\right)\\
\end{array}
\end{array}
if d4 < 1.05e-69 or 5.19999999999999994e64 < d4 < 4.00000000000000006e116Initial program 90.1%
associate--l+90.1%
distribute-lft-out--90.1%
distribute-rgt-out--91.6%
distribute-lft-out100.0%
Simplified100.0%
Taylor expanded in d1 around 0 80.1%
Taylor expanded in d4 around 0 63.1%
if 1.05e-69 < d4 < 5.19999999999999994e64Initial program 96.2%
associate--l+96.2%
distribute-lft-out--96.2%
distribute-rgt-out--96.2%
distribute-lft-out100.0%
Simplified100.0%
+-commutative100.0%
distribute-lft-in96.2%
Applied egg-rr96.2%
Taylor expanded in d2 around 0 77.9%
+-commutative77.9%
mul-1-neg77.9%
unsub-neg77.9%
distribute-lft-out--77.9%
Simplified77.9%
Taylor expanded in d3 around 0 62.7%
if 4.00000000000000006e116 < d4 Initial program 85.7%
associate--l+85.7%
distribute-lft-out--85.7%
distribute-rgt-out--96.4%
distribute-lft-out100.0%
Simplified100.0%
Taylor expanded in d1 around 0 89.7%
Taylor expanded in d3 around 0 82.7%
+-commutative82.7%
Simplified82.7%
Final simplification65.2%
(FPCore (d1 d2 d3 d4)
:precision binary64
(let* ((t_0 (* d1 (- d2 d3))))
(if (<= d4 1.1e-69)
t_0
(if (<= d4 8.5e+19)
(* d1 (- d1))
(if (<= d4 3.45e+115) 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 <= 1.1e-69) {
tmp = t_0;
} else if (d4 <= 8.5e+19) {
tmp = d1 * -d1;
} else if (d4 <= 3.45e+115) {
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 <= 1.1d-69) then
tmp = t_0
else if (d4 <= 8.5d+19) then
tmp = d1 * -d1
else if (d4 <= 3.45d+115) 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 <= 1.1e-69) {
tmp = t_0;
} else if (d4 <= 8.5e+19) {
tmp = d1 * -d1;
} else if (d4 <= 3.45e+115) {
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 <= 1.1e-69: tmp = t_0 elif d4 <= 8.5e+19: tmp = d1 * -d1 elif d4 <= 3.45e+115: 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 <= 1.1e-69) tmp = t_0; elseif (d4 <= 8.5e+19) tmp = Float64(d1 * Float64(-d1)); elseif (d4 <= 3.45e+115) 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 <= 1.1e-69) tmp = t_0; elseif (d4 <= 8.5e+19) tmp = d1 * -d1; elseif (d4 <= 3.45e+115) 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, 1.1e-69], t$95$0, If[LessEqual[d4, 8.5e+19], N[(d1 * (-d1)), $MachinePrecision], If[LessEqual[d4, 3.45e+115], 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 1.1 \cdot 10^{-69}:\\
\;\;\;\;t\_0\\
\mathbf{elif}\;d4 \leq 8.5 \cdot 10^{+19}:\\
\;\;\;\;d1 \cdot \left(-d1\right)\\
\mathbf{elif}\;d4 \leq 3.45 \cdot 10^{+115}:\\
\;\;\;\;t\_0\\
\mathbf{else}:\\
\;\;\;\;d1 \cdot \left(d2 + d4\right)\\
\end{array}
\end{array}
if d4 < 1.1e-69 or 8.5e19 < d4 < 3.44999999999999983e115Initial program 90.4%
associate--l+90.4%
distribute-lft-out--90.4%
distribute-rgt-out--91.8%
distribute-lft-out100.0%
Simplified100.0%
Taylor expanded in d1 around 0 80.7%
Taylor expanded in d4 around 0 62.8%
if 1.1e-69 < d4 < 8.5e19Initial program 95.0%
associate--l+95.0%
distribute-lft-out--95.0%
distribute-rgt-out--95.0%
distribute-lft-out100.0%
Simplified100.0%
Taylor expanded in d1 around inf 57.7%
neg-mul-157.7%
Simplified57.7%
if 3.44999999999999983e115 < d4 Initial program 85.7%
associate--l+85.7%
distribute-lft-out--85.7%
distribute-rgt-out--96.4%
distribute-lft-out100.0%
Simplified100.0%
Taylor expanded in d1 around 0 89.7%
Taylor expanded in d3 around 0 82.7%
+-commutative82.7%
Simplified82.7%
Final simplification64.6%
(FPCore (d1 d2 d3 d4) :precision binary64 (if (<= d2 -9.2e+110) (* d1 (- (+ d2 d4) d3)) (* d1 (- (- d4 d1) d3))))
double code(double d1, double d2, double d3, double d4) {
double tmp;
if (d2 <= -9.2e+110) {
tmp = d1 * ((d2 + d4) - d3);
} else {
tmp = d1 * ((d4 - 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) :: tmp
if (d2 <= (-9.2d+110)) then
tmp = d1 * ((d2 + d4) - d3)
else
tmp = d1 * ((d4 - d1) - d3)
end if
code = tmp
end function
public static double code(double d1, double d2, double d3, double d4) {
double tmp;
if (d2 <= -9.2e+110) {
tmp = d1 * ((d2 + d4) - d3);
} else {
tmp = d1 * ((d4 - d1) - d3);
}
return tmp;
}
def code(d1, d2, d3, d4): tmp = 0 if d2 <= -9.2e+110: tmp = d1 * ((d2 + d4) - d3) else: tmp = d1 * ((d4 - d1) - d3) return tmp
function code(d1, d2, d3, d4) tmp = 0.0 if (d2 <= -9.2e+110) tmp = Float64(d1 * Float64(Float64(d2 + d4) - d3)); else tmp = Float64(d1 * Float64(Float64(d4 - d1) - d3)); end return tmp end
function tmp_2 = code(d1, d2, d3, d4) tmp = 0.0; if (d2 <= -9.2e+110) tmp = d1 * ((d2 + d4) - d3); else tmp = d1 * ((d4 - d1) - d3); end tmp_2 = tmp; end
code[d1_, d2_, d3_, d4_] := If[LessEqual[d2, -9.2e+110], N[(d1 * N[(N[(d2 + d4), $MachinePrecision] - d3), $MachinePrecision]), $MachinePrecision], N[(d1 * N[(N[(d4 - d1), $MachinePrecision] - d3), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;d2 \leq -9.2 \cdot 10^{+110}:\\
\;\;\;\;d1 \cdot \left(\left(d2 + d4\right) - d3\right)\\
\mathbf{else}:\\
\;\;\;\;d1 \cdot \left(\left(d4 - d1\right) - d3\right)\\
\end{array}
\end{array}
if d2 < -9.2000000000000001e110Initial program 80.4%
associate--l+80.4%
distribute-lft-out--80.4%
distribute-rgt-out--82.6%
distribute-lft-out100.0%
Simplified100.0%
Taylor expanded in d1 around 0 87.0%
if -9.2000000000000001e110 < d2 Initial program 92.4%
associate--l+92.4%
distribute-lft-out--92.4%
distribute-rgt-out--94.8%
distribute-lft-out100.0%
Simplified100.0%
+-commutative100.0%
distribute-lft-in94.8%
Applied egg-rr94.8%
Taylor expanded in d2 around 0 78.3%
+-commutative78.3%
mul-1-neg78.3%
unsub-neg78.3%
distribute-lft-out--80.7%
Simplified80.7%
(FPCore (d1 d2 d3 d4) :precision binary64 (if (<= d2 -2.16e+111) (* d1 (- (+ d2 d4) d3)) (* d1 (- d4 (+ d1 d3)))))
double code(double d1, double d2, double d3, double d4) {
double tmp;
if (d2 <= -2.16e+111) {
tmp = d1 * ((d2 + d4) - d3);
} else {
tmp = d1 * (d4 - (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) :: tmp
if (d2 <= (-2.16d+111)) then
tmp = d1 * ((d2 + d4) - d3)
else
tmp = d1 * (d4 - (d1 + d3))
end if
code = tmp
end function
public static double code(double d1, double d2, double d3, double d4) {
double tmp;
if (d2 <= -2.16e+111) {
tmp = d1 * ((d2 + d4) - d3);
} else {
tmp = d1 * (d4 - (d1 + d3));
}
return tmp;
}
def code(d1, d2, d3, d4): tmp = 0 if d2 <= -2.16e+111: tmp = d1 * ((d2 + d4) - d3) else: tmp = d1 * (d4 - (d1 + d3)) return tmp
function code(d1, d2, d3, d4) tmp = 0.0 if (d2 <= -2.16e+111) tmp = Float64(d1 * Float64(Float64(d2 + d4) - d3)); else tmp = Float64(d1 * Float64(d4 - Float64(d1 + d3))); end return tmp end
function tmp_2 = code(d1, d2, d3, d4) tmp = 0.0; if (d2 <= -2.16e+111) tmp = d1 * ((d2 + d4) - d3); else tmp = d1 * (d4 - (d1 + d3)); end tmp_2 = tmp; end
code[d1_, d2_, d3_, d4_] := If[LessEqual[d2, -2.16e+111], N[(d1 * N[(N[(d2 + d4), $MachinePrecision] - d3), $MachinePrecision]), $MachinePrecision], N[(d1 * N[(d4 - N[(d1 + d3), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;d2 \leq -2.16 \cdot 10^{+111}:\\
\;\;\;\;d1 \cdot \left(\left(d2 + d4\right) - d3\right)\\
\mathbf{else}:\\
\;\;\;\;d1 \cdot \left(d4 - \left(d1 + d3\right)\right)\\
\end{array}
\end{array}
if d2 < -2.16000000000000008e111Initial program 80.4%
associate--l+80.4%
distribute-lft-out--80.4%
distribute-rgt-out--82.6%
distribute-lft-out100.0%
Simplified100.0%
Taylor expanded in d1 around 0 87.0%
if -2.16000000000000008e111 < d2 Initial program 92.4%
associate--l+92.4%
distribute-lft-out--92.4%
distribute-rgt-out--94.8%
distribute-lft-out100.0%
Simplified100.0%
Taylor expanded in d2 around 0 80.7%
(FPCore (d1 d2 d3 d4) :precision binary64 (if (<= d2 -3e+111) (* d1 (- d2 d3)) (* d1 (- d4 (+ d1 d3)))))
double code(double d1, double d2, double d3, double d4) {
double tmp;
if (d2 <= -3e+111) {
tmp = d1 * (d2 - d3);
} else {
tmp = d1 * (d4 - (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) :: tmp
if (d2 <= (-3d+111)) then
tmp = d1 * (d2 - d3)
else
tmp = d1 * (d4 - (d1 + d3))
end if
code = tmp
end function
public static double code(double d1, double d2, double d3, double d4) {
double tmp;
if (d2 <= -3e+111) {
tmp = d1 * (d2 - d3);
} else {
tmp = d1 * (d4 - (d1 + d3));
}
return tmp;
}
def code(d1, d2, d3, d4): tmp = 0 if d2 <= -3e+111: tmp = d1 * (d2 - d3) else: tmp = d1 * (d4 - (d1 + d3)) return tmp
function code(d1, d2, d3, d4) tmp = 0.0 if (d2 <= -3e+111) tmp = Float64(d1 * Float64(d2 - d3)); else tmp = Float64(d1 * Float64(d4 - Float64(d1 + d3))); end return tmp end
function tmp_2 = code(d1, d2, d3, d4) tmp = 0.0; if (d2 <= -3e+111) tmp = d1 * (d2 - d3); else tmp = d1 * (d4 - (d1 + d3)); end tmp_2 = tmp; end
code[d1_, d2_, d3_, d4_] := If[LessEqual[d2, -3e+111], N[(d1 * N[(d2 - d3), $MachinePrecision]), $MachinePrecision], N[(d1 * N[(d4 - N[(d1 + d3), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;d2 \leq -3 \cdot 10^{+111}:\\
\;\;\;\;d1 \cdot \left(d2 - d3\right)\\
\mathbf{else}:\\
\;\;\;\;d1 \cdot \left(d4 - \left(d1 + d3\right)\right)\\
\end{array}
\end{array}
if d2 < -3e111Initial program 80.4%
associate--l+80.4%
distribute-lft-out--80.4%
distribute-rgt-out--82.6%
distribute-lft-out100.0%
Simplified100.0%
Taylor expanded in d1 around 0 87.0%
Taylor expanded in d4 around 0 78.9%
if -3e111 < d2 Initial program 92.4%
associate--l+92.4%
distribute-lft-out--92.4%
distribute-rgt-out--94.8%
distribute-lft-out100.0%
Simplified100.0%
Taylor expanded in d2 around 0 80.7%
(FPCore (d1 d2 d3 d4) :precision binary64 (if (<= d2 -1.06e+66) (* d1 d2) (* d1 d4)))
double code(double d1, double d2, double d3, double d4) {
double tmp;
if (d2 <= -1.06e+66) {
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.06d+66)) 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.06e+66) {
tmp = d1 * d2;
} else {
tmp = d1 * d4;
}
return tmp;
}
def code(d1, d2, d3, d4): tmp = 0 if d2 <= -1.06e+66: tmp = d1 * d2 else: tmp = d1 * d4 return tmp
function code(d1, d2, d3, d4) tmp = 0.0 if (d2 <= -1.06e+66) 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.06e+66) tmp = d1 * d2; else tmp = d1 * d4; end tmp_2 = tmp; end
code[d1_, d2_, d3_, d4_] := If[LessEqual[d2, -1.06e+66], N[(d1 * d2), $MachinePrecision], N[(d1 * d4), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;d2 \leq -1.06 \cdot 10^{+66}:\\
\;\;\;\;d1 \cdot d2\\
\mathbf{else}:\\
\;\;\;\;d1 \cdot d4\\
\end{array}
\end{array}
if d2 < -1.06000000000000004e66Initial program 81.5%
associate--l+81.5%
distribute-lft-out--81.5%
distribute-rgt-out--83.3%
distribute-lft-out100.0%
Simplified100.0%
Taylor expanded in d2 around inf 59.4%
if -1.06000000000000004e66 < d2 Initial program 92.6%
associate--l+92.6%
distribute-lft-out--92.6%
distribute-rgt-out--95.0%
distribute-lft-out100.0%
Simplified100.0%
Taylor expanded in d4 around inf 30.8%
(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 90.2%
associate--l+90.2%
distribute-lft-out--90.2%
distribute-rgt-out--92.6%
distribute-lft-out100.0%
Simplified100.0%
Taylor expanded in d2 around inf 33.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 2024103
(FPCore (d1 d2 d3 d4)
:name "FastMath dist4"
:precision binary64
:alt
(* d1 (- (+ (- d2 d3) d4) d1))
(- (+ (- (* d1 d2) (* d1 d3)) (* d4 d1)) (* d1 d1)))