
(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 87.9%
associate--l+87.9%
distribute-lft-out--89.0%
distribute-rgt-out--92.6%
distribute-lft-out100.0%
Simplified100.0%
Final simplification100.0%
(FPCore (d1 d2 d3 d4)
:precision binary64
(let* ((t_0 (* d1 (- d2 d1))))
(if (<= d4 2.1e-267)
t_0
(if (<= d4 1.4e-147)
(* d1 (- d2 d3))
(if (<= d4 2.7e-128)
t_0
(if (<= d4 4.5e+93) (* (+ d1 d3) (- d1)) (* d1 (- d4 d3))))))))
double code(double d1, double d2, double d3, double d4) {
double t_0 = d1 * (d2 - d1);
double tmp;
if (d4 <= 2.1e-267) {
tmp = t_0;
} else if (d4 <= 1.4e-147) {
tmp = d1 * (d2 - d3);
} else if (d4 <= 2.7e-128) {
tmp = t_0;
} else if (d4 <= 4.5e+93) {
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) :: t_0
real(8) :: tmp
t_0 = d1 * (d2 - d1)
if (d4 <= 2.1d-267) then
tmp = t_0
else if (d4 <= 1.4d-147) then
tmp = d1 * (d2 - d3)
else if (d4 <= 2.7d-128) then
tmp = t_0
else if (d4 <= 4.5d+93) 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 t_0 = d1 * (d2 - d1);
double tmp;
if (d4 <= 2.1e-267) {
tmp = t_0;
} else if (d4 <= 1.4e-147) {
tmp = d1 * (d2 - d3);
} else if (d4 <= 2.7e-128) {
tmp = t_0;
} else if (d4 <= 4.5e+93) {
tmp = (d1 + d3) * -d1;
} else {
tmp = d1 * (d4 - d3);
}
return tmp;
}
def code(d1, d2, d3, d4): t_0 = d1 * (d2 - d1) tmp = 0 if d4 <= 2.1e-267: tmp = t_0 elif d4 <= 1.4e-147: tmp = d1 * (d2 - d3) elif d4 <= 2.7e-128: tmp = t_0 elif d4 <= 4.5e+93: tmp = (d1 + d3) * -d1 else: tmp = d1 * (d4 - d3) return tmp
function code(d1, d2, d3, d4) t_0 = Float64(d1 * Float64(d2 - d1)) tmp = 0.0 if (d4 <= 2.1e-267) tmp = t_0; elseif (d4 <= 1.4e-147) tmp = Float64(d1 * Float64(d2 - d3)); elseif (d4 <= 2.7e-128) tmp = t_0; elseif (d4 <= 4.5e+93) tmp = Float64(Float64(d1 + d3) * Float64(-d1)); else tmp = Float64(d1 * Float64(d4 - d3)); end return tmp end
function tmp_2 = code(d1, d2, d3, d4) t_0 = d1 * (d2 - d1); tmp = 0.0; if (d4 <= 2.1e-267) tmp = t_0; elseif (d4 <= 1.4e-147) tmp = d1 * (d2 - d3); elseif (d4 <= 2.7e-128) tmp = t_0; elseif (d4 <= 4.5e+93) tmp = (d1 + d3) * -d1; else tmp = d1 * (d4 - d3); end tmp_2 = tmp; end
code[d1_, d2_, d3_, d4_] := Block[{t$95$0 = N[(d1 * N[(d2 - d1), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[d4, 2.1e-267], t$95$0, If[LessEqual[d4, 1.4e-147], N[(d1 * N[(d2 - d3), $MachinePrecision]), $MachinePrecision], If[LessEqual[d4, 2.7e-128], t$95$0, If[LessEqual[d4, 4.5e+93], N[(N[(d1 + d3), $MachinePrecision] * (-d1)), $MachinePrecision], N[(d1 * N[(d4 - d3), $MachinePrecision]), $MachinePrecision]]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := d1 \cdot \left(d2 - d1\right)\\
\mathbf{if}\;d4 \leq 2.1 \cdot 10^{-267}:\\
\;\;\;\;t_0\\
\mathbf{elif}\;d4 \leq 1.4 \cdot 10^{-147}:\\
\;\;\;\;d1 \cdot \left(d2 - d3\right)\\
\mathbf{elif}\;d4 \leq 2.7 \cdot 10^{-128}:\\
\;\;\;\;t_0\\
\mathbf{elif}\;d4 \leq 4.5 \cdot 10^{+93}:\\
\;\;\;\;\left(d1 + d3\right) \cdot \left(-d1\right)\\
\mathbf{else}:\\
\;\;\;\;d1 \cdot \left(d4 - d3\right)\\
\end{array}
\end{array}
if d4 < 2.1000000000000001e-267 or 1.4e-147 < d4 < 2.70000000000000006e-128Initial program 87.3%
associate--l+87.3%
distribute-lft-out--88.1%
distribute-rgt-out--90.5%
distribute-lft-out100.0%
Simplified100.0%
Taylor expanded in d3 around 0 80.3%
Taylor expanded in d4 around 0 56.8%
if 2.1000000000000001e-267 < d4 < 1.4e-147Initial program 99.9%
associate--l+99.9%
distribute-lft-out--99.9%
distribute-rgt-out--99.9%
distribute-lft-out99.9%
Simplified99.9%
Taylor expanded in d4 around 0 99.9%
Taylor expanded in d1 around 0 85.6%
if 2.70000000000000006e-128 < d4 < 4.49999999999999991e93Initial program 88.5%
associate--l+88.5%
distribute-lft-out--91.8%
distribute-rgt-out--91.8%
distribute-lft-out100.0%
Simplified100.0%
Taylor expanded in d4 around 0 95.5%
Taylor expanded in d2 around 0 74.1%
neg-mul-174.1%
distribute-neg-in74.1%
sub-neg74.1%
Simplified74.1%
if 4.49999999999999991e93 < d4 Initial program 81.0%
associate--l+81.0%
distribute-lft-out--81.0%
distribute-rgt-out--95.2%
distribute-lft-out100.0%
Simplified100.0%
Taylor expanded in d1 around 0 90.9%
Taylor expanded in d2 around 0 79.4%
Final simplification67.7%
(FPCore (d1 d2 d3 d4)
:precision binary64
(let* ((t_0 (* d1 (- d2 d1))))
(if (<= d4 7e-82)
t_0
(if (<= d4 5e-48)
(* d1 (- d3))
(if (<= d4 2.05e+93) t_0 (* d1 (+ d2 d4)))))))
double code(double d1, double d2, double d3, double d4) {
double t_0 = d1 * (d2 - d1);
double tmp;
if (d4 <= 7e-82) {
tmp = t_0;
} else if (d4 <= 5e-48) {
tmp = d1 * -d3;
} else if (d4 <= 2.05e+93) {
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 - d1)
if (d4 <= 7d-82) then
tmp = t_0
else if (d4 <= 5d-48) then
tmp = d1 * -d3
else if (d4 <= 2.05d+93) 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 - d1);
double tmp;
if (d4 <= 7e-82) {
tmp = t_0;
} else if (d4 <= 5e-48) {
tmp = d1 * -d3;
} else if (d4 <= 2.05e+93) {
tmp = t_0;
} else {
tmp = d1 * (d2 + d4);
}
return tmp;
}
def code(d1, d2, d3, d4): t_0 = d1 * (d2 - d1) tmp = 0 if d4 <= 7e-82: tmp = t_0 elif d4 <= 5e-48: tmp = d1 * -d3 elif d4 <= 2.05e+93: tmp = t_0 else: tmp = d1 * (d2 + d4) return tmp
function code(d1, d2, d3, d4) t_0 = Float64(d1 * Float64(d2 - d1)) tmp = 0.0 if (d4 <= 7e-82) tmp = t_0; elseif (d4 <= 5e-48) tmp = Float64(d1 * Float64(-d3)); elseif (d4 <= 2.05e+93) 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 - d1); tmp = 0.0; if (d4 <= 7e-82) tmp = t_0; elseif (d4 <= 5e-48) tmp = d1 * -d3; elseif (d4 <= 2.05e+93) 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 - d1), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[d4, 7e-82], t$95$0, If[LessEqual[d4, 5e-48], N[(d1 * (-d3)), $MachinePrecision], If[LessEqual[d4, 2.05e+93], t$95$0, N[(d1 * N[(d2 + d4), $MachinePrecision]), $MachinePrecision]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := d1 \cdot \left(d2 - d1\right)\\
\mathbf{if}\;d4 \leq 7 \cdot 10^{-82}:\\
\;\;\;\;t_0\\
\mathbf{elif}\;d4 \leq 5 \cdot 10^{-48}:\\
\;\;\;\;d1 \cdot \left(-d3\right)\\
\mathbf{elif}\;d4 \leq 2.05 \cdot 10^{+93}:\\
\;\;\;\;t_0\\
\mathbf{else}:\\
\;\;\;\;d1 \cdot \left(d2 + d4\right)\\
\end{array}
\end{array}
if d4 < 6.9999999999999997e-82 or 4.9999999999999999e-48 < d4 < 2.0500000000000001e93Initial program 89.7%
associate--l+89.7%
distribute-lft-out--90.7%
distribute-rgt-out--92.2%
distribute-lft-out100.0%
Simplified100.0%
Taylor expanded in d3 around 0 76.6%
Taylor expanded in d4 around 0 61.1%
if 6.9999999999999997e-82 < d4 < 4.9999999999999999e-48Initial program 75.0%
associate--l+75.0%
distribute-lft-out--87.5%
distribute-rgt-out--87.5%
distribute-lft-out100.0%
Simplified100.0%
Taylor expanded in d3 around inf 73.5%
associate-*r*73.5%
neg-mul-173.5%
Simplified73.5%
if 2.0500000000000001e93 < d4 Initial program 81.4%
associate--l+81.4%
distribute-lft-out--81.4%
distribute-rgt-out--95.3%
distribute-lft-out100.0%
Simplified100.0%
Taylor expanded in d3 around 0 84.3%
Taylor expanded in d1 around 0 73.3%
Final simplification63.6%
(FPCore (d1 d2 d3 d4)
:precision binary64
(let* ((t_0 (* d1 (- d2 d3))))
(if (<= d3 -6.8e+103)
t_0
(if (<= d3 7e-27)
(* d1 (- d2 d1))
(if (<= d3 1.62e+74) (* d1 (+ d2 d4)) t_0)))))
double code(double d1, double d2, double d3, double d4) {
double t_0 = d1 * (d2 - d3);
double tmp;
if (d3 <= -6.8e+103) {
tmp = t_0;
} else if (d3 <= 7e-27) {
tmp = d1 * (d2 - d1);
} else if (d3 <= 1.62e+74) {
tmp = d1 * (d2 + d4);
} 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) :: tmp
t_0 = d1 * (d2 - d3)
if (d3 <= (-6.8d+103)) then
tmp = t_0
else if (d3 <= 7d-27) then
tmp = d1 * (d2 - d1)
else if (d3 <= 1.62d+74) then
tmp = d1 * (d2 + d4)
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 * (d2 - d3);
double tmp;
if (d3 <= -6.8e+103) {
tmp = t_0;
} else if (d3 <= 7e-27) {
tmp = d1 * (d2 - d1);
} else if (d3 <= 1.62e+74) {
tmp = d1 * (d2 + d4);
} else {
tmp = t_0;
}
return tmp;
}
def code(d1, d2, d3, d4): t_0 = d1 * (d2 - d3) tmp = 0 if d3 <= -6.8e+103: tmp = t_0 elif d3 <= 7e-27: tmp = d1 * (d2 - d1) elif d3 <= 1.62e+74: tmp = d1 * (d2 + d4) else: tmp = t_0 return tmp
function code(d1, d2, d3, d4) t_0 = Float64(d1 * Float64(d2 - d3)) tmp = 0.0 if (d3 <= -6.8e+103) tmp = t_0; elseif (d3 <= 7e-27) tmp = Float64(d1 * Float64(d2 - d1)); elseif (d3 <= 1.62e+74) tmp = Float64(d1 * Float64(d2 + d4)); else tmp = t_0; end return tmp end
function tmp_2 = code(d1, d2, d3, d4) t_0 = d1 * (d2 - d3); tmp = 0.0; if (d3 <= -6.8e+103) tmp = t_0; elseif (d3 <= 7e-27) tmp = d1 * (d2 - d1); elseif (d3 <= 1.62e+74) tmp = d1 * (d2 + d4); else tmp = t_0; end tmp_2 = tmp; end
code[d1_, d2_, d3_, d4_] := Block[{t$95$0 = N[(d1 * N[(d2 - d3), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[d3, -6.8e+103], t$95$0, If[LessEqual[d3, 7e-27], N[(d1 * N[(d2 - d1), $MachinePrecision]), $MachinePrecision], If[LessEqual[d3, 1.62e+74], N[(d1 * N[(d2 + d4), $MachinePrecision]), $MachinePrecision], t$95$0]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := d1 \cdot \left(d2 - d3\right)\\
\mathbf{if}\;d3 \leq -6.8 \cdot 10^{+103}:\\
\;\;\;\;t_0\\
\mathbf{elif}\;d3 \leq 7 \cdot 10^{-27}:\\
\;\;\;\;d1 \cdot \left(d2 - d1\right)\\
\mathbf{elif}\;d3 \leq 1.62 \cdot 10^{+74}:\\
\;\;\;\;d1 \cdot \left(d2 + d4\right)\\
\mathbf{else}:\\
\;\;\;\;t_0\\
\end{array}
\end{array}
if d3 < -6.7999999999999997e103 or 1.62e74 < d3 Initial program 81.3%
associate--l+81.3%
distribute-lft-out--84.6%
distribute-rgt-out--87.9%
distribute-lft-out100.0%
Simplified100.0%
Taylor expanded in d4 around 0 90.6%
Taylor expanded in d1 around 0 83.1%
if -6.7999999999999997e103 < d3 < 7.0000000000000003e-27Initial program 90.8%
associate--l+90.8%
distribute-lft-out--90.8%
distribute-rgt-out--95.0%
distribute-lft-out100.0%
Simplified100.0%
Taylor expanded in d3 around 0 95.1%
Taylor expanded in d4 around 0 73.6%
if 7.0000000000000003e-27 < d3 < 1.62e74Initial program 95.7%
associate--l+95.7%
distribute-lft-out--95.7%
distribute-rgt-out--95.7%
distribute-lft-out100.0%
Simplified100.0%
Taylor expanded in d3 around 0 88.0%
Taylor expanded in d1 around 0 84.0%
Final simplification77.9%
(FPCore (d1 d2 d3 d4)
:precision binary64
(if (<= d3 -1.05e+39)
(* d1 (- d4 d3))
(if (<= d3 3e-27)
(* d1 (- d2 d1))
(if (<= d3 1.35e+72) (* d1 (+ d2 d4)) (* d1 (- d2 d3))))))
double code(double d1, double d2, double d3, double d4) {
double tmp;
if (d3 <= -1.05e+39) {
tmp = d1 * (d4 - d3);
} else if (d3 <= 3e-27) {
tmp = d1 * (d2 - d1);
} else if (d3 <= 1.35e+72) {
tmp = d1 * (d2 + d4);
} else {
tmp = d1 * (d2 - 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 <= (-1.05d+39)) then
tmp = d1 * (d4 - d3)
else if (d3 <= 3d-27) then
tmp = d1 * (d2 - d1)
else if (d3 <= 1.35d+72) then
tmp = d1 * (d2 + d4)
else
tmp = d1 * (d2 - d3)
end if
code = tmp
end function
public static double code(double d1, double d2, double d3, double d4) {
double tmp;
if (d3 <= -1.05e+39) {
tmp = d1 * (d4 - d3);
} else if (d3 <= 3e-27) {
tmp = d1 * (d2 - d1);
} else if (d3 <= 1.35e+72) {
tmp = d1 * (d2 + d4);
} else {
tmp = d1 * (d2 - d3);
}
return tmp;
}
def code(d1, d2, d3, d4): tmp = 0 if d3 <= -1.05e+39: tmp = d1 * (d4 - d3) elif d3 <= 3e-27: tmp = d1 * (d2 - d1) elif d3 <= 1.35e+72: tmp = d1 * (d2 + d4) else: tmp = d1 * (d2 - d3) return tmp
function code(d1, d2, d3, d4) tmp = 0.0 if (d3 <= -1.05e+39) tmp = Float64(d1 * Float64(d4 - d3)); elseif (d3 <= 3e-27) tmp = Float64(d1 * Float64(d2 - d1)); elseif (d3 <= 1.35e+72) tmp = Float64(d1 * Float64(d2 + d4)); else tmp = Float64(d1 * Float64(d2 - d3)); end return tmp end
function tmp_2 = code(d1, d2, d3, d4) tmp = 0.0; if (d3 <= -1.05e+39) tmp = d1 * (d4 - d3); elseif (d3 <= 3e-27) tmp = d1 * (d2 - d1); elseif (d3 <= 1.35e+72) tmp = d1 * (d2 + d4); else tmp = d1 * (d2 - d3); end tmp_2 = tmp; end
code[d1_, d2_, d3_, d4_] := If[LessEqual[d3, -1.05e+39], N[(d1 * N[(d4 - d3), $MachinePrecision]), $MachinePrecision], If[LessEqual[d3, 3e-27], N[(d1 * N[(d2 - d1), $MachinePrecision]), $MachinePrecision], If[LessEqual[d3, 1.35e+72], N[(d1 * N[(d2 + d4), $MachinePrecision]), $MachinePrecision], N[(d1 * N[(d2 - d3), $MachinePrecision]), $MachinePrecision]]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;d3 \leq -1.05 \cdot 10^{+39}:\\
\;\;\;\;d1 \cdot \left(d4 - d3\right)\\
\mathbf{elif}\;d3 \leq 3 \cdot 10^{-27}:\\
\;\;\;\;d1 \cdot \left(d2 - d1\right)\\
\mathbf{elif}\;d3 \leq 1.35 \cdot 10^{+72}:\\
\;\;\;\;d1 \cdot \left(d2 + d4\right)\\
\mathbf{else}:\\
\;\;\;\;d1 \cdot \left(d2 - d3\right)\\
\end{array}
\end{array}
if d3 < -1.0499999999999999e39Initial program 79.6%
associate--l+79.6%
distribute-lft-out--79.6%
distribute-rgt-out--83.3%
distribute-lft-out100.0%
Simplified100.0%
Taylor expanded in d1 around 0 87.4%
Taylor expanded in d2 around 0 74.9%
if -1.0499999999999999e39 < d3 < 3.0000000000000001e-27Initial program 92.8%
associate--l+92.8%
distribute-lft-out--92.8%
distribute-rgt-out--96.8%
distribute-lft-out100.0%
Simplified100.0%
Taylor expanded in d3 around 0 97.1%
Taylor expanded in d4 around 0 76.7%
if 3.0000000000000001e-27 < d3 < 1.35e72Initial program 95.7%
associate--l+95.7%
distribute-lft-out--95.7%
distribute-rgt-out--95.7%
distribute-lft-out100.0%
Simplified100.0%
Taylor expanded in d3 around 0 88.0%
Taylor expanded in d1 around 0 84.0%
if 1.35e72 < d3 Initial program 81.5%
associate--l+81.5%
distribute-lft-out--87.0%
distribute-rgt-out--90.7%
distribute-lft-out100.0%
Simplified100.0%
Taylor expanded in d4 around 0 89.4%
Taylor expanded in d1 around 0 82.0%
Final simplification78.1%
(FPCore (d1 d2 d3 d4) :precision binary64 (if (or (<= d3 -1.2e-33) (not (<= d3 1.4e-13))) (* d1 (- (+ d2 d4) d3)) (* d1 (- (+ d2 d4) d1))))
double code(double d1, double d2, double d3, double d4) {
double tmp;
if ((d3 <= -1.2e-33) || !(d3 <= 1.4e-13)) {
tmp = d1 * ((d2 + 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 ((d3 <= (-1.2d-33)) .or. (.not. (d3 <= 1.4d-13))) then
tmp = d1 * ((d2 + 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 ((d3 <= -1.2e-33) || !(d3 <= 1.4e-13)) {
tmp = d1 * ((d2 + d4) - d3);
} else {
tmp = d1 * ((d2 + d4) - d1);
}
return tmp;
}
def code(d1, d2, d3, d4): tmp = 0 if (d3 <= -1.2e-33) or not (d3 <= 1.4e-13): tmp = d1 * ((d2 + d4) - d3) else: tmp = d1 * ((d2 + d4) - d1) return tmp
function code(d1, d2, d3, d4) tmp = 0.0 if ((d3 <= -1.2e-33) || !(d3 <= 1.4e-13)) tmp = Float64(d1 * Float64(Float64(d2 + 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 ((d3 <= -1.2e-33) || ~((d3 <= 1.4e-13))) tmp = d1 * ((d2 + d4) - d3); else tmp = d1 * ((d2 + d4) - d1); end tmp_2 = tmp; end
code[d1_, d2_, d3_, d4_] := If[Or[LessEqual[d3, -1.2e-33], N[Not[LessEqual[d3, 1.4e-13]], $MachinePrecision]], N[(d1 * N[(N[(d2 + d4), $MachinePrecision] - d3), $MachinePrecision]), $MachinePrecision], N[(d1 * N[(N[(d2 + d4), $MachinePrecision] - d1), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;d3 \leq -1.2 \cdot 10^{-33} \lor \neg \left(d3 \leq 1.4 \cdot 10^{-13}\right):\\
\;\;\;\;d1 \cdot \left(\left(d2 + d4\right) - d3\right)\\
\mathbf{else}:\\
\;\;\;\;d1 \cdot \left(\left(d2 + d4\right) - d1\right)\\
\end{array}
\end{array}
if d3 < -1.2e-33 or 1.4000000000000001e-13 < d3 Initial program 84.4%
associate--l+84.4%
distribute-lft-out--86.5%
distribute-rgt-out--89.4%
distribute-lft-out100.0%
Simplified100.0%
Taylor expanded in d1 around 0 91.0%
if -1.2e-33 < d3 < 1.4000000000000001e-13Initial program 92.1%
associate--l+92.1%
distribute-lft-out--92.1%
distribute-rgt-out--96.5%
distribute-lft-out100.0%
Simplified100.0%
Taylor expanded in d3 around 0 98.5%
Final simplification94.4%
(FPCore (d1 d2 d3 d4) :precision binary64 (if (<= d3 -2.4e+211) (* d1 (- d4 d3)) (if (<= d3 6.6e+97) (* d1 (- (+ d2 d4) d1)) (* d1 (- d2 d3)))))
double code(double d1, double d2, double d3, double d4) {
double tmp;
if (d3 <= -2.4e+211) {
tmp = d1 * (d4 - d3);
} else if (d3 <= 6.6e+97) {
tmp = d1 * ((d2 + d4) - d1);
} else {
tmp = d1 * (d2 - 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.4d+211)) then
tmp = d1 * (d4 - d3)
else if (d3 <= 6.6d+97) then
tmp = d1 * ((d2 + d4) - d1)
else
tmp = d1 * (d2 - d3)
end if
code = tmp
end function
public static double code(double d1, double d2, double d3, double d4) {
double tmp;
if (d3 <= -2.4e+211) {
tmp = d1 * (d4 - d3);
} else if (d3 <= 6.6e+97) {
tmp = d1 * ((d2 + d4) - d1);
} else {
tmp = d1 * (d2 - d3);
}
return tmp;
}
def code(d1, d2, d3, d4): tmp = 0 if d3 <= -2.4e+211: tmp = d1 * (d4 - d3) elif d3 <= 6.6e+97: tmp = d1 * ((d2 + d4) - d1) else: tmp = d1 * (d2 - d3) return tmp
function code(d1, d2, d3, d4) tmp = 0.0 if (d3 <= -2.4e+211) tmp = Float64(d1 * Float64(d4 - d3)); elseif (d3 <= 6.6e+97) tmp = Float64(d1 * Float64(Float64(d2 + d4) - d1)); else tmp = Float64(d1 * Float64(d2 - d3)); end return tmp end
function tmp_2 = code(d1, d2, d3, d4) tmp = 0.0; if (d3 <= -2.4e+211) tmp = d1 * (d4 - d3); elseif (d3 <= 6.6e+97) tmp = d1 * ((d2 + d4) - d1); else tmp = d1 * (d2 - d3); end tmp_2 = tmp; end
code[d1_, d2_, d3_, d4_] := If[LessEqual[d3, -2.4e+211], N[(d1 * N[(d4 - d3), $MachinePrecision]), $MachinePrecision], If[LessEqual[d3, 6.6e+97], N[(d1 * N[(N[(d2 + d4), $MachinePrecision] - d1), $MachinePrecision]), $MachinePrecision], N[(d1 * N[(d2 - d3), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;d3 \leq -2.4 \cdot 10^{+211}:\\
\;\;\;\;d1 \cdot \left(d4 - d3\right)\\
\mathbf{elif}\;d3 \leq 6.6 \cdot 10^{+97}:\\
\;\;\;\;d1 \cdot \left(\left(d2 + d4\right) - d1\right)\\
\mathbf{else}:\\
\;\;\;\;d1 \cdot \left(d2 - d3\right)\\
\end{array}
\end{array}
if d3 < -2.40000000000000018e211Initial program 80.0%
associate--l+80.0%
distribute-lft-out--80.0%
distribute-rgt-out--85.0%
distribute-lft-out100.0%
Simplified100.0%
Taylor expanded in d1 around 0 100.0%
Taylor expanded in d2 around 0 91.0%
if -2.40000000000000018e211 < d3 < 6.6000000000000003e97Initial program 90.2%
associate--l+90.2%
distribute-lft-out--90.2%
distribute-rgt-out--94.0%
distribute-lft-out100.0%
Simplified100.0%
Taylor expanded in d3 around 0 92.2%
if 6.6000000000000003e97 < d3 Initial program 82.3%
associate--l+82.3%
distribute-lft-out--88.2%
distribute-rgt-out--90.2%
distribute-lft-out100.0%
Simplified100.0%
Taylor expanded in d4 around 0 90.7%
Taylor expanded in d1 around 0 82.9%
Final simplification90.3%
(FPCore (d1 d2 d3 d4)
:precision binary64
(if (<= d2 -1.2e+45)
(* d1 d2)
(if (<= d2 1.35e-299)
(* d1 (- d1))
(if (<= d2 1.6e-124) (* d1 (- d3)) (* d1 d4)))))
double code(double d1, double d2, double d3, double d4) {
double tmp;
if (d2 <= -1.2e+45) {
tmp = d1 * d2;
} else if (d2 <= 1.35e-299) {
tmp = d1 * -d1;
} else if (d2 <= 1.6e-124) {
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 <= (-1.2d+45)) then
tmp = d1 * d2
else if (d2 <= 1.35d-299) then
tmp = d1 * -d1
else if (d2 <= 1.6d-124) 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 <= -1.2e+45) {
tmp = d1 * d2;
} else if (d2 <= 1.35e-299) {
tmp = d1 * -d1;
} else if (d2 <= 1.6e-124) {
tmp = d1 * -d3;
} else {
tmp = d1 * d4;
}
return tmp;
}
def code(d1, d2, d3, d4): tmp = 0 if d2 <= -1.2e+45: tmp = d1 * d2 elif d2 <= 1.35e-299: tmp = d1 * -d1 elif d2 <= 1.6e-124: tmp = d1 * -d3 else: tmp = d1 * d4 return tmp
function code(d1, d2, d3, d4) tmp = 0.0 if (d2 <= -1.2e+45) tmp = Float64(d1 * d2); elseif (d2 <= 1.35e-299) tmp = Float64(d1 * Float64(-d1)); elseif (d2 <= 1.6e-124) 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 <= -1.2e+45) tmp = d1 * d2; elseif (d2 <= 1.35e-299) tmp = d1 * -d1; elseif (d2 <= 1.6e-124) tmp = d1 * -d3; else tmp = d1 * d4; end tmp_2 = tmp; end
code[d1_, d2_, d3_, d4_] := If[LessEqual[d2, -1.2e+45], N[(d1 * d2), $MachinePrecision], If[LessEqual[d2, 1.35e-299], N[(d1 * (-d1)), $MachinePrecision], If[LessEqual[d2, 1.6e-124], N[(d1 * (-d3)), $MachinePrecision], N[(d1 * d4), $MachinePrecision]]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;d2 \leq -1.2 \cdot 10^{+45}:\\
\;\;\;\;d1 \cdot d2\\
\mathbf{elif}\;d2 \leq 1.35 \cdot 10^{-299}:\\
\;\;\;\;d1 \cdot \left(-d1\right)\\
\mathbf{elif}\;d2 \leq 1.6 \cdot 10^{-124}:\\
\;\;\;\;d1 \cdot \left(-d3\right)\\
\mathbf{else}:\\
\;\;\;\;d1 \cdot d4\\
\end{array}
\end{array}
if d2 < -1.19999999999999995e45Initial program 80.7%
associate--l+80.7%
distribute-lft-out--80.7%
distribute-rgt-out--82.7%
distribute-lft-out100.0%
Simplified100.0%
Taylor expanded in d2 around inf 59.1%
if -1.19999999999999995e45 < d2 < 1.35000000000000001e-299Initial program 90.4%
associate--l+90.4%
distribute-lft-out--90.4%
distribute-rgt-out--95.2%
distribute-lft-out100.0%
Simplified100.0%
Taylor expanded in d1 around inf 48.6%
unpow248.6%
mul-1-neg48.6%
distribute-rgt-neg-out48.6%
Simplified48.6%
if 1.35000000000000001e-299 < d2 < 1.60000000000000002e-124Initial 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 d3 around inf 59.9%
associate-*r*59.9%
neg-mul-159.9%
Simplified59.9%
if 1.60000000000000002e-124 < d2 Initial program 84.8%
associate--l+84.8%
distribute-lft-out--88.3%
distribute-rgt-out--93.0%
distribute-lft-out100.0%
Simplified100.0%
Taylor expanded in d4 around inf 17.9%
Final simplification42.0%
(FPCore (d1 d2 d3 d4) :precision binary64 (if (or (<= d1 -7.5e+45) (not (<= d1 6.6e+77))) (* d1 (- d1)) (* d1 (+ d2 d4))))
double code(double d1, double d2, double d3, double d4) {
double tmp;
if ((d1 <= -7.5e+45) || !(d1 <= 6.6e+77)) {
tmp = d1 * -d1;
} else {
tmp = d1 * (d2 + d4);
}
return tmp;
}
real(8) function code(d1, d2, d3, d4)
real(8), intent (in) :: d1
real(8), intent (in) :: d2
real(8), intent (in) :: d3
real(8), intent (in) :: d4
real(8) :: tmp
if ((d1 <= (-7.5d+45)) .or. (.not. (d1 <= 6.6d+77))) then
tmp = d1 * -d1
else
tmp = d1 * (d2 + d4)
end if
code = tmp
end function
public static double code(double d1, double d2, double d3, double d4) {
double tmp;
if ((d1 <= -7.5e+45) || !(d1 <= 6.6e+77)) {
tmp = d1 * -d1;
} else {
tmp = d1 * (d2 + d4);
}
return tmp;
}
def code(d1, d2, d3, d4): tmp = 0 if (d1 <= -7.5e+45) or not (d1 <= 6.6e+77): tmp = d1 * -d1 else: tmp = d1 * (d2 + d4) return tmp
function code(d1, d2, d3, d4) tmp = 0.0 if ((d1 <= -7.5e+45) || !(d1 <= 6.6e+77)) tmp = Float64(d1 * Float64(-d1)); else tmp = Float64(d1 * Float64(d2 + d4)); end return tmp end
function tmp_2 = code(d1, d2, d3, d4) tmp = 0.0; if ((d1 <= -7.5e+45) || ~((d1 <= 6.6e+77))) tmp = d1 * -d1; else tmp = d1 * (d2 + d4); end tmp_2 = tmp; end
code[d1_, d2_, d3_, d4_] := If[Or[LessEqual[d1, -7.5e+45], N[Not[LessEqual[d1, 6.6e+77]], $MachinePrecision]], N[(d1 * (-d1)), $MachinePrecision], N[(d1 * N[(d2 + d4), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;d1 \leq -7.5 \cdot 10^{+45} \lor \neg \left(d1 \leq 6.6 \cdot 10^{+77}\right):\\
\;\;\;\;d1 \cdot \left(-d1\right)\\
\mathbf{else}:\\
\;\;\;\;d1 \cdot \left(d2 + d4\right)\\
\end{array}
\end{array}
if d1 < -7.50000000000000058e45 or 6.5999999999999996e77 < d1 Initial program 73.9%
associate--l+73.9%
distribute-lft-out--76.5%
distribute-rgt-out--84.0%
distribute-lft-out100.0%
Simplified100.0%
Taylor expanded in d1 around inf 67.4%
unpow267.4%
mul-1-neg67.4%
distribute-rgt-neg-out67.4%
Simplified67.4%
if -7.50000000000000058e45 < d1 < 6.5999999999999996e77Initial 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 d3 around 0 70.4%
Taylor expanded in d1 around 0 62.6%
Final simplification64.8%
(FPCore (d1 d2 d3 d4) :precision binary64 (if (<= d4 2.1e+88) (* d1 (- d2 (+ d1 d3))) (* d1 (- (+ d2 d4) d3))))
double code(double d1, double d2, double d3, double d4) {
double tmp;
if (d4 <= 2.1e+88) {
tmp = d1 * (d2 - (d1 + d3));
} else {
tmp = d1 * ((d2 + d4) - d3);
}
return tmp;
}
real(8) function code(d1, d2, d3, d4)
real(8), intent (in) :: d1
real(8), intent (in) :: d2
real(8), intent (in) :: d3
real(8), intent (in) :: d4
real(8) :: tmp
if (d4 <= 2.1d+88) then
tmp = d1 * (d2 - (d1 + d3))
else
tmp = d1 * ((d2 + d4) - d3)
end if
code = tmp
end function
public static double code(double d1, double d2, double d3, double d4) {
double tmp;
if (d4 <= 2.1e+88) {
tmp = d1 * (d2 - (d1 + d3));
} else {
tmp = d1 * ((d2 + d4) - d3);
}
return tmp;
}
def code(d1, d2, d3, d4): tmp = 0 if d4 <= 2.1e+88: tmp = d1 * (d2 - (d1 + d3)) else: tmp = d1 * ((d2 + d4) - d3) return tmp
function code(d1, d2, d3, d4) tmp = 0.0 if (d4 <= 2.1e+88) tmp = Float64(d1 * Float64(d2 - Float64(d1 + d3))); else tmp = Float64(d1 * Float64(Float64(d2 + d4) - d3)); end return tmp end
function tmp_2 = code(d1, d2, d3, d4) tmp = 0.0; if (d4 <= 2.1e+88) tmp = d1 * (d2 - (d1 + d3)); else tmp = d1 * ((d2 + d4) - d3); end tmp_2 = tmp; end
code[d1_, d2_, d3_, d4_] := If[LessEqual[d4, 2.1e+88], N[(d1 * N[(d2 - N[(d1 + d3), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(d1 * N[(N[(d2 + d4), $MachinePrecision] - d3), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;d4 \leq 2.1 \cdot 10^{+88}:\\
\;\;\;\;d1 \cdot \left(d2 - \left(d1 + d3\right)\right)\\
\mathbf{else}:\\
\;\;\;\;d1 \cdot \left(\left(d2 + d4\right) - d3\right)\\
\end{array}
\end{array}
if d4 < 2.1e88Initial program 89.1%
associate--l+89.1%
distribute-lft-out--90.5%
distribute-rgt-out--91.9%
distribute-lft-out100.0%
Simplified100.0%
Taylor expanded in d4 around 0 84.5%
if 2.1e88 < d4 Initial program 82.2%
associate--l+82.2%
distribute-lft-out--82.2%
distribute-rgt-out--95.6%
distribute-lft-out100.0%
Simplified100.0%
Taylor expanded in d1 around 0 91.5%
Final simplification85.7%
(FPCore (d1 d2 d3 d4) :precision binary64 (if (<= d2 -1.2e+45) (* d1 d2) (if (<= d2 1.25e-43) (* d1 (- d1)) (* d1 d4))))
double code(double d1, double d2, double d3, double d4) {
double tmp;
if (d2 <= -1.2e+45) {
tmp = d1 * d2;
} else if (d2 <= 1.25e-43) {
tmp = d1 * -d1;
} else {
tmp = d1 * d4;
}
return tmp;
}
real(8) function code(d1, d2, d3, d4)
real(8), intent (in) :: d1
real(8), intent (in) :: d2
real(8), intent (in) :: d3
real(8), intent (in) :: d4
real(8) :: tmp
if (d2 <= (-1.2d+45)) then
tmp = d1 * d2
else if (d2 <= 1.25d-43) then
tmp = d1 * -d1
else
tmp = d1 * d4
end if
code = tmp
end function
public static double code(double d1, double d2, double d3, double d4) {
double tmp;
if (d2 <= -1.2e+45) {
tmp = d1 * d2;
} else if (d2 <= 1.25e-43) {
tmp = d1 * -d1;
} else {
tmp = d1 * d4;
}
return tmp;
}
def code(d1, d2, d3, d4): tmp = 0 if d2 <= -1.2e+45: tmp = d1 * d2 elif d2 <= 1.25e-43: tmp = d1 * -d1 else: tmp = d1 * d4 return tmp
function code(d1, d2, d3, d4) tmp = 0.0 if (d2 <= -1.2e+45) tmp = Float64(d1 * d2); elseif (d2 <= 1.25e-43) tmp = Float64(d1 * Float64(-d1)); else tmp = Float64(d1 * d4); end return tmp end
function tmp_2 = code(d1, d2, d3, d4) tmp = 0.0; if (d2 <= -1.2e+45) tmp = d1 * d2; elseif (d2 <= 1.25e-43) tmp = d1 * -d1; else tmp = d1 * d4; end tmp_2 = tmp; end
code[d1_, d2_, d3_, d4_] := If[LessEqual[d2, -1.2e+45], N[(d1 * d2), $MachinePrecision], If[LessEqual[d2, 1.25e-43], N[(d1 * (-d1)), $MachinePrecision], N[(d1 * d4), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;d2 \leq -1.2 \cdot 10^{+45}:\\
\;\;\;\;d1 \cdot d2\\
\mathbf{elif}\;d2 \leq 1.25 \cdot 10^{-43}:\\
\;\;\;\;d1 \cdot \left(-d1\right)\\
\mathbf{else}:\\
\;\;\;\;d1 \cdot d4\\
\end{array}
\end{array}
if d2 < -1.19999999999999995e45Initial program 80.7%
associate--l+80.7%
distribute-lft-out--80.7%
distribute-rgt-out--82.7%
distribute-lft-out100.0%
Simplified100.0%
Taylor expanded in d2 around inf 59.1%
if -1.19999999999999995e45 < d2 < 1.25000000000000005e-43Initial program 93.2%
associate--l+93.2%
distribute-lft-out--93.2%
distribute-rgt-out--96.2%
distribute-lft-out100.0%
Simplified100.0%
Taylor expanded in d1 around inf 46.2%
unpow246.2%
mul-1-neg46.2%
distribute-rgt-neg-out46.2%
Simplified46.2%
if 1.25000000000000005e-43 < d2 Initial program 83.3%
associate--l+83.3%
distribute-lft-out--87.5%
distribute-rgt-out--93.0%
distribute-lft-out100.0%
Simplified100.0%
Taylor expanded in d4 around inf 18.2%
Final simplification40.9%
(FPCore (d1 d2 d3 d4) :precision binary64 (if (<= d2 -6.2e+37) (* d1 d2) (* d1 d4)))
double code(double d1, double d2, double d3, double d4) {
double tmp;
if (d2 <= -6.2e+37) {
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 <= (-6.2d+37)) 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 <= -6.2e+37) {
tmp = d1 * d2;
} else {
tmp = d1 * d4;
}
return tmp;
}
def code(d1, d2, d3, d4): tmp = 0 if d2 <= -6.2e+37: tmp = d1 * d2 else: tmp = d1 * d4 return tmp
function code(d1, d2, d3, d4) tmp = 0.0 if (d2 <= -6.2e+37) 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 <= -6.2e+37) tmp = d1 * d2; else tmp = d1 * d4; end tmp_2 = tmp; end
code[d1_, d2_, d3_, d4_] := If[LessEqual[d2, -6.2e+37], N[(d1 * d2), $MachinePrecision], N[(d1 * d4), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;d2 \leq -6.2 \cdot 10^{+37}:\\
\;\;\;\;d1 \cdot d2\\
\mathbf{else}:\\
\;\;\;\;d1 \cdot d4\\
\end{array}
\end{array}
if d2 < -6.2000000000000004e37Initial program 79.6%
associate--l+79.6%
distribute-lft-out--79.6%
distribute-rgt-out--83.3%
distribute-lft-out100.0%
Simplified100.0%
Taylor expanded in d2 around inf 58.7%
if -6.2000000000000004e37 < d2 Initial program 90.1%
associate--l+90.1%
distribute-lft-out--91.6%
distribute-rgt-out--95.0%
distribute-lft-out100.0%
Simplified100.0%
Taylor expanded in d4 around inf 31.6%
Final simplification37.4%
(FPCore (d1 d2 d3 d4) :precision binary64 (* d1 d4))
double code(double d1, double d2, double d3, double d4) {
return d1 * d4;
}
real(8) function code(d1, d2, d3, d4)
real(8), intent (in) :: d1
real(8), intent (in) :: d2
real(8), intent (in) :: d3
real(8), intent (in) :: d4
code = d1 * d4
end function
public static double code(double d1, double d2, double d3, double d4) {
return d1 * d4;
}
def code(d1, d2, d3, d4): return d1 * d4
function code(d1, d2, d3, d4) return Float64(d1 * d4) end
function tmp = code(d1, d2, d3, d4) tmp = d1 * d4; end
code[d1_, d2_, d3_, d4_] := N[(d1 * d4), $MachinePrecision]
\begin{array}{l}
\\
d1 \cdot d4
\end{array}
Initial program 87.9%
associate--l+87.9%
distribute-lft-out--89.0%
distribute-rgt-out--92.6%
distribute-lft-out100.0%
Simplified100.0%
Taylor expanded in d4 around inf 27.9%
Final simplification27.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 2023196
(FPCore (d1 d2 d3 d4)
:name "FastMath dist4"
:precision binary64
:herbie-target
(* d1 (- (+ (- d2 d3) d4) d1))
(- (+ (- (* d1 d2) (* d1 d3)) (* d4 d1)) (* d1 d1)))