
(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 89.8%
associate--l+89.8%
distribute-lft-out--90.2%
distribute-rgt-out--92.9%
distribute-lft-out100.0%
Simplified100.0%
(FPCore (d1 d2 d3 d4)
:precision binary64
(let* ((t_0 (* d1 (- d2 d1))) (t_1 (* d1 (- d2 d3))))
(if (<= d4 4.5e-292)
t_1
(if (<= d4 1.15e-188)
(* d1 (- (- d1) d3))
(if (<= d4 3.8e-131)
t_0
(if (<= d4 9.2e-97)
t_1
(if (<= d4 6.6e+40)
t_0
(if (<= d4 1.35e+118) (* d1 (- d4 d3)) (* d1 (+ d2 d4))))))))))
double code(double d1, double d2, double d3, double d4) {
double t_0 = d1 * (d2 - d1);
double t_1 = d1 * (d2 - d3);
double tmp;
if (d4 <= 4.5e-292) {
tmp = t_1;
} else if (d4 <= 1.15e-188) {
tmp = d1 * (-d1 - d3);
} else if (d4 <= 3.8e-131) {
tmp = t_0;
} else if (d4 <= 9.2e-97) {
tmp = t_1;
} else if (d4 <= 6.6e+40) {
tmp = t_0;
} else if (d4 <= 1.35e+118) {
tmp = d1 * (d4 - d3);
} else {
tmp = d1 * (d2 + d4);
}
return tmp;
}
real(8) function code(d1, d2, d3, d4)
real(8), intent (in) :: d1
real(8), intent (in) :: d2
real(8), intent (in) :: d3
real(8), intent (in) :: d4
real(8) :: t_0
real(8) :: t_1
real(8) :: tmp
t_0 = d1 * (d2 - d1)
t_1 = d1 * (d2 - d3)
if (d4 <= 4.5d-292) then
tmp = t_1
else if (d4 <= 1.15d-188) then
tmp = d1 * (-d1 - d3)
else if (d4 <= 3.8d-131) then
tmp = t_0
else if (d4 <= 9.2d-97) then
tmp = t_1
else if (d4 <= 6.6d+40) then
tmp = t_0
else if (d4 <= 1.35d+118) then
tmp = d1 * (d4 - d3)
else
tmp = d1 * (d2 + d4)
end if
code = tmp
end function
public static double code(double d1, double d2, double d3, double d4) {
double t_0 = d1 * (d2 - d1);
double t_1 = d1 * (d2 - d3);
double tmp;
if (d4 <= 4.5e-292) {
tmp = t_1;
} else if (d4 <= 1.15e-188) {
tmp = d1 * (-d1 - d3);
} else if (d4 <= 3.8e-131) {
tmp = t_0;
} else if (d4 <= 9.2e-97) {
tmp = t_1;
} else if (d4 <= 6.6e+40) {
tmp = t_0;
} else if (d4 <= 1.35e+118) {
tmp = d1 * (d4 - d3);
} else {
tmp = d1 * (d2 + d4);
}
return tmp;
}
def code(d1, d2, d3, d4): t_0 = d1 * (d2 - d1) t_1 = d1 * (d2 - d3) tmp = 0 if d4 <= 4.5e-292: tmp = t_1 elif d4 <= 1.15e-188: tmp = d1 * (-d1 - d3) elif d4 <= 3.8e-131: tmp = t_0 elif d4 <= 9.2e-97: tmp = t_1 elif d4 <= 6.6e+40: tmp = t_0 elif d4 <= 1.35e+118: tmp = d1 * (d4 - d3) else: tmp = d1 * (d2 + d4) return tmp
function code(d1, d2, d3, d4) t_0 = Float64(d1 * Float64(d2 - d1)) t_1 = Float64(d1 * Float64(d2 - d3)) tmp = 0.0 if (d4 <= 4.5e-292) tmp = t_1; elseif (d4 <= 1.15e-188) tmp = Float64(d1 * Float64(Float64(-d1) - d3)); elseif (d4 <= 3.8e-131) tmp = t_0; elseif (d4 <= 9.2e-97) tmp = t_1; elseif (d4 <= 6.6e+40) tmp = t_0; elseif (d4 <= 1.35e+118) tmp = Float64(d1 * Float64(d4 - d3)); else tmp = Float64(d1 * Float64(d2 + d4)); end return tmp end
function tmp_2 = code(d1, d2, d3, d4) t_0 = d1 * (d2 - d1); t_1 = d1 * (d2 - d3); tmp = 0.0; if (d4 <= 4.5e-292) tmp = t_1; elseif (d4 <= 1.15e-188) tmp = d1 * (-d1 - d3); elseif (d4 <= 3.8e-131) tmp = t_0; elseif (d4 <= 9.2e-97) tmp = t_1; elseif (d4 <= 6.6e+40) tmp = t_0; elseif (d4 <= 1.35e+118) tmp = d1 * (d4 - d3); else tmp = d1 * (d2 + d4); end tmp_2 = tmp; end
code[d1_, d2_, d3_, d4_] := Block[{t$95$0 = N[(d1 * N[(d2 - d1), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$1 = N[(d1 * N[(d2 - d3), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[d4, 4.5e-292], t$95$1, If[LessEqual[d4, 1.15e-188], N[(d1 * N[((-d1) - d3), $MachinePrecision]), $MachinePrecision], If[LessEqual[d4, 3.8e-131], t$95$0, If[LessEqual[d4, 9.2e-97], t$95$1, If[LessEqual[d4, 6.6e+40], t$95$0, If[LessEqual[d4, 1.35e+118], N[(d1 * N[(d4 - d3), $MachinePrecision]), $MachinePrecision], N[(d1 * N[(d2 + d4), $MachinePrecision]), $MachinePrecision]]]]]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := d1 \cdot \left(d2 - d1\right)\\
t_1 := d1 \cdot \left(d2 - d3\right)\\
\mathbf{if}\;d4 \leq 4.5 \cdot 10^{-292}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;d4 \leq 1.15 \cdot 10^{-188}:\\
\;\;\;\;d1 \cdot \left(\left(-d1\right) - d3\right)\\
\mathbf{elif}\;d4 \leq 3.8 \cdot 10^{-131}:\\
\;\;\;\;t\_0\\
\mathbf{elif}\;d4 \leq 9.2 \cdot 10^{-97}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;d4 \leq 6.6 \cdot 10^{+40}:\\
\;\;\;\;t\_0\\
\mathbf{elif}\;d4 \leq 1.35 \cdot 10^{+118}:\\
\;\;\;\;d1 \cdot \left(d4 - d3\right)\\
\mathbf{else}:\\
\;\;\;\;d1 \cdot \left(d2 + d4\right)\\
\end{array}
\end{array}
if d4 < 4.49999999999999956e-292 or 3.79999999999999995e-131 < d4 < 9.19999999999999976e-97Initial program 92.6%
associate--l+92.6%
distribute-lft-out--93.3%
distribute-rgt-out--95.5%
distribute-lft-out99.9%
Simplified99.9%
Taylor expanded in d4 around 0 76.0%
+-commutative76.0%
associate--r+76.0%
Simplified76.0%
Taylor expanded in d1 around 0 57.7%
if 4.49999999999999956e-292 < d4 < 1.15e-188Initial program 92.2%
associate--l+92.2%
distribute-lft-out--92.3%
distribute-rgt-out--92.3%
distribute-lft-out100.0%
Simplified100.0%
Taylor expanded in d4 around 0 100.0%
+-commutative100.0%
associate--r+100.0%
Simplified100.0%
Taylor expanded in d2 around 0 79.6%
mul-1-neg79.6%
*-commutative79.6%
distribute-rgt-neg-in79.6%
Simplified79.6%
if 1.15e-188 < d4 < 3.79999999999999995e-131 or 9.19999999999999976e-97 < d4 < 6.5999999999999997e40Initial program 94.2%
associate--l+94.2%
distribute-lft-out--94.2%
distribute-rgt-out--94.2%
distribute-lft-out100.0%
Simplified100.0%
Taylor expanded in d4 around 0 88.6%
+-commutative88.6%
associate--r+88.6%
Simplified88.6%
Taylor expanded in d3 around 0 77.9%
if 6.5999999999999997e40 < d4 < 1.35e118Initial program 86.7%
associate--l+86.7%
distribute-lft-out--86.7%
distribute-rgt-out--86.7%
distribute-lft-out100.0%
Simplified100.0%
+-commutative100.0%
distribute-lft-in86.7%
Applied egg-rr86.7%
Taylor expanded in d1 around 0 87.4%
Taylor expanded in d2 around 0 68.2%
if 1.35e118 < d4 Initial program 77.3%
associate--l+77.3%
distribute-lft-out--77.3%
distribute-rgt-out--86.4%
distribute-lft-out100.0%
Simplified100.0%
+-commutative100.0%
distribute-lft-in86.4%
Applied egg-rr86.4%
Taylor expanded in d1 around 0 100.0%
Taylor expanded in d3 around 0 95.5%
+-commutative95.5%
Simplified95.5%
Final simplification69.8%
(FPCore (d1 d2 d3 d4)
:precision binary64
(let* ((t_0 (* d1 (- d2 d1))) (t_1 (* d1 (- d2 d3))))
(if (<= d4 6.8e-237)
t_1
(if (<= d4 4.4e-132)
t_0
(if (<= d4 4.2e-95) t_1 (if (<= d4 4.2e+57) t_0 (* d1 (+ d2 d4))))))))
double code(double d1, double d2, double d3, double d4) {
double t_0 = d1 * (d2 - d1);
double t_1 = d1 * (d2 - d3);
double tmp;
if (d4 <= 6.8e-237) {
tmp = t_1;
} else if (d4 <= 4.4e-132) {
tmp = t_0;
} else if (d4 <= 4.2e-95) {
tmp = t_1;
} else if (d4 <= 4.2e+57) {
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) :: t_1
real(8) :: tmp
t_0 = d1 * (d2 - d1)
t_1 = d1 * (d2 - d3)
if (d4 <= 6.8d-237) then
tmp = t_1
else if (d4 <= 4.4d-132) then
tmp = t_0
else if (d4 <= 4.2d-95) then
tmp = t_1
else if (d4 <= 4.2d+57) 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 t_1 = d1 * (d2 - d3);
double tmp;
if (d4 <= 6.8e-237) {
tmp = t_1;
} else if (d4 <= 4.4e-132) {
tmp = t_0;
} else if (d4 <= 4.2e-95) {
tmp = t_1;
} else if (d4 <= 4.2e+57) {
tmp = t_0;
} else {
tmp = d1 * (d2 + d4);
}
return tmp;
}
def code(d1, d2, d3, d4): t_0 = d1 * (d2 - d1) t_1 = d1 * (d2 - d3) tmp = 0 if d4 <= 6.8e-237: tmp = t_1 elif d4 <= 4.4e-132: tmp = t_0 elif d4 <= 4.2e-95: tmp = t_1 elif d4 <= 4.2e+57: tmp = t_0 else: tmp = d1 * (d2 + d4) return tmp
function code(d1, d2, d3, d4) t_0 = Float64(d1 * Float64(d2 - d1)) t_1 = Float64(d1 * Float64(d2 - d3)) tmp = 0.0 if (d4 <= 6.8e-237) tmp = t_1; elseif (d4 <= 4.4e-132) tmp = t_0; elseif (d4 <= 4.2e-95) tmp = t_1; elseif (d4 <= 4.2e+57) 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); t_1 = d1 * (d2 - d3); tmp = 0.0; if (d4 <= 6.8e-237) tmp = t_1; elseif (d4 <= 4.4e-132) tmp = t_0; elseif (d4 <= 4.2e-95) tmp = t_1; elseif (d4 <= 4.2e+57) 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]}, Block[{t$95$1 = N[(d1 * N[(d2 - d3), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[d4, 6.8e-237], t$95$1, If[LessEqual[d4, 4.4e-132], t$95$0, If[LessEqual[d4, 4.2e-95], t$95$1, If[LessEqual[d4, 4.2e+57], t$95$0, N[(d1 * N[(d2 + d4), $MachinePrecision]), $MachinePrecision]]]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := d1 \cdot \left(d2 - d1\right)\\
t_1 := d1 \cdot \left(d2 - d3\right)\\
\mathbf{if}\;d4 \leq 6.8 \cdot 10^{-237}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;d4 \leq 4.4 \cdot 10^{-132}:\\
\;\;\;\;t\_0\\
\mathbf{elif}\;d4 \leq 4.2 \cdot 10^{-95}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;d4 \leq 4.2 \cdot 10^{+57}:\\
\;\;\;\;t\_0\\
\mathbf{else}:\\
\;\;\;\;d1 \cdot \left(d2 + d4\right)\\
\end{array}
\end{array}
if d4 < 6.8000000000000005e-237 or 4.39999999999999981e-132 < d4 < 4.2e-95Initial program 93.1%
associate--l+93.1%
distribute-lft-out--93.8%
distribute-rgt-out--95.8%
distribute-lft-out99.9%
Simplified99.9%
Taylor expanded in d4 around 0 77.8%
+-commutative77.8%
associate--r+77.8%
Simplified77.8%
Taylor expanded in d1 around 0 56.8%
if 6.8000000000000005e-237 < d4 < 4.39999999999999981e-132 or 4.2e-95 < d4 < 4.19999999999999982e57Initial program 90.9%
associate--l+90.9%
distribute-lft-out--90.9%
distribute-rgt-out--90.9%
distribute-lft-out100.0%
Simplified100.0%
Taylor expanded in d4 around 0 90.5%
+-commutative90.5%
associate--r+90.5%
Simplified90.5%
Taylor expanded in d3 around 0 73.3%
if 4.19999999999999982e57 < d4 Initial program 79.6%
associate--l+79.6%
distribute-lft-out--79.6%
distribute-rgt-out--87.0%
distribute-lft-out100.0%
Simplified100.0%
+-commutative100.0%
distribute-lft-in87.0%
Applied egg-rr87.0%
Taylor expanded in d1 around 0 98.1%
Taylor expanded in d3 around 0 89.2%
+-commutative89.2%
Simplified89.2%
Final simplification67.2%
(FPCore (d1 d2 d3 d4)
:precision binary64
(let* ((t_0 (* d1 (- d2 d1))))
(if (<= d4 5.2e-106)
t_0
(if (<= d4 1.02e-98)
(* d1 (- d3))
(if (<= d4 1.85e+56) 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 <= 5.2e-106) {
tmp = t_0;
} else if (d4 <= 1.02e-98) {
tmp = d1 * -d3;
} else if (d4 <= 1.85e+56) {
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 <= 5.2d-106) then
tmp = t_0
else if (d4 <= 1.02d-98) then
tmp = d1 * -d3
else if (d4 <= 1.85d+56) 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 <= 5.2e-106) {
tmp = t_0;
} else if (d4 <= 1.02e-98) {
tmp = d1 * -d3;
} else if (d4 <= 1.85e+56) {
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 <= 5.2e-106: tmp = t_0 elif d4 <= 1.02e-98: tmp = d1 * -d3 elif d4 <= 1.85e+56: 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 <= 5.2e-106) tmp = t_0; elseif (d4 <= 1.02e-98) tmp = Float64(d1 * Float64(-d3)); elseif (d4 <= 1.85e+56) 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 <= 5.2e-106) tmp = t_0; elseif (d4 <= 1.02e-98) tmp = d1 * -d3; elseif (d4 <= 1.85e+56) 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, 5.2e-106], t$95$0, If[LessEqual[d4, 1.02e-98], N[(d1 * (-d3)), $MachinePrecision], If[LessEqual[d4, 1.85e+56], 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 5.2 \cdot 10^{-106}:\\
\;\;\;\;t\_0\\
\mathbf{elif}\;d4 \leq 1.02 \cdot 10^{-98}:\\
\;\;\;\;d1 \cdot \left(-d3\right)\\
\mathbf{elif}\;d4 \leq 1.85 \cdot 10^{+56}:\\
\;\;\;\;t\_0\\
\mathbf{else}:\\
\;\;\;\;d1 \cdot \left(d2 + d4\right)\\
\end{array}
\end{array}
if d4 < 5.2000000000000001e-106 or 1.02e-98 < d4 < 1.84999999999999998e56Initial program 92.4%
associate--l+92.4%
distribute-lft-out--92.9%
distribute-rgt-out--94.4%
distribute-lft-out100.0%
Simplified100.0%
Taylor expanded in d4 around 0 80.9%
+-commutative80.9%
associate--r+80.9%
Simplified80.9%
Taylor expanded in d3 around 0 58.4%
if 5.2000000000000001e-106 < d4 < 1.02e-98Initial 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 51.2%
mul-1-neg51.2%
distribute-rgt-neg-out51.2%
Simplified51.2%
if 1.84999999999999998e56 < d4 Initial program 79.6%
associate--l+79.6%
distribute-lft-out--79.6%
distribute-rgt-out--87.0%
distribute-lft-out100.0%
Simplified100.0%
+-commutative100.0%
distribute-lft-in87.0%
Applied egg-rr87.0%
Taylor expanded in d1 around 0 98.1%
Taylor expanded in d3 around 0 89.2%
+-commutative89.2%
Simplified89.2%
Final simplification64.7%
(FPCore (d1 d2 d3 d4)
:precision binary64
(if (<= d2 -1.3e+34)
(* d1 d2)
(if (or (<= d2 -3.85e-13) (not (<= d2 -4.3e-221)))
(* d1 d4)
(* d1 (- d3)))))
double code(double d1, double d2, double d3, double d4) {
double tmp;
if (d2 <= -1.3e+34) {
tmp = d1 * d2;
} else if ((d2 <= -3.85e-13) || !(d2 <= -4.3e-221)) {
tmp = d1 * d4;
} 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) :: tmp
if (d2 <= (-1.3d+34)) then
tmp = d1 * d2
else if ((d2 <= (-3.85d-13)) .or. (.not. (d2 <= (-4.3d-221)))) then
tmp = d1 * d4
else
tmp = d1 * -d3
end if
code = tmp
end function
public static double code(double d1, double d2, double d3, double d4) {
double tmp;
if (d2 <= -1.3e+34) {
tmp = d1 * d2;
} else if ((d2 <= -3.85e-13) || !(d2 <= -4.3e-221)) {
tmp = d1 * d4;
} else {
tmp = d1 * -d3;
}
return tmp;
}
def code(d1, d2, d3, d4): tmp = 0 if d2 <= -1.3e+34: tmp = d1 * d2 elif (d2 <= -3.85e-13) or not (d2 <= -4.3e-221): tmp = d1 * d4 else: tmp = d1 * -d3 return tmp
function code(d1, d2, d3, d4) tmp = 0.0 if (d2 <= -1.3e+34) tmp = Float64(d1 * d2); elseif ((d2 <= -3.85e-13) || !(d2 <= -4.3e-221)) tmp = Float64(d1 * d4); else tmp = Float64(d1 * Float64(-d3)); end return tmp end
function tmp_2 = code(d1, d2, d3, d4) tmp = 0.0; if (d2 <= -1.3e+34) tmp = d1 * d2; elseif ((d2 <= -3.85e-13) || ~((d2 <= -4.3e-221))) tmp = d1 * d4; else tmp = d1 * -d3; end tmp_2 = tmp; end
code[d1_, d2_, d3_, d4_] := If[LessEqual[d2, -1.3e+34], N[(d1 * d2), $MachinePrecision], If[Or[LessEqual[d2, -3.85e-13], N[Not[LessEqual[d2, -4.3e-221]], $MachinePrecision]], N[(d1 * d4), $MachinePrecision], N[(d1 * (-d3)), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;d2 \leq -1.3 \cdot 10^{+34}:\\
\;\;\;\;d1 \cdot d2\\
\mathbf{elif}\;d2 \leq -3.85 \cdot 10^{-13} \lor \neg \left(d2 \leq -4.3 \cdot 10^{-221}\right):\\
\;\;\;\;d1 \cdot d4\\
\mathbf{else}:\\
\;\;\;\;d1 \cdot \left(-d3\right)\\
\end{array}
\end{array}
if d2 < -1.29999999999999999e34Initial program 81.6%
associate--l+81.6%
distribute-lft-out--83.3%
distribute-rgt-out--86.6%
distribute-lft-out100.0%
Simplified100.0%
Taylor expanded in d2 around inf 54.6%
if -1.29999999999999999e34 < d2 < -3.8499999999999998e-13 or -4.2999999999999998e-221 < d2 Initial program 90.2%
associate--l+90.2%
distribute-lft-out--90.2%
distribute-rgt-out--93.4%
distribute-lft-out100.0%
Simplified100.0%
Taylor expanded in d4 around inf 37.7%
if -3.8499999999999998e-13 < d2 < -4.2999999999999998e-221Initial program 100.0%
associate--l+100.0%
distribute-lft-out--100.0%
distribute-rgt-out--100.0%
distribute-lft-out99.9%
Simplified99.9%
Taylor expanded in d3 around inf 33.2%
mul-1-neg33.2%
distribute-rgt-neg-out33.2%
Simplified33.2%
Final simplification40.9%
(FPCore (d1 d2 d3 d4) :precision binary64 (if (or (<= d3 -430000000.0) (not (<= d3 1.85e+70))) (* d1 (- (+ d2 d4) d3)) (* d1 (- (+ d2 d4) d1))))
double code(double d1, double d2, double d3, double d4) {
double tmp;
if ((d3 <= -430000000.0) || !(d3 <= 1.85e+70)) {
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 <= (-430000000.0d0)) .or. (.not. (d3 <= 1.85d+70))) 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 <= -430000000.0) || !(d3 <= 1.85e+70)) {
tmp = d1 * ((d2 + d4) - d3);
} else {
tmp = d1 * ((d2 + d4) - d1);
}
return tmp;
}
def code(d1, d2, d3, d4): tmp = 0 if (d3 <= -430000000.0) or not (d3 <= 1.85e+70): tmp = d1 * ((d2 + d4) - d3) else: tmp = d1 * ((d2 + d4) - d1) return tmp
function code(d1, d2, d3, d4) tmp = 0.0 if ((d3 <= -430000000.0) || !(d3 <= 1.85e+70)) 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 <= -430000000.0) || ~((d3 <= 1.85e+70))) 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, -430000000.0], N[Not[LessEqual[d3, 1.85e+70]], $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 -430000000 \lor \neg \left(d3 \leq 1.85 \cdot 10^{+70}\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 < -4.3e8 or 1.84999999999999994e70 < d3 Initial program 88.5%
associate--l+88.5%
distribute-lft-out--89.6%
distribute-rgt-out--92.7%
distribute-lft-out100.0%
Simplified100.0%
+-commutative100.0%
distribute-lft-in92.7%
Applied egg-rr92.7%
Taylor expanded in d1 around 0 95.9%
if -4.3e8 < d3 < 1.84999999999999994e70Initial program 90.6%
associate--l+90.6%
distribute-lft-out--90.6%
distribute-rgt-out--93.1%
distribute-lft-out100.0%
Simplified100.0%
Taylor expanded in d3 around 0 97.2%
Final simplification96.7%
(FPCore (d1 d2 d3 d4) :precision binary64 (if (<= d3 -1.45e+121) (* d1 (- d2 d3)) (if (<= d3 1.8e+94) (* d1 (- (+ d2 d4) d1)) (* d1 (- d4 d3)))))
double code(double d1, double d2, double d3, double d4) {
double tmp;
if (d3 <= -1.45e+121) {
tmp = d1 * (d2 - d3);
} else if (d3 <= 1.8e+94) {
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 <= (-1.45d+121)) then
tmp = d1 * (d2 - d3)
else if (d3 <= 1.8d+94) 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 <= -1.45e+121) {
tmp = d1 * (d2 - d3);
} else if (d3 <= 1.8e+94) {
tmp = d1 * ((d2 + d4) - d1);
} else {
tmp = d1 * (d4 - d3);
}
return tmp;
}
def code(d1, d2, d3, d4): tmp = 0 if d3 <= -1.45e+121: tmp = d1 * (d2 - d3) elif d3 <= 1.8e+94: tmp = d1 * ((d2 + d4) - d1) else: tmp = d1 * (d4 - d3) return tmp
function code(d1, d2, d3, d4) tmp = 0.0 if (d3 <= -1.45e+121) tmp = Float64(d1 * Float64(d2 - d3)); elseif (d3 <= 1.8e+94) 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 <= -1.45e+121) tmp = d1 * (d2 - d3); elseif (d3 <= 1.8e+94) tmp = d1 * ((d2 + d4) - d1); else tmp = d1 * (d4 - d3); end tmp_2 = tmp; end
code[d1_, d2_, d3_, d4_] := If[LessEqual[d3, -1.45e+121], N[(d1 * N[(d2 - d3), $MachinePrecision]), $MachinePrecision], If[LessEqual[d3, 1.8e+94], 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 -1.45 \cdot 10^{+121}:\\
\;\;\;\;d1 \cdot \left(d2 - d3\right)\\
\mathbf{elif}\;d3 \leq 1.8 \cdot 10^{+94}:\\
\;\;\;\;d1 \cdot \left(\left(d2 + d4\right) - d1\right)\\
\mathbf{else}:\\
\;\;\;\;d1 \cdot \left(d4 - d3\right)\\
\end{array}
\end{array}
if d3 < -1.45e121Initial program 96.7%
associate--l+96.7%
distribute-lft-out--96.7%
distribute-rgt-out--96.7%
distribute-lft-out99.9%
Simplified99.9%
Taylor expanded in d4 around 0 90.4%
+-commutative90.4%
associate--r+90.4%
Simplified90.4%
Taylor expanded in d1 around 0 90.4%
if -1.45e121 < d3 < 1.79999999999999996e94Initial program 89.8%
associate--l+89.8%
distribute-lft-out--90.3%
distribute-rgt-out--93.0%
distribute-lft-out100.0%
Simplified100.0%
Taylor expanded in d3 around 0 94.9%
if 1.79999999999999996e94 < d3 Initial program 84.6%
associate--l+84.6%
distribute-lft-out--84.6%
distribute-rgt-out--89.7%
distribute-lft-out100.0%
Simplified100.0%
+-commutative100.0%
distribute-lft-in89.7%
Applied egg-rr89.7%
Taylor expanded in d1 around 0 94.9%
Taylor expanded in d2 around 0 88.0%
(FPCore (d1 d2 d3 d4) :precision binary64 (if (or (<= d3 -6e+189) (not (<= d3 4.4e+178))) (* d1 (- d3)) (* d1 (+ d2 d4))))
double code(double d1, double d2, double d3, double d4) {
double tmp;
if ((d3 <= -6e+189) || !(d3 <= 4.4e+178)) {
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 <= (-6d+189)) .or. (.not. (d3 <= 4.4d+178))) 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 <= -6e+189) || !(d3 <= 4.4e+178)) {
tmp = d1 * -d3;
} else {
tmp = d1 * (d2 + d4);
}
return tmp;
}
def code(d1, d2, d3, d4): tmp = 0 if (d3 <= -6e+189) or not (d3 <= 4.4e+178): tmp = d1 * -d3 else: tmp = d1 * (d2 + d4) return tmp
function code(d1, d2, d3, d4) tmp = 0.0 if ((d3 <= -6e+189) || !(d3 <= 4.4e+178)) 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 <= -6e+189) || ~((d3 <= 4.4e+178))) tmp = d1 * -d3; else tmp = d1 * (d2 + d4); end tmp_2 = tmp; end
code[d1_, d2_, d3_, d4_] := If[Or[LessEqual[d3, -6e+189], N[Not[LessEqual[d3, 4.4e+178]], $MachinePrecision]], N[(d1 * (-d3)), $MachinePrecision], N[(d1 * N[(d2 + d4), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;d3 \leq -6 \cdot 10^{+189} \lor \neg \left(d3 \leq 4.4 \cdot 10^{+178}\right):\\
\;\;\;\;d1 \cdot \left(-d3\right)\\
\mathbf{else}:\\
\;\;\;\;d1 \cdot \left(d2 + d4\right)\\
\end{array}
\end{array}
if d3 < -5.9999999999999996e189 or 4.39999999999999994e178 < d3 Initial program 89.6%
associate--l+89.6%
distribute-lft-out--89.6%
distribute-rgt-out--91.7%
distribute-lft-out100.0%
Simplified100.0%
Taylor expanded in d3 around inf 79.9%
mul-1-neg79.9%
distribute-rgt-neg-out79.9%
Simplified79.9%
if -5.9999999999999996e189 < d3 < 4.39999999999999994e178Initial program 89.9%
associate--l+89.9%
distribute-lft-out--90.3%
distribute-rgt-out--93.2%
distribute-lft-out100.0%
Simplified100.0%
+-commutative100.0%
distribute-lft-in93.2%
Applied egg-rr93.2%
Taylor expanded in d1 around 0 79.1%
Taylor expanded in d3 around 0 70.9%
+-commutative70.9%
Simplified70.9%
Final simplification72.6%
(FPCore (d1 d2 d3 d4) :precision binary64 (if (<= d2 -1.02e+34) (* d1 (- d2 d3)) (if (<= d2 -3.4e-170) (* d1 (- d4 d3)) (* d1 (- d4 d1)))))
double code(double d1, double d2, double d3, double d4) {
double tmp;
if (d2 <= -1.02e+34) {
tmp = d1 * (d2 - d3);
} else if (d2 <= -3.4e-170) {
tmp = d1 * (d4 - d3);
} else {
tmp = d1 * (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 (d2 <= (-1.02d+34)) then
tmp = d1 * (d2 - d3)
else if (d2 <= (-3.4d-170)) then
tmp = d1 * (d4 - d3)
else
tmp = d1 * (d4 - d1)
end if
code = tmp
end function
public static double code(double d1, double d2, double d3, double d4) {
double tmp;
if (d2 <= -1.02e+34) {
tmp = d1 * (d2 - d3);
} else if (d2 <= -3.4e-170) {
tmp = d1 * (d4 - d3);
} else {
tmp = d1 * (d4 - d1);
}
return tmp;
}
def code(d1, d2, d3, d4): tmp = 0 if d2 <= -1.02e+34: tmp = d1 * (d2 - d3) elif d2 <= -3.4e-170: tmp = d1 * (d4 - d3) else: tmp = d1 * (d4 - d1) return tmp
function code(d1, d2, d3, d4) tmp = 0.0 if (d2 <= -1.02e+34) tmp = Float64(d1 * Float64(d2 - d3)); elseif (d2 <= -3.4e-170) tmp = Float64(d1 * Float64(d4 - d3)); else tmp = Float64(d1 * Float64(d4 - d1)); end return tmp end
function tmp_2 = code(d1, d2, d3, d4) tmp = 0.0; if (d2 <= -1.02e+34) tmp = d1 * (d2 - d3); elseif (d2 <= -3.4e-170) tmp = d1 * (d4 - d3); else tmp = d1 * (d4 - d1); end tmp_2 = tmp; end
code[d1_, d2_, d3_, d4_] := If[LessEqual[d2, -1.02e+34], N[(d1 * N[(d2 - d3), $MachinePrecision]), $MachinePrecision], If[LessEqual[d2, -3.4e-170], N[(d1 * N[(d4 - d3), $MachinePrecision]), $MachinePrecision], N[(d1 * N[(d4 - d1), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;d2 \leq -1.02 \cdot 10^{+34}:\\
\;\;\;\;d1 \cdot \left(d2 - d3\right)\\
\mathbf{elif}\;d2 \leq -3.4 \cdot 10^{-170}:\\
\;\;\;\;d1 \cdot \left(d4 - d3\right)\\
\mathbf{else}:\\
\;\;\;\;d1 \cdot \left(d4 - d1\right)\\
\end{array}
\end{array}
if d2 < -1.02e34Initial program 81.6%
associate--l+81.6%
distribute-lft-out--83.3%
distribute-rgt-out--86.6%
distribute-lft-out100.0%
Simplified100.0%
Taylor expanded in d4 around 0 81.9%
+-commutative81.9%
associate--r+81.9%
Simplified81.9%
Taylor expanded in d1 around 0 72.2%
if -1.02e34 < d2 < -3.40000000000000013e-170Initial 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 d1 around 0 78.8%
Taylor expanded in d2 around 0 76.3%
if -3.40000000000000013e-170 < d2 Initial program 90.3%
associate--l+90.3%
distribute-lft-out--90.3%
distribute-rgt-out--93.5%
distribute-lft-out100.0%
Simplified100.0%
Taylor expanded in d3 around 0 79.2%
Taylor expanded in d2 around 0 58.7%
(FPCore (d1 d2 d3 d4) :precision binary64 (if (<= d4 6e+55) (* d1 (- (- d2 d3) d1)) (* d1 (- (+ d2 d4) d3))))
double code(double d1, double d2, double d3, double d4) {
double tmp;
if (d4 <= 6e+55) {
tmp = d1 * ((d2 - d3) - d1);
} 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 <= 6d+55) then
tmp = d1 * ((d2 - d3) - d1)
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 <= 6e+55) {
tmp = d1 * ((d2 - d3) - d1);
} else {
tmp = d1 * ((d2 + d4) - d3);
}
return tmp;
}
def code(d1, d2, d3, d4): tmp = 0 if d4 <= 6e+55: tmp = d1 * ((d2 - d3) - d1) else: tmp = d1 * ((d2 + d4) - d3) return tmp
function code(d1, d2, d3, d4) tmp = 0.0 if (d4 <= 6e+55) tmp = Float64(d1 * Float64(Float64(d2 - d3) - d1)); 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 <= 6e+55) tmp = d1 * ((d2 - d3) - d1); else tmp = d1 * ((d2 + d4) - d3); end tmp_2 = tmp; end
code[d1_, d2_, d3_, d4_] := If[LessEqual[d4, 6e+55], N[(d1 * N[(N[(d2 - d3), $MachinePrecision] - d1), $MachinePrecision]), $MachinePrecision], N[(d1 * N[(N[(d2 + d4), $MachinePrecision] - d3), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;d4 \leq 6 \cdot 10^{+55}:\\
\;\;\;\;d1 \cdot \left(\left(d2 - d3\right) - d1\right)\\
\mathbf{else}:\\
\;\;\;\;d1 \cdot \left(\left(d2 + d4\right) - d3\right)\\
\end{array}
\end{array}
if d4 < 6.00000000000000033e55Initial program 92.5%
associate--l+92.5%
distribute-lft-out--93.0%
distribute-rgt-out--94.5%
distribute-lft-out100.0%
Simplified100.0%
Taylor expanded in d4 around 0 81.2%
+-commutative81.2%
associate--r+81.2%
Simplified81.2%
if 6.00000000000000033e55 < d4 Initial program 79.6%
associate--l+79.6%
distribute-lft-out--79.6%
distribute-rgt-out--87.0%
distribute-lft-out100.0%
Simplified100.0%
+-commutative100.0%
distribute-lft-in87.0%
Applied egg-rr87.0%
Taylor expanded in d1 around 0 98.1%
(FPCore (d1 d2 d3 d4) :precision binary64 (if (<= d2 -1.3e+34) (* d1 d2) (* d1 d4)))
double code(double d1, double d2, double d3, double d4) {
double tmp;
if (d2 <= -1.3e+34) {
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.3d+34)) 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.3e+34) {
tmp = d1 * d2;
} else {
tmp = d1 * d4;
}
return tmp;
}
def code(d1, d2, d3, d4): tmp = 0 if d2 <= -1.3e+34: tmp = d1 * d2 else: tmp = d1 * d4 return tmp
function code(d1, d2, d3, d4) tmp = 0.0 if (d2 <= -1.3e+34) 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.3e+34) tmp = d1 * d2; else tmp = d1 * d4; end tmp_2 = tmp; end
code[d1_, d2_, d3_, d4_] := If[LessEqual[d2, -1.3e+34], N[(d1 * d2), $MachinePrecision], N[(d1 * d4), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;d2 \leq -1.3 \cdot 10^{+34}:\\
\;\;\;\;d1 \cdot d2\\
\mathbf{else}:\\
\;\;\;\;d1 \cdot d4\\
\end{array}
\end{array}
if d2 < -1.29999999999999999e34Initial program 81.6%
associate--l+81.6%
distribute-lft-out--83.3%
distribute-rgt-out--86.6%
distribute-lft-out100.0%
Simplified100.0%
Taylor expanded in d2 around inf 54.6%
if -1.29999999999999999e34 < d2 Initial program 92.3%
associate--l+92.3%
distribute-lft-out--92.3%
distribute-rgt-out--94.9%
distribute-lft-out100.0%
Simplified100.0%
Taylor expanded in d4 around inf 38.4%
(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 89.8%
associate--l+89.8%
distribute-lft-out--90.2%
distribute-rgt-out--92.9%
distribute-lft-out100.0%
Simplified100.0%
Taylor expanded in d2 around inf 31.8%
(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 2024086
(FPCore (d1 d2 d3 d4)
:name "FastMath dist4"
:precision binary64
:alt
(* d1 (- (+ (- d2 d3) d4) d1))
(- (+ (- (* d1 d2) (* d1 d3)) (* d4 d1)) (* d1 d1)))