
(FPCore (d1 d2 d3 d4) :precision binary64 (- (+ (- (* d1 d2) (* d1 d3)) (* d4 d1)) (* d1 d1)))
double code(double d1, double d2, double d3, double d4) {
return (((d1 * d2) - (d1 * d3)) + (d4 * d1)) - (d1 * d1);
}
real(8) function code(d1, d2, d3, d4)
real(8), intent (in) :: d1
real(8), intent (in) :: d2
real(8), intent (in) :: d3
real(8), intent (in) :: d4
code = (((d1 * d2) - (d1 * d3)) + (d4 * d1)) - (d1 * d1)
end function
public static double code(double d1, double d2, double d3, double d4) {
return (((d1 * d2) - (d1 * d3)) + (d4 * d1)) - (d1 * d1);
}
def code(d1, d2, d3, d4): return (((d1 * d2) - (d1 * d3)) + (d4 * d1)) - (d1 * d1)
function code(d1, d2, d3, d4) return Float64(Float64(Float64(Float64(d1 * d2) - Float64(d1 * d3)) + Float64(d4 * d1)) - Float64(d1 * d1)) end
function tmp = code(d1, d2, d3, d4) tmp = (((d1 * d2) - (d1 * d3)) + (d4 * d1)) - (d1 * d1); end
code[d1_, d2_, d3_, d4_] := N[(N[(N[(N[(d1 * d2), $MachinePrecision] - N[(d1 * d3), $MachinePrecision]), $MachinePrecision] + N[(d4 * d1), $MachinePrecision]), $MachinePrecision] - N[(d1 * d1), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
\left(\left(d1 \cdot d2 - d1 \cdot d3\right) + d4 \cdot d1\right) - d1 \cdot d1
\end{array}
Sampling outcomes in binary64 precision:
Herbie found 13 alternatives:
| Alternative | Accuracy | Speedup |
|---|
(FPCore (d1 d2 d3 d4) :precision binary64 (- (+ (- (* d1 d2) (* d1 d3)) (* d4 d1)) (* d1 d1)))
double code(double d1, double d2, double d3, double d4) {
return (((d1 * d2) - (d1 * d3)) + (d4 * d1)) - (d1 * d1);
}
real(8) function code(d1, d2, d3, d4)
real(8), intent (in) :: d1
real(8), intent (in) :: d2
real(8), intent (in) :: d3
real(8), intent (in) :: d4
code = (((d1 * d2) - (d1 * d3)) + (d4 * d1)) - (d1 * d1)
end function
public static double code(double d1, double d2, double d3, double d4) {
return (((d1 * d2) - (d1 * d3)) + (d4 * d1)) - (d1 * d1);
}
def code(d1, d2, d3, d4): return (((d1 * d2) - (d1 * d3)) + (d4 * d1)) - (d1 * d1)
function code(d1, d2, d3, d4) return Float64(Float64(Float64(Float64(d1 * d2) - Float64(d1 * d3)) + Float64(d4 * d1)) - Float64(d1 * d1)) end
function tmp = code(d1, d2, d3, d4) tmp = (((d1 * d2) - (d1 * d3)) + (d4 * d1)) - (d1 * d1); end
code[d1_, d2_, d3_, d4_] := N[(N[(N[(N[(d1 * d2), $MachinePrecision] - N[(d1 * d3), $MachinePrecision]), $MachinePrecision] + N[(d4 * d1), $MachinePrecision]), $MachinePrecision] - N[(d1 * d1), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
\left(\left(d1 \cdot d2 - d1 \cdot d3\right) + d4 \cdot d1\right) - d1 \cdot d1
\end{array}
(FPCore (d1 d2 d3 d4) :precision binary64 (* d1 (+ (- d2 d3) (- d4 d1))))
double code(double d1, double d2, double d3, double d4) {
return d1 * ((d2 - d3) + (d4 - d1));
}
real(8) function code(d1, d2, d3, d4)
real(8), intent (in) :: d1
real(8), intent (in) :: d2
real(8), intent (in) :: d3
real(8), intent (in) :: d4
code = d1 * ((d2 - d3) + (d4 - d1))
end function
public static double code(double d1, double d2, double d3, double d4) {
return d1 * ((d2 - d3) + (d4 - d1));
}
def code(d1, d2, d3, d4): return d1 * ((d2 - d3) + (d4 - d1))
function code(d1, d2, d3, d4) return Float64(d1 * Float64(Float64(d2 - d3) + Float64(d4 - d1))) end
function tmp = code(d1, d2, d3, d4) tmp = d1 * ((d2 - d3) + (d4 - d1)); end
code[d1_, d2_, d3_, d4_] := N[(d1 * N[(N[(d2 - d3), $MachinePrecision] + N[(d4 - d1), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
d1 \cdot \left(\left(d2 - d3\right) + \left(d4 - d1\right)\right)
\end{array}
Initial program 86.3%
associate--l+86.3%
distribute-lft-out--87.1%
distribute-rgt-out--91.4%
distribute-lft-out100.0%
Simplified100.0%
Final simplification100.0%
(FPCore (d1 d2 d3 d4)
:precision binary64
(let* ((t_0 (* d1 (- (+ d2 d4) d1))) (t_1 (* d1 (- (- d2 d3) d1))))
(if (<= d4 2e+68)
t_1
(if (<= d4 2.55e+132)
t_0
(if (<= d4 1.9e+162)
t_1
(if (<= d4 1.15e+236) (* d1 (- (+ d2 d4) d3)) t_0))))))
double code(double d1, double d2, double d3, double d4) {
double t_0 = d1 * ((d2 + d4) - d1);
double t_1 = d1 * ((d2 - d3) - d1);
double tmp;
if (d4 <= 2e+68) {
tmp = t_1;
} else if (d4 <= 2.55e+132) {
tmp = t_0;
} else if (d4 <= 1.9e+162) {
tmp = t_1;
} else if (d4 <= 1.15e+236) {
tmp = d1 * ((d2 + d4) - d3);
} 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 * ((d2 + d4) - d1)
t_1 = d1 * ((d2 - d3) - d1)
if (d4 <= 2d+68) then
tmp = t_1
else if (d4 <= 2.55d+132) then
tmp = t_0
else if (d4 <= 1.9d+162) then
tmp = t_1
else if (d4 <= 1.15d+236) then
tmp = d1 * ((d2 + d4) - d3)
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 + d4) - d1);
double t_1 = d1 * ((d2 - d3) - d1);
double tmp;
if (d4 <= 2e+68) {
tmp = t_1;
} else if (d4 <= 2.55e+132) {
tmp = t_0;
} else if (d4 <= 1.9e+162) {
tmp = t_1;
} else if (d4 <= 1.15e+236) {
tmp = d1 * ((d2 + d4) - d3);
} else {
tmp = t_0;
}
return tmp;
}
def code(d1, d2, d3, d4): t_0 = d1 * ((d2 + d4) - d1) t_1 = d1 * ((d2 - d3) - d1) tmp = 0 if d4 <= 2e+68: tmp = t_1 elif d4 <= 2.55e+132: tmp = t_0 elif d4 <= 1.9e+162: tmp = t_1 elif d4 <= 1.15e+236: tmp = d1 * ((d2 + d4) - d3) else: tmp = t_0 return tmp
function code(d1, d2, d3, d4) t_0 = Float64(d1 * Float64(Float64(d2 + d4) - d1)) t_1 = Float64(d1 * Float64(Float64(d2 - d3) - d1)) tmp = 0.0 if (d4 <= 2e+68) tmp = t_1; elseif (d4 <= 2.55e+132) tmp = t_0; elseif (d4 <= 1.9e+162) tmp = t_1; elseif (d4 <= 1.15e+236) tmp = Float64(d1 * Float64(Float64(d2 + d4) - d3)); else tmp = t_0; end return tmp end
function tmp_2 = code(d1, d2, d3, d4) t_0 = d1 * ((d2 + d4) - d1); t_1 = d1 * ((d2 - d3) - d1); tmp = 0.0; if (d4 <= 2e+68) tmp = t_1; elseif (d4 <= 2.55e+132) tmp = t_0; elseif (d4 <= 1.9e+162) tmp = t_1; elseif (d4 <= 1.15e+236) tmp = d1 * ((d2 + d4) - d3); else tmp = t_0; end tmp_2 = tmp; end
code[d1_, d2_, d3_, d4_] := Block[{t$95$0 = N[(d1 * N[(N[(d2 + d4), $MachinePrecision] - d1), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$1 = N[(d1 * N[(N[(d2 - d3), $MachinePrecision] - d1), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[d4, 2e+68], t$95$1, If[LessEqual[d4, 2.55e+132], t$95$0, If[LessEqual[d4, 1.9e+162], t$95$1, If[LessEqual[d4, 1.15e+236], N[(d1 * N[(N[(d2 + d4), $MachinePrecision] - d3), $MachinePrecision]), $MachinePrecision], t$95$0]]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := d1 \cdot \left(\left(d2 + d4\right) - d1\right)\\
t_1 := d1 \cdot \left(\left(d2 - d3\right) - d1\right)\\
\mathbf{if}\;d4 \leq 2 \cdot 10^{+68}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;d4 \leq 2.55 \cdot 10^{+132}:\\
\;\;\;\;t\_0\\
\mathbf{elif}\;d4 \leq 1.9 \cdot 10^{+162}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;d4 \leq 1.15 \cdot 10^{+236}:\\
\;\;\;\;d1 \cdot \left(\left(d2 + d4\right) - d3\right)\\
\mathbf{else}:\\
\;\;\;\;t\_0\\
\end{array}
\end{array}
if d4 < 1.99999999999999991e68 or 2.55e132 < d4 < 1.90000000000000012e162Initial program 87.9%
associate--l+87.9%
distribute-lft-out--88.4%
distribute-rgt-out--91.1%
distribute-lft-out100.0%
Simplified100.0%
Taylor expanded in d4 around 0 87.0%
+-commutative87.0%
associate--r+87.0%
Simplified87.0%
if 1.99999999999999991e68 < d4 < 2.55e132 or 1.15e236 < d4 Initial program 68.0%
associate--l+68.0%
distribute-lft-out--68.0%
distribute-rgt-out--88.0%
distribute-lft-out100.0%
Simplified100.0%
Taylor expanded in d3 around 0 100.0%
if 1.90000000000000012e162 < d4 < 1.15e236Initial program 93.8%
associate--l+93.8%
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 100.0%
Final simplification89.1%
(FPCore (d1 d2 d3 d4)
:precision binary64
(let* ((t_0 (* d1 (- d2 d3))))
(if (<= d2 -2.8e+102)
t_0
(if (<= d2 -2.6e+25)
(* d1 (- d2 d1))
(if (<= d2 -4300000000000.0)
t_0
(if (<= d2 -6.6e-203) (* d1 (- (- d3) d1)) (* d1 (- d4 d1))))))))
double code(double d1, double d2, double d3, double d4) {
double t_0 = d1 * (d2 - d3);
double tmp;
if (d2 <= -2.8e+102) {
tmp = t_0;
} else if (d2 <= -2.6e+25) {
tmp = d1 * (d2 - d1);
} else if (d2 <= -4300000000000.0) {
tmp = t_0;
} else if (d2 <= -6.6e-203) {
tmp = d1 * (-d3 - d1);
} 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) :: t_0
real(8) :: tmp
t_0 = d1 * (d2 - d3)
if (d2 <= (-2.8d+102)) then
tmp = t_0
else if (d2 <= (-2.6d+25)) then
tmp = d1 * (d2 - d1)
else if (d2 <= (-4300000000000.0d0)) then
tmp = t_0
else if (d2 <= (-6.6d-203)) then
tmp = d1 * (-d3 - d1)
else
tmp = d1 * (d4 - d1)
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 (d2 <= -2.8e+102) {
tmp = t_0;
} else if (d2 <= -2.6e+25) {
tmp = d1 * (d2 - d1);
} else if (d2 <= -4300000000000.0) {
tmp = t_0;
} else if (d2 <= -6.6e-203) {
tmp = d1 * (-d3 - d1);
} else {
tmp = d1 * (d4 - d1);
}
return tmp;
}
def code(d1, d2, d3, d4): t_0 = d1 * (d2 - d3) tmp = 0 if d2 <= -2.8e+102: tmp = t_0 elif d2 <= -2.6e+25: tmp = d1 * (d2 - d1) elif d2 <= -4300000000000.0: tmp = t_0 elif d2 <= -6.6e-203: tmp = d1 * (-d3 - d1) else: tmp = d1 * (d4 - d1) return tmp
function code(d1, d2, d3, d4) t_0 = Float64(d1 * Float64(d2 - d3)) tmp = 0.0 if (d2 <= -2.8e+102) tmp = t_0; elseif (d2 <= -2.6e+25) tmp = Float64(d1 * Float64(d2 - d1)); elseif (d2 <= -4300000000000.0) tmp = t_0; elseif (d2 <= -6.6e-203) tmp = Float64(d1 * Float64(Float64(-d3) - d1)); else tmp = Float64(d1 * Float64(d4 - d1)); end return tmp end
function tmp_2 = code(d1, d2, d3, d4) t_0 = d1 * (d2 - d3); tmp = 0.0; if (d2 <= -2.8e+102) tmp = t_0; elseif (d2 <= -2.6e+25) tmp = d1 * (d2 - d1); elseif (d2 <= -4300000000000.0) tmp = t_0; elseif (d2 <= -6.6e-203) tmp = d1 * (-d3 - d1); else tmp = d1 * (d4 - d1); end tmp_2 = tmp; end
code[d1_, d2_, d3_, d4_] := Block[{t$95$0 = N[(d1 * N[(d2 - d3), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[d2, -2.8e+102], t$95$0, If[LessEqual[d2, -2.6e+25], N[(d1 * N[(d2 - d1), $MachinePrecision]), $MachinePrecision], If[LessEqual[d2, -4300000000000.0], t$95$0, If[LessEqual[d2, -6.6e-203], N[(d1 * N[((-d3) - d1), $MachinePrecision]), $MachinePrecision], N[(d1 * N[(d4 - d1), $MachinePrecision]), $MachinePrecision]]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := d1 \cdot \left(d2 - d3\right)\\
\mathbf{if}\;d2 \leq -2.8 \cdot 10^{+102}:\\
\;\;\;\;t\_0\\
\mathbf{elif}\;d2 \leq -2.6 \cdot 10^{+25}:\\
\;\;\;\;d1 \cdot \left(d2 - d1\right)\\
\mathbf{elif}\;d2 \leq -4300000000000:\\
\;\;\;\;t\_0\\
\mathbf{elif}\;d2 \leq -6.6 \cdot 10^{-203}:\\
\;\;\;\;d1 \cdot \left(\left(-d3\right) - d1\right)\\
\mathbf{else}:\\
\;\;\;\;d1 \cdot \left(d4 - d1\right)\\
\end{array}
\end{array}
if d2 < -2.80000000000000018e102 or -2.5999999999999998e25 < d2 < -4.3e12Initial program 83.9%
associate--l+83.9%
distribute-lft-out--88.0%
distribute-rgt-out--92.0%
distribute-lft-out100.0%
Simplified100.0%
Taylor expanded in d4 around 0 83.2%
+-commutative83.2%
associate--r+83.2%
Simplified83.2%
Taylor expanded in d1 around 0 79.2%
if -2.80000000000000018e102 < d2 < -2.5999999999999998e25Initial program 88.2%
associate--l+88.2%
distribute-lft-out--88.2%
distribute-rgt-out--88.2%
distribute-lft-out99.9%
Simplified99.9%
Taylor expanded in d4 around 0 77.3%
+-commutative77.3%
associate--r+77.3%
Simplified77.3%
Taylor expanded in d3 around 0 54.4%
if -4.3e12 < d2 < -6.60000000000000047e-203Initial program 95.6%
associate--l+95.6%
distribute-lft-out--95.6%
distribute-rgt-out--97.8%
distribute-lft-out100.0%
Simplified100.0%
Taylor expanded in d4 around 0 74.6%
+-commutative74.6%
associate--r+74.6%
Simplified74.6%
Taylor expanded in d2 around 0 73.6%
associate-*r*73.6%
neg-mul-173.6%
Simplified73.6%
if -6.60000000000000047e-203 < d2 Initial program 84.0%
associate--l+84.0%
distribute-lft-out--84.0%
distribute-rgt-out--89.6%
distribute-lft-out100.0%
Simplified100.0%
Taylor expanded in d2 around 0 81.7%
associate--r+81.7%
Simplified81.7%
Taylor expanded in d3 around 0 61.2%
Final simplification66.4%
(FPCore (d1 d2 d3 d4)
:precision binary64
(let* ((t_0 (* d1 (- d2 d1))) (t_1 (* d1 (- d2 d3))))
(if (<= d4 -2.6e+26)
t_1
(if (<= d4 -2.2e-180)
t_0
(if (<= d4 3e-126) t_1 (if (<= d4 1.7e+162) 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 <= -2.6e+26) {
tmp = t_1;
} else if (d4 <= -2.2e-180) {
tmp = t_0;
} else if (d4 <= 3e-126) {
tmp = t_1;
} else if (d4 <= 1.7e+162) {
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 <= (-2.6d+26)) then
tmp = t_1
else if (d4 <= (-2.2d-180)) then
tmp = t_0
else if (d4 <= 3d-126) then
tmp = t_1
else if (d4 <= 1.7d+162) 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 <= -2.6e+26) {
tmp = t_1;
} else if (d4 <= -2.2e-180) {
tmp = t_0;
} else if (d4 <= 3e-126) {
tmp = t_1;
} else if (d4 <= 1.7e+162) {
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 <= -2.6e+26: tmp = t_1 elif d4 <= -2.2e-180: tmp = t_0 elif d4 <= 3e-126: tmp = t_1 elif d4 <= 1.7e+162: 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 <= -2.6e+26) tmp = t_1; elseif (d4 <= -2.2e-180) tmp = t_0; elseif (d4 <= 3e-126) tmp = t_1; elseif (d4 <= 1.7e+162) 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 <= -2.6e+26) tmp = t_1; elseif (d4 <= -2.2e-180) tmp = t_0; elseif (d4 <= 3e-126) tmp = t_1; elseif (d4 <= 1.7e+162) 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, -2.6e+26], t$95$1, If[LessEqual[d4, -2.2e-180], t$95$0, If[LessEqual[d4, 3e-126], t$95$1, If[LessEqual[d4, 1.7e+162], 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 -2.6 \cdot 10^{+26}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;d4 \leq -2.2 \cdot 10^{-180}:\\
\;\;\;\;t\_0\\
\mathbf{elif}\;d4 \leq 3 \cdot 10^{-126}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;d4 \leq 1.7 \cdot 10^{+162}:\\
\;\;\;\;t\_0\\
\mathbf{else}:\\
\;\;\;\;d1 \cdot \left(d2 + d4\right)\\
\end{array}
\end{array}
if d4 < -2.60000000000000002e26 or -2.20000000000000013e-180 < d4 < 3.0000000000000002e-126Initial program 87.5%
associate--l+87.5%
distribute-lft-out--87.5%
distribute-rgt-out--90.8%
distribute-lft-out100.0%
Simplified100.0%
Taylor expanded in d4 around 0 80.7%
+-commutative80.7%
associate--r+80.7%
Simplified80.7%
Taylor expanded in d1 around 0 54.3%
if -2.60000000000000002e26 < d4 < -2.20000000000000013e-180 or 3.0000000000000002e-126 < d4 < 1.70000000000000001e162Initial program 85.4%
associate--l+85.4%
distribute-lft-out--86.4%
distribute-rgt-out--90.3%
distribute-lft-out100.0%
Simplified100.0%
Taylor expanded in d4 around 0 92.7%
+-commutative92.7%
associate--r+92.7%
Simplified92.7%
Taylor expanded in d3 around 0 65.4%
if 1.70000000000000001e162 < d4 Initial program 84.8%
associate--l+84.8%
distribute-lft-out--87.9%
distribute-rgt-out--97.0%
distribute-lft-out100.0%
Simplified100.0%
+-commutative100.0%
distribute-lft-in97.0%
Applied egg-rr97.0%
Taylor expanded in d1 around 0 100.0%
Taylor expanded in d3 around 0 88.6%
+-commutative88.6%
Simplified88.6%
Final simplification63.2%
(FPCore (d1 d2 d3 d4)
:precision binary64
(let* ((t_0 (* d1 (- d2 d1))) (t_1 (* d1 (- d2 d3))))
(if (<= d4 -7.6e+27)
t_1
(if (<= d4 -2.3e-176)
t_0
(if (<= d4 1.8e-126)
t_1
(if (<= d4 1.06e+111) t_0 (* d1 (- d4 d1))))))))
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 <= -7.6e+27) {
tmp = t_1;
} else if (d4 <= -2.3e-176) {
tmp = t_0;
} else if (d4 <= 1.8e-126) {
tmp = t_1;
} else if (d4 <= 1.06e+111) {
tmp = t_0;
} 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) :: t_0
real(8) :: t_1
real(8) :: tmp
t_0 = d1 * (d2 - d1)
t_1 = d1 * (d2 - d3)
if (d4 <= (-7.6d+27)) then
tmp = t_1
else if (d4 <= (-2.3d-176)) then
tmp = t_0
else if (d4 <= 1.8d-126) then
tmp = t_1
else if (d4 <= 1.06d+111) then
tmp = t_0
else
tmp = d1 * (d4 - d1)
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 <= -7.6e+27) {
tmp = t_1;
} else if (d4 <= -2.3e-176) {
tmp = t_0;
} else if (d4 <= 1.8e-126) {
tmp = t_1;
} else if (d4 <= 1.06e+111) {
tmp = t_0;
} else {
tmp = d1 * (d4 - d1);
}
return tmp;
}
def code(d1, d2, d3, d4): t_0 = d1 * (d2 - d1) t_1 = d1 * (d2 - d3) tmp = 0 if d4 <= -7.6e+27: tmp = t_1 elif d4 <= -2.3e-176: tmp = t_0 elif d4 <= 1.8e-126: tmp = t_1 elif d4 <= 1.06e+111: tmp = t_0 else: tmp = d1 * (d4 - d1) 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 <= -7.6e+27) tmp = t_1; elseif (d4 <= -2.3e-176) tmp = t_0; elseif (d4 <= 1.8e-126) tmp = t_1; elseif (d4 <= 1.06e+111) tmp = t_0; else tmp = Float64(d1 * Float64(d4 - d1)); 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 <= -7.6e+27) tmp = t_1; elseif (d4 <= -2.3e-176) tmp = t_0; elseif (d4 <= 1.8e-126) tmp = t_1; elseif (d4 <= 1.06e+111) tmp = t_0; else tmp = d1 * (d4 - d1); 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, -7.6e+27], t$95$1, If[LessEqual[d4, -2.3e-176], t$95$0, If[LessEqual[d4, 1.8e-126], t$95$1, If[LessEqual[d4, 1.06e+111], t$95$0, N[(d1 * N[(d4 - d1), $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 -7.6 \cdot 10^{+27}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;d4 \leq -2.3 \cdot 10^{-176}:\\
\;\;\;\;t\_0\\
\mathbf{elif}\;d4 \leq 1.8 \cdot 10^{-126}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;d4 \leq 1.06 \cdot 10^{+111}:\\
\;\;\;\;t\_0\\
\mathbf{else}:\\
\;\;\;\;d1 \cdot \left(d4 - d1\right)\\
\end{array}
\end{array}
if d4 < -7.60000000000000043e27 or -2.3000000000000001e-176 < d4 < 1.8e-126Initial program 87.5%
associate--l+87.5%
distribute-lft-out--87.5%
distribute-rgt-out--90.8%
distribute-lft-out100.0%
Simplified100.0%
Taylor expanded in d4 around 0 80.7%
+-commutative80.7%
associate--r+80.7%
Simplified80.7%
Taylor expanded in d1 around 0 54.3%
if -7.60000000000000043e27 < d4 < -2.3000000000000001e-176 or 1.8e-126 < d4 < 1.06e111Initial program 87.2%
associate--l+87.2%
distribute-lft-out--88.3%
distribute-rgt-out--90.4%
distribute-lft-out100.0%
Simplified100.0%
Taylor expanded in d4 around 0 93.0%
+-commutative93.0%
associate--r+93.0%
Simplified93.0%
Taylor expanded in d3 around 0 65.1%
if 1.06e111 < d4 Initial program 81.0%
associate--l+81.0%
distribute-lft-out--83.3%
distribute-rgt-out--95.2%
distribute-lft-out100.0%
Simplified100.0%
Taylor expanded in d2 around 0 89.7%
associate--r+89.7%
Simplified89.7%
Taylor expanded in d3 around 0 78.4%
Final simplification62.2%
(FPCore (d1 d2 d3 d4)
:precision binary64
(let* ((t_0 (* d1 (- d2 d1))))
(if (<= d4 -2.9e-186)
t_0
(if (<= d4 2.9e-302)
(* d1 (- d3))
(if (<= d4 1.7e+162) 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 <= -2.9e-186) {
tmp = t_0;
} else if (d4 <= 2.9e-302) {
tmp = d1 * -d3;
} else if (d4 <= 1.7e+162) {
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 <= (-2.9d-186)) then
tmp = t_0
else if (d4 <= 2.9d-302) then
tmp = d1 * -d3
else if (d4 <= 1.7d+162) 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 <= -2.9e-186) {
tmp = t_0;
} else if (d4 <= 2.9e-302) {
tmp = d1 * -d3;
} else if (d4 <= 1.7e+162) {
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 <= -2.9e-186: tmp = t_0 elif d4 <= 2.9e-302: tmp = d1 * -d3 elif d4 <= 1.7e+162: 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 <= -2.9e-186) tmp = t_0; elseif (d4 <= 2.9e-302) tmp = Float64(d1 * Float64(-d3)); elseif (d4 <= 1.7e+162) 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 <= -2.9e-186) tmp = t_0; elseif (d4 <= 2.9e-302) tmp = d1 * -d3; elseif (d4 <= 1.7e+162) 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, -2.9e-186], t$95$0, If[LessEqual[d4, 2.9e-302], N[(d1 * (-d3)), $MachinePrecision], If[LessEqual[d4, 1.7e+162], 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 -2.9 \cdot 10^{-186}:\\
\;\;\;\;t\_0\\
\mathbf{elif}\;d4 \leq 2.9 \cdot 10^{-302}:\\
\;\;\;\;d1 \cdot \left(-d3\right)\\
\mathbf{elif}\;d4 \leq 1.7 \cdot 10^{+162}:\\
\;\;\;\;t\_0\\
\mathbf{else}:\\
\;\;\;\;d1 \cdot \left(d2 + d4\right)\\
\end{array}
\end{array}
if d4 < -2.90000000000000019e-186 or 2.89999999999999994e-302 < d4 < 1.70000000000000001e162Initial program 85.8%
associate--l+85.8%
distribute-lft-out--86.4%
distribute-rgt-out--90.4%
distribute-lft-out100.0%
Simplified100.0%
Taylor expanded in d4 around 0 84.5%
+-commutative84.5%
associate--r+84.5%
Simplified84.5%
Taylor expanded in d3 around 0 60.8%
if -2.90000000000000019e-186 < d4 < 2.89999999999999994e-302Initial program 91.9%
associate--l+91.9%
distribute-lft-out--91.9%
distribute-rgt-out--91.9%
distribute-lft-out99.9%
Simplified99.9%
Taylor expanded in d3 around inf 42.4%
associate-*r*42.4%
neg-mul-142.4%
Simplified42.4%
if 1.70000000000000001e162 < d4 Initial program 84.8%
associate--l+84.8%
distribute-lft-out--87.9%
distribute-rgt-out--97.0%
distribute-lft-out100.0%
Simplified100.0%
+-commutative100.0%
distribute-lft-in97.0%
Applied egg-rr97.0%
Taylor expanded in d1 around 0 100.0%
Taylor expanded in d3 around 0 88.6%
+-commutative88.6%
Simplified88.6%
Final simplification62.6%
(FPCore (d1 d2 d3 d4) :precision binary64 (if (or (<= d3 -1.25e+130) (not (<= d3 3.5e+87))) (* d1 (- d2 d3)) (* d1 (- (+ d2 d4) d1))))
double code(double d1, double d2, double d3, double d4) {
double tmp;
if ((d3 <= -1.25e+130) || !(d3 <= 3.5e+87)) {
tmp = d1 * (d2 - 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.25d+130)) .or. (.not. (d3 <= 3.5d+87))) then
tmp = d1 * (d2 - 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.25e+130) || !(d3 <= 3.5e+87)) {
tmp = d1 * (d2 - d3);
} else {
tmp = d1 * ((d2 + d4) - d1);
}
return tmp;
}
def code(d1, d2, d3, d4): tmp = 0 if (d3 <= -1.25e+130) or not (d3 <= 3.5e+87): tmp = d1 * (d2 - d3) else: tmp = d1 * ((d2 + d4) - d1) return tmp
function code(d1, d2, d3, d4) tmp = 0.0 if ((d3 <= -1.25e+130) || !(d3 <= 3.5e+87)) tmp = Float64(d1 * Float64(d2 - 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.25e+130) || ~((d3 <= 3.5e+87))) tmp = d1 * (d2 - d3); else tmp = d1 * ((d2 + d4) - d1); end tmp_2 = tmp; end
code[d1_, d2_, d3_, d4_] := If[Or[LessEqual[d3, -1.25e+130], N[Not[LessEqual[d3, 3.5e+87]], $MachinePrecision]], N[(d1 * N[(d2 - d3), $MachinePrecision]), $MachinePrecision], N[(d1 * N[(N[(d2 + d4), $MachinePrecision] - d1), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;d3 \leq -1.25 \cdot 10^{+130} \lor \neg \left(d3 \leq 3.5 \cdot 10^{+87}\right):\\
\;\;\;\;d1 \cdot \left(d2 - d3\right)\\
\mathbf{else}:\\
\;\;\;\;d1 \cdot \left(\left(d2 + d4\right) - d1\right)\\
\end{array}
\end{array}
if d3 < -1.2499999999999999e130 or 3.49999999999999986e87 < d3 Initial program 86.2%
associate--l+86.2%
distribute-lft-out--87.5%
distribute-rgt-out--88.8%
distribute-lft-out100.0%
Simplified100.0%
Taylor expanded in d4 around 0 89.5%
+-commutative89.5%
associate--r+89.5%
Simplified89.5%
Taylor expanded in d1 around 0 80.7%
if -1.2499999999999999e130 < d3 < 3.49999999999999986e87Initial program 86.4%
associate--l+86.4%
distribute-lft-out--86.9%
distribute-rgt-out--92.6%
distribute-lft-out100.0%
Simplified100.0%
Taylor expanded in d3 around 0 92.4%
Final simplification88.8%
(FPCore (d1 d2 d3 d4) :precision binary64 (if (or (<= d1 -6.8e+94) (not (<= d1 6.2e+84))) (* d1 (- (+ d2 d4) d1)) (* d1 (- (+ d2 d4) d3))))
double code(double d1, double d2, double d3, double d4) {
double tmp;
if ((d1 <= -6.8e+94) || !(d1 <= 6.2e+84)) {
tmp = d1 * ((d2 + d4) - 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 ((d1 <= (-6.8d+94)) .or. (.not. (d1 <= 6.2d+84))) then
tmp = d1 * ((d2 + d4) - 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 ((d1 <= -6.8e+94) || !(d1 <= 6.2e+84)) {
tmp = d1 * ((d2 + d4) - d1);
} else {
tmp = d1 * ((d2 + d4) - d3);
}
return tmp;
}
def code(d1, d2, d3, d4): tmp = 0 if (d1 <= -6.8e+94) or not (d1 <= 6.2e+84): tmp = d1 * ((d2 + d4) - d1) else: tmp = d1 * ((d2 + d4) - d3) return tmp
function code(d1, d2, d3, d4) tmp = 0.0 if ((d1 <= -6.8e+94) || !(d1 <= 6.2e+84)) tmp = Float64(d1 * Float64(Float64(d2 + d4) - 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 ((d1 <= -6.8e+94) || ~((d1 <= 6.2e+84))) tmp = d1 * ((d2 + d4) - d1); else tmp = d1 * ((d2 + d4) - d3); end tmp_2 = tmp; end
code[d1_, d2_, d3_, d4_] := If[Or[LessEqual[d1, -6.8e+94], N[Not[LessEqual[d1, 6.2e+84]], $MachinePrecision]], N[(d1 * N[(N[(d2 + d4), $MachinePrecision] - d1), $MachinePrecision]), $MachinePrecision], N[(d1 * N[(N[(d2 + d4), $MachinePrecision] - d3), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;d1 \leq -6.8 \cdot 10^{+94} \lor \neg \left(d1 \leq 6.2 \cdot 10^{+84}\right):\\
\;\;\;\;d1 \cdot \left(\left(d2 + d4\right) - d1\right)\\
\mathbf{else}:\\
\;\;\;\;d1 \cdot \left(\left(d2 + d4\right) - d3\right)\\
\end{array}
\end{array}
if d1 < -6.8000000000000004e94 or 6.20000000000000006e84 < d1 Initial program 60.2%
associate--l+60.2%
distribute-lft-out--62.5%
distribute-rgt-out--75.0%
distribute-lft-out100.0%
Simplified100.0%
Taylor expanded in d3 around 0 96.1%
if -6.8000000000000004e94 < d1 < 6.20000000000000006e84Initial 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 92.5%
Final simplification93.7%
(FPCore (d1 d2 d3 d4)
:precision binary64
(if (<= d2 -8.5e+157)
(* d1 (- (+ d2 d4) d3))
(if (<= d2 -8000000000000.0)
(* d1 (- (- d2 d3) d1))
(* d1 (- (- d4 d1) d3)))))
double code(double d1, double d2, double d3, double d4) {
double tmp;
if (d2 <= -8.5e+157) {
tmp = d1 * ((d2 + d4) - d3);
} else if (d2 <= -8000000000000.0) {
tmp = d1 * ((d2 - d3) - d1);
} 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 <= (-8.5d+157)) then
tmp = d1 * ((d2 + d4) - d3)
else if (d2 <= (-8000000000000.0d0)) then
tmp = d1 * ((d2 - d3) - d1)
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 <= -8.5e+157) {
tmp = d1 * ((d2 + d4) - d3);
} else if (d2 <= -8000000000000.0) {
tmp = d1 * ((d2 - d3) - d1);
} else {
tmp = d1 * ((d4 - d1) - d3);
}
return tmp;
}
def code(d1, d2, d3, d4): tmp = 0 if d2 <= -8.5e+157: tmp = d1 * ((d2 + d4) - d3) elif d2 <= -8000000000000.0: tmp = d1 * ((d2 - d3) - d1) else: tmp = d1 * ((d4 - d1) - d3) return tmp
function code(d1, d2, d3, d4) tmp = 0.0 if (d2 <= -8.5e+157) tmp = Float64(d1 * Float64(Float64(d2 + d4) - d3)); elseif (d2 <= -8000000000000.0) tmp = Float64(d1 * Float64(Float64(d2 - d3) - d1)); 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 <= -8.5e+157) tmp = d1 * ((d2 + d4) - d3); elseif (d2 <= -8000000000000.0) tmp = d1 * ((d2 - d3) - d1); else tmp = d1 * ((d4 - d1) - d3); end tmp_2 = tmp; end
code[d1_, d2_, d3_, d4_] := If[LessEqual[d2, -8.5e+157], N[(d1 * N[(N[(d2 + d4), $MachinePrecision] - d3), $MachinePrecision]), $MachinePrecision], If[LessEqual[d2, -8000000000000.0], N[(d1 * N[(N[(d2 - d3), $MachinePrecision] - d1), $MachinePrecision]), $MachinePrecision], N[(d1 * N[(N[(d4 - d1), $MachinePrecision] - d3), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;d2 \leq -8.5 \cdot 10^{+157}:\\
\;\;\;\;d1 \cdot \left(\left(d2 + d4\right) - d3\right)\\
\mathbf{elif}\;d2 \leq -8000000000000:\\
\;\;\;\;d1 \cdot \left(\left(d2 - d3\right) - d1\right)\\
\mathbf{else}:\\
\;\;\;\;d1 \cdot \left(\left(d4 - d1\right) - d3\right)\\
\end{array}
\end{array}
if d2 < -8.4999999999999998e157Initial program 87.4%
associate--l+87.4%
distribute-lft-out--90.0%
distribute-rgt-out--90.0%
distribute-lft-out100.0%
Simplified100.0%
+-commutative100.0%
distribute-lft-in90.0%
Applied egg-rr90.0%
Taylor expanded in d1 around 0 95.0%
if -8.4999999999999998e157 < d2 < -8e12Initial program 81.5%
associate--l+81.5%
distribute-lft-out--85.2%
distribute-rgt-out--92.6%
distribute-lft-out99.9%
Simplified99.9%
Taylor expanded in d4 around 0 78.6%
+-commutative78.6%
associate--r+78.6%
Simplified78.6%
if -8e12 < d2 Initial program 86.8%
associate--l+86.8%
distribute-lft-out--86.8%
distribute-rgt-out--91.5%
distribute-lft-out100.0%
Simplified100.0%
Taylor expanded in d2 around 0 85.9%
associate--r+85.9%
Simplified85.9%
Final simplification86.5%
(FPCore (d1 d2 d3 d4) :precision binary64 (if (or (<= d3 -1.26e+126) (not (<= d3 1.7e+94))) (* d1 (- d3)) (* d1 (+ d2 d4))))
double code(double d1, double d2, double d3, double d4) {
double tmp;
if ((d3 <= -1.26e+126) || !(d3 <= 1.7e+94)) {
tmp = d1 * -d3;
} else {
tmp = d1 * (d2 + d4);
}
return tmp;
}
real(8) function code(d1, d2, d3, d4)
real(8), intent (in) :: d1
real(8), intent (in) :: d2
real(8), intent (in) :: d3
real(8), intent (in) :: d4
real(8) :: tmp
if ((d3 <= (-1.26d+126)) .or. (.not. (d3 <= 1.7d+94))) then
tmp = d1 * -d3
else
tmp = d1 * (d2 + d4)
end if
code = tmp
end function
public static double code(double d1, double d2, double d3, double d4) {
double tmp;
if ((d3 <= -1.26e+126) || !(d3 <= 1.7e+94)) {
tmp = d1 * -d3;
} else {
tmp = d1 * (d2 + d4);
}
return tmp;
}
def code(d1, d2, d3, d4): tmp = 0 if (d3 <= -1.26e+126) or not (d3 <= 1.7e+94): tmp = d1 * -d3 else: tmp = d1 * (d2 + d4) return tmp
function code(d1, d2, d3, d4) tmp = 0.0 if ((d3 <= -1.26e+126) || !(d3 <= 1.7e+94)) tmp = Float64(d1 * Float64(-d3)); else tmp = Float64(d1 * Float64(d2 + d4)); end return tmp end
function tmp_2 = code(d1, d2, d3, d4) tmp = 0.0; if ((d3 <= -1.26e+126) || ~((d3 <= 1.7e+94))) tmp = d1 * -d3; else tmp = d1 * (d2 + d4); end tmp_2 = tmp; end
code[d1_, d2_, d3_, d4_] := If[Or[LessEqual[d3, -1.26e+126], N[Not[LessEqual[d3, 1.7e+94]], $MachinePrecision]], N[(d1 * (-d3)), $MachinePrecision], N[(d1 * N[(d2 + d4), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;d3 \leq -1.26 \cdot 10^{+126} \lor \neg \left(d3 \leq 1.7 \cdot 10^{+94}\right):\\
\;\;\;\;d1 \cdot \left(-d3\right)\\
\mathbf{else}:\\
\;\;\;\;d1 \cdot \left(d2 + d4\right)\\
\end{array}
\end{array}
if d3 < -1.26000000000000004e126 or 1.7000000000000001e94 < d3 Initial program 86.0%
associate--l+86.0%
distribute-lft-out--87.3%
distribute-rgt-out--88.6%
distribute-lft-out100.0%
Simplified100.0%
Taylor expanded in d3 around inf 71.2%
associate-*r*71.2%
neg-mul-171.2%
Simplified71.2%
if -1.26000000000000004e126 < d3 < 1.7000000000000001e94Initial program 86.4%
associate--l+86.4%
distribute-lft-out--87.0%
distribute-rgt-out--92.6%
distribute-lft-out100.0%
Simplified100.0%
+-commutative100.0%
distribute-lft-in92.6%
Applied egg-rr92.6%
Taylor expanded in d1 around 0 69.9%
Taylor expanded in d3 around 0 62.2%
+-commutative62.2%
Simplified62.2%
Final simplification65.0%
(FPCore (d1 d2 d3 d4) :precision binary64 (if (<= d2 -5.2e+55) (* d1 d2) (if (<= d2 -2.3e-132) (* d1 (- d3)) (* d1 d4))))
double code(double d1, double d2, double d3, double d4) {
double tmp;
if (d2 <= -5.2e+55) {
tmp = d1 * d2;
} else if (d2 <= -2.3e-132) {
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 <= (-5.2d+55)) then
tmp = d1 * d2
else if (d2 <= (-2.3d-132)) 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 <= -5.2e+55) {
tmp = d1 * d2;
} else if (d2 <= -2.3e-132) {
tmp = d1 * -d3;
} else {
tmp = d1 * d4;
}
return tmp;
}
def code(d1, d2, d3, d4): tmp = 0 if d2 <= -5.2e+55: tmp = d1 * d2 elif d2 <= -2.3e-132: tmp = d1 * -d3 else: tmp = d1 * d4 return tmp
function code(d1, d2, d3, d4) tmp = 0.0 if (d2 <= -5.2e+55) tmp = Float64(d1 * d2); elseif (d2 <= -2.3e-132) 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 <= -5.2e+55) tmp = d1 * d2; elseif (d2 <= -2.3e-132) tmp = d1 * -d3; else tmp = d1 * d4; end tmp_2 = tmp; end
code[d1_, d2_, d3_, d4_] := If[LessEqual[d2, -5.2e+55], N[(d1 * d2), $MachinePrecision], If[LessEqual[d2, -2.3e-132], N[(d1 * (-d3)), $MachinePrecision], N[(d1 * d4), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;d2 \leq -5.2 \cdot 10^{+55}:\\
\;\;\;\;d1 \cdot d2\\
\mathbf{elif}\;d2 \leq -2.3 \cdot 10^{-132}:\\
\;\;\;\;d1 \cdot \left(-d3\right)\\
\mathbf{else}:\\
\;\;\;\;d1 \cdot d4\\
\end{array}
\end{array}
if d2 < -5.2e55Initial program 83.9%
associate--l+83.9%
distribute-lft-out--87.5%
distribute-rgt-out--89.3%
distribute-lft-out100.0%
Simplified100.0%
Taylor expanded in d2 around inf 59.2%
if -5.2e55 < d2 < -2.30000000000000003e-132Initial program 97.6%
associate--l+97.6%
distribute-lft-out--97.6%
distribute-rgt-out--100.0%
distribute-lft-out100.0%
Simplified100.0%
Taylor expanded in d3 around inf 46.0%
associate-*r*46.0%
neg-mul-146.0%
Simplified46.0%
if -2.30000000000000003e-132 < d2 Initial program 84.3%
associate--l+84.3%
distribute-lft-out--84.3%
distribute-rgt-out--89.9%
distribute-lft-out100.0%
Simplified100.0%
Taylor expanded in d4 around inf 32.2%
Final simplification40.3%
(FPCore (d1 d2 d3 d4) :precision binary64 (if (<= d4 2.9e+32) (* d1 d2) (* d1 d4)))
double code(double d1, double d2, double d3, double d4) {
double tmp;
if (d4 <= 2.9e+32) {
tmp = d1 * d2;
} else {
tmp = d1 * d4;
}
return tmp;
}
real(8) function code(d1, d2, d3, d4)
real(8), intent (in) :: d1
real(8), intent (in) :: d2
real(8), intent (in) :: d3
real(8), intent (in) :: d4
real(8) :: tmp
if (d4 <= 2.9d+32) then
tmp = d1 * d2
else
tmp = d1 * d4
end if
code = tmp
end function
public static double code(double d1, double d2, double d3, double d4) {
double tmp;
if (d4 <= 2.9e+32) {
tmp = d1 * d2;
} else {
tmp = d1 * d4;
}
return tmp;
}
def code(d1, d2, d3, d4): tmp = 0 if d4 <= 2.9e+32: tmp = d1 * d2 else: tmp = d1 * d4 return tmp
function code(d1, d2, d3, d4) tmp = 0.0 if (d4 <= 2.9e+32) tmp = Float64(d1 * d2); else tmp = Float64(d1 * d4); end return tmp end
function tmp_2 = code(d1, d2, d3, d4) tmp = 0.0; if (d4 <= 2.9e+32) tmp = d1 * d2; else tmp = d1 * d4; end tmp_2 = tmp; end
code[d1_, d2_, d3_, d4_] := If[LessEqual[d4, 2.9e+32], N[(d1 * d2), $MachinePrecision], N[(d1 * d4), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;d4 \leq 2.9 \cdot 10^{+32}:\\
\;\;\;\;d1 \cdot d2\\
\mathbf{else}:\\
\;\;\;\;d1 \cdot d4\\
\end{array}
\end{array}
if d4 < 2.90000000000000003e32Initial program 88.6%
associate--l+88.6%
distribute-lft-out--89.1%
distribute-rgt-out--91.1%
distribute-lft-out100.0%
Simplified100.0%
Taylor expanded in d2 around inf 32.7%
if 2.90000000000000003e32 < d4 Initial program 77.4%
associate--l+77.4%
distribute-lft-out--79.2%
distribute-rgt-out--92.5%
distribute-lft-out100.0%
Simplified100.0%
Taylor expanded in d4 around inf 64.4%
Final simplification39.2%
(FPCore (d1 d2 d3 d4) :precision binary64 (* d1 d2))
double code(double d1, double d2, double d3, double d4) {
return d1 * d2;
}
real(8) function code(d1, d2, d3, d4)
real(8), intent (in) :: d1
real(8), intent (in) :: d2
real(8), intent (in) :: d3
real(8), intent (in) :: d4
code = d1 * d2
end function
public static double code(double d1, double d2, double d3, double d4) {
return d1 * d2;
}
def code(d1, d2, d3, d4): return d1 * d2
function code(d1, d2, d3, d4) return Float64(d1 * d2) end
function tmp = code(d1, d2, d3, d4) tmp = d1 * d2; end
code[d1_, d2_, d3_, d4_] := N[(d1 * d2), $MachinePrecision]
\begin{array}{l}
\\
d1 \cdot d2
\end{array}
Initial program 86.3%
associate--l+86.3%
distribute-lft-out--87.1%
distribute-rgt-out--91.4%
distribute-lft-out100.0%
Simplified100.0%
Taylor expanded in d2 around inf 29.3%
Final simplification29.3%
(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 2024077
(FPCore (d1 d2 d3 d4)
:name "FastMath dist4"
:precision binary64
:alt
(* d1 (- (+ (- d2 d3) d4) d1))
(- (+ (- (* d1 d2) (* d1 d3)) (* d4 d1)) (* d1 d1)))