
(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 d1) (- d4 d3))))
double code(double d1, double d2, double d3, double d4) {
return d1 * ((d2 - d1) + (d4 - d3));
}
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) + (d4 - d3))
end function
public static double code(double d1, double d2, double d3, double d4) {
return d1 * ((d2 - d1) + (d4 - d3));
}
def code(d1, d2, d3, d4): return d1 * ((d2 - d1) + (d4 - d3))
function code(d1, d2, d3, d4) return Float64(d1 * Float64(Float64(d2 - d1) + Float64(d4 - d3))) end
function tmp = code(d1, d2, d3, d4) tmp = d1 * ((d2 - d1) + (d4 - d3)); end
code[d1_, d2_, d3_, d4_] := N[(d1 * N[(N[(d2 - d1), $MachinePrecision] + N[(d4 - d3), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
d1 \cdot \left(\left(d2 - d1\right) + \left(d4 - d3\right)\right)
\end{array}
Initial program 89.4%
sub-neg89.4%
associate-+l+89.4%
*-commutative89.4%
+-commutative89.4%
*-commutative89.4%
sub-neg89.4%
+-commutative89.4%
associate--l+89.4%
distribute-lft-out--90.2%
distribute-rgt-out--94.5%
distribute-lft-out100.0%
+-commutative100.0%
Simplified100.0%
(FPCore (d1 d2 d3 d4)
:precision binary64
(let* ((t_0 (* d1 (- d1))) (t_1 (* d1 (- d3))))
(if (<= d2 -5.8e+54)
(* d1 d2)
(if (<= d2 -2.9e+27)
t_1
(if (<= d2 -5.7e-99)
t_0
(if (<= d2 -2.9e-119)
t_1
(if (<= d2 -1.55e-246)
t_0
(if (or (<= d2 2.3e-266) (not (<= d2 1.25e-183)))
(* d1 d4)
t_1))))))))
double code(double d1, double d2, double d3, double d4) {
double t_0 = d1 * -d1;
double t_1 = d1 * -d3;
double tmp;
if (d2 <= -5.8e+54) {
tmp = d1 * d2;
} else if (d2 <= -2.9e+27) {
tmp = t_1;
} else if (d2 <= -5.7e-99) {
tmp = t_0;
} else if (d2 <= -2.9e-119) {
tmp = t_1;
} else if (d2 <= -1.55e-246) {
tmp = t_0;
} else if ((d2 <= 2.3e-266) || !(d2 <= 1.25e-183)) {
tmp = d1 * d4;
} else {
tmp = t_1;
}
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 * -d1
t_1 = d1 * -d3
if (d2 <= (-5.8d+54)) then
tmp = d1 * d2
else if (d2 <= (-2.9d+27)) then
tmp = t_1
else if (d2 <= (-5.7d-99)) then
tmp = t_0
else if (d2 <= (-2.9d-119)) then
tmp = t_1
else if (d2 <= (-1.55d-246)) then
tmp = t_0
else if ((d2 <= 2.3d-266) .or. (.not. (d2 <= 1.25d-183))) then
tmp = d1 * d4
else
tmp = t_1
end if
code = tmp
end function
public static double code(double d1, double d2, double d3, double d4) {
double t_0 = d1 * -d1;
double t_1 = d1 * -d3;
double tmp;
if (d2 <= -5.8e+54) {
tmp = d1 * d2;
} else if (d2 <= -2.9e+27) {
tmp = t_1;
} else if (d2 <= -5.7e-99) {
tmp = t_0;
} else if (d2 <= -2.9e-119) {
tmp = t_1;
} else if (d2 <= -1.55e-246) {
tmp = t_0;
} else if ((d2 <= 2.3e-266) || !(d2 <= 1.25e-183)) {
tmp = d1 * d4;
} else {
tmp = t_1;
}
return tmp;
}
def code(d1, d2, d3, d4): t_0 = d1 * -d1 t_1 = d1 * -d3 tmp = 0 if d2 <= -5.8e+54: tmp = d1 * d2 elif d2 <= -2.9e+27: tmp = t_1 elif d2 <= -5.7e-99: tmp = t_0 elif d2 <= -2.9e-119: tmp = t_1 elif d2 <= -1.55e-246: tmp = t_0 elif (d2 <= 2.3e-266) or not (d2 <= 1.25e-183): tmp = d1 * d4 else: tmp = t_1 return tmp
function code(d1, d2, d3, d4) t_0 = Float64(d1 * Float64(-d1)) t_1 = Float64(d1 * Float64(-d3)) tmp = 0.0 if (d2 <= -5.8e+54) tmp = Float64(d1 * d2); elseif (d2 <= -2.9e+27) tmp = t_1; elseif (d2 <= -5.7e-99) tmp = t_0; elseif (d2 <= -2.9e-119) tmp = t_1; elseif (d2 <= -1.55e-246) tmp = t_0; elseif ((d2 <= 2.3e-266) || !(d2 <= 1.25e-183)) tmp = Float64(d1 * d4); else tmp = t_1; end return tmp end
function tmp_2 = code(d1, d2, d3, d4) t_0 = d1 * -d1; t_1 = d1 * -d3; tmp = 0.0; if (d2 <= -5.8e+54) tmp = d1 * d2; elseif (d2 <= -2.9e+27) tmp = t_1; elseif (d2 <= -5.7e-99) tmp = t_0; elseif (d2 <= -2.9e-119) tmp = t_1; elseif (d2 <= -1.55e-246) tmp = t_0; elseif ((d2 <= 2.3e-266) || ~((d2 <= 1.25e-183))) tmp = d1 * d4; else tmp = t_1; end tmp_2 = tmp; end
code[d1_, d2_, d3_, d4_] := Block[{t$95$0 = N[(d1 * (-d1)), $MachinePrecision]}, Block[{t$95$1 = N[(d1 * (-d3)), $MachinePrecision]}, If[LessEqual[d2, -5.8e+54], N[(d1 * d2), $MachinePrecision], If[LessEqual[d2, -2.9e+27], t$95$1, If[LessEqual[d2, -5.7e-99], t$95$0, If[LessEqual[d2, -2.9e-119], t$95$1, If[LessEqual[d2, -1.55e-246], t$95$0, If[Or[LessEqual[d2, 2.3e-266], N[Not[LessEqual[d2, 1.25e-183]], $MachinePrecision]], N[(d1 * d4), $MachinePrecision], t$95$1]]]]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := d1 \cdot \left(-d1\right)\\
t_1 := d1 \cdot \left(-d3\right)\\
\mathbf{if}\;d2 \leq -5.8 \cdot 10^{+54}:\\
\;\;\;\;d1 \cdot d2\\
\mathbf{elif}\;d2 \leq -2.9 \cdot 10^{+27}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;d2 \leq -5.7 \cdot 10^{-99}:\\
\;\;\;\;t\_0\\
\mathbf{elif}\;d2 \leq -2.9 \cdot 10^{-119}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;d2 \leq -1.55 \cdot 10^{-246}:\\
\;\;\;\;t\_0\\
\mathbf{elif}\;d2 \leq 2.3 \cdot 10^{-266} \lor \neg \left(d2 \leq 1.25 \cdot 10^{-183}\right):\\
\;\;\;\;d1 \cdot d4\\
\mathbf{else}:\\
\;\;\;\;t\_1\\
\end{array}
\end{array}
if d2 < -5.7999999999999997e54Initial program 85.4%
sub-neg85.4%
associate-+l+85.4%
*-commutative85.4%
+-commutative85.4%
*-commutative85.4%
sub-neg85.4%
+-commutative85.4%
associate--l+85.4%
distribute-lft-out--85.4%
distribute-rgt-out--91.6%
distribute-lft-out99.9%
+-commutative99.9%
Simplified99.9%
Taylor expanded in d2 around inf 63.9%
if -5.7999999999999997e54 < d2 < -2.9000000000000001e27 or -5.70000000000000032e-99 < d2 < -2.9e-119 or 2.29999999999999996e-266 < d2 < 1.2500000000000001e-183Initial program 91.7%
sub-neg91.7%
associate-+l+91.7%
*-commutative91.7%
+-commutative91.7%
*-commutative91.7%
sub-neg91.7%
+-commutative91.7%
associate--l+91.7%
distribute-lft-out--91.7%
distribute-rgt-out--91.7%
distribute-lft-out100.0%
+-commutative100.0%
Simplified100.0%
Taylor expanded in d3 around inf 64.2%
mul-1-neg64.2%
distribute-rgt-neg-in64.2%
Simplified64.2%
if -2.9000000000000001e27 < d2 < -5.70000000000000032e-99 or -2.9e-119 < d2 < -1.55e-246Initial program 91.8%
sub-neg91.8%
associate-+l+91.8%
*-commutative91.8%
+-commutative91.8%
*-commutative91.8%
sub-neg91.8%
+-commutative91.8%
associate--l+91.8%
distribute-lft-out--93.4%
distribute-rgt-out--93.4%
distribute-lft-out100.0%
+-commutative100.0%
Simplified100.0%
Taylor expanded in d1 around inf 48.9%
unpow248.9%
mul-1-neg48.9%
distribute-rgt-neg-in48.9%
Simplified48.9%
if -1.55e-246 < d2 < 2.29999999999999996e-266 or 1.2500000000000001e-183 < d2 Initial program 89.4%
sub-neg89.4%
associate-+l+89.4%
*-commutative89.4%
+-commutative89.4%
*-commutative89.4%
sub-neg89.4%
+-commutative89.4%
associate--l+89.4%
distribute-lft-out--90.2%
distribute-rgt-out--96.7%
distribute-lft-out100.0%
+-commutative100.0%
Simplified100.0%
Taylor expanded in d4 around inf 32.0%
Final simplification45.1%
(FPCore (d1 d2 d3 d4)
:precision binary64
(let* ((t_0 (* d1 (- d3))) (t_1 (* d1 (+ d2 d4))))
(if (<= d3 -3.2e+203)
t_0
(if (<= d3 -2e-204)
t_1
(if (<= d3 -5.6e-253) (* d1 (- d1)) (if (<= d3 3.9e+111) t_1 t_0))))))
double code(double d1, double d2, double d3, double d4) {
double t_0 = d1 * -d3;
double t_1 = d1 * (d2 + d4);
double tmp;
if (d3 <= -3.2e+203) {
tmp = t_0;
} else if (d3 <= -2e-204) {
tmp = t_1;
} else if (d3 <= -5.6e-253) {
tmp = d1 * -d1;
} else if (d3 <= 3.9e+111) {
tmp = t_1;
} else {
tmp = t_0;
}
return tmp;
}
real(8) function code(d1, d2, d3, d4)
real(8), intent (in) :: d1
real(8), intent (in) :: d2
real(8), intent (in) :: d3
real(8), intent (in) :: d4
real(8) :: t_0
real(8) :: t_1
real(8) :: tmp
t_0 = d1 * -d3
t_1 = d1 * (d2 + d4)
if (d3 <= (-3.2d+203)) then
tmp = t_0
else if (d3 <= (-2d-204)) then
tmp = t_1
else if (d3 <= (-5.6d-253)) then
tmp = d1 * -d1
else if (d3 <= 3.9d+111) then
tmp = t_1
else
tmp = t_0
end if
code = tmp
end function
public static double code(double d1, double d2, double d3, double d4) {
double t_0 = d1 * -d3;
double t_1 = d1 * (d2 + d4);
double tmp;
if (d3 <= -3.2e+203) {
tmp = t_0;
} else if (d3 <= -2e-204) {
tmp = t_1;
} else if (d3 <= -5.6e-253) {
tmp = d1 * -d1;
} else if (d3 <= 3.9e+111) {
tmp = t_1;
} else {
tmp = t_0;
}
return tmp;
}
def code(d1, d2, d3, d4): t_0 = d1 * -d3 t_1 = d1 * (d2 + d4) tmp = 0 if d3 <= -3.2e+203: tmp = t_0 elif d3 <= -2e-204: tmp = t_1 elif d3 <= -5.6e-253: tmp = d1 * -d1 elif d3 <= 3.9e+111: tmp = t_1 else: tmp = t_0 return tmp
function code(d1, d2, d3, d4) t_0 = Float64(d1 * Float64(-d3)) t_1 = Float64(d1 * Float64(d2 + d4)) tmp = 0.0 if (d3 <= -3.2e+203) tmp = t_0; elseif (d3 <= -2e-204) tmp = t_1; elseif (d3 <= -5.6e-253) tmp = Float64(d1 * Float64(-d1)); elseif (d3 <= 3.9e+111) tmp = t_1; else tmp = t_0; end return tmp end
function tmp_2 = code(d1, d2, d3, d4) t_0 = d1 * -d3; t_1 = d1 * (d2 + d4); tmp = 0.0; if (d3 <= -3.2e+203) tmp = t_0; elseif (d3 <= -2e-204) tmp = t_1; elseif (d3 <= -5.6e-253) tmp = d1 * -d1; elseif (d3 <= 3.9e+111) tmp = t_1; else tmp = t_0; end tmp_2 = tmp; end
code[d1_, d2_, d3_, d4_] := Block[{t$95$0 = N[(d1 * (-d3)), $MachinePrecision]}, Block[{t$95$1 = N[(d1 * N[(d2 + d4), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[d3, -3.2e+203], t$95$0, If[LessEqual[d3, -2e-204], t$95$1, If[LessEqual[d3, -5.6e-253], N[(d1 * (-d1)), $MachinePrecision], If[LessEqual[d3, 3.9e+111], t$95$1, t$95$0]]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := d1 \cdot \left(-d3\right)\\
t_1 := d1 \cdot \left(d2 + d4\right)\\
\mathbf{if}\;d3 \leq -3.2 \cdot 10^{+203}:\\
\;\;\;\;t\_0\\
\mathbf{elif}\;d3 \leq -2 \cdot 10^{-204}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;d3 \leq -5.6 \cdot 10^{-253}:\\
\;\;\;\;d1 \cdot \left(-d1\right)\\
\mathbf{elif}\;d3 \leq 3.9 \cdot 10^{+111}:\\
\;\;\;\;t\_1\\
\mathbf{else}:\\
\;\;\;\;t\_0\\
\end{array}
\end{array}
if d3 < -3.1999999999999997e203 or 3.89999999999999979e111 < d3 Initial program 87.5%
sub-neg87.5%
associate-+l+87.5%
*-commutative87.5%
+-commutative87.5%
*-commutative87.5%
sub-neg87.5%
+-commutative87.5%
associate--l+87.5%
distribute-lft-out--87.5%
distribute-rgt-out--89.3%
distribute-lft-out100.0%
+-commutative100.0%
Simplified100.0%
Taylor expanded in d3 around inf 89.6%
mul-1-neg89.6%
distribute-rgt-neg-in89.6%
Simplified89.6%
if -3.1999999999999997e203 < d3 < -2e-204 or -5.60000000000000011e-253 < d3 < 3.89999999999999979e111Initial program 90.9%
sub-neg90.9%
associate-+l+90.9%
*-commutative90.9%
+-commutative90.9%
*-commutative90.9%
sub-neg90.9%
+-commutative90.9%
associate--l+90.9%
distribute-lft-out--92.0%
distribute-rgt-out--96.3%
distribute-lft-out100.0%
+-commutative100.0%
Simplified100.0%
Taylor expanded in d3 around 0 91.1%
Taylor expanded in d1 around 0 66.4%
if -2e-204 < d3 < -5.60000000000000011e-253Initial program 75.0%
sub-neg75.0%
associate-+l+75.0%
*-commutative75.0%
+-commutative75.0%
*-commutative75.0%
sub-neg75.0%
+-commutative75.0%
associate--l+75.0%
distribute-lft-out--75.0%
distribute-rgt-out--91.7%
distribute-lft-out99.9%
+-commutative99.9%
Simplified99.9%
Taylor expanded in d1 around inf 75.3%
unpow275.3%
mul-1-neg75.3%
distribute-rgt-neg-in75.3%
Simplified75.3%
(FPCore (d1 d2 d3 d4)
:precision binary64
(if (<= d2 -1.35e+103)
(* d1 d2)
(if (or (<= d2 -1.5e-246) (and (not (<= d2 5.8e-266)) (<= d2 1.55e-183)))
(* d1 (- d1))
(* d1 d4))))
double code(double d1, double d2, double d3, double d4) {
double tmp;
if (d2 <= -1.35e+103) {
tmp = d1 * d2;
} else if ((d2 <= -1.5e-246) || (!(d2 <= 5.8e-266) && (d2 <= 1.55e-183))) {
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.35d+103)) then
tmp = d1 * d2
else if ((d2 <= (-1.5d-246)) .or. (.not. (d2 <= 5.8d-266)) .and. (d2 <= 1.55d-183)) 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.35e+103) {
tmp = d1 * d2;
} else if ((d2 <= -1.5e-246) || (!(d2 <= 5.8e-266) && (d2 <= 1.55e-183))) {
tmp = d1 * -d1;
} else {
tmp = d1 * d4;
}
return tmp;
}
def code(d1, d2, d3, d4): tmp = 0 if d2 <= -1.35e+103: tmp = d1 * d2 elif (d2 <= -1.5e-246) or (not (d2 <= 5.8e-266) and (d2 <= 1.55e-183)): tmp = d1 * -d1 else: tmp = d1 * d4 return tmp
function code(d1, d2, d3, d4) tmp = 0.0 if (d2 <= -1.35e+103) tmp = Float64(d1 * d2); elseif ((d2 <= -1.5e-246) || (!(d2 <= 5.8e-266) && (d2 <= 1.55e-183))) 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.35e+103) tmp = d1 * d2; elseif ((d2 <= -1.5e-246) || (~((d2 <= 5.8e-266)) && (d2 <= 1.55e-183))) tmp = d1 * -d1; else tmp = d1 * d4; end tmp_2 = tmp; end
code[d1_, d2_, d3_, d4_] := If[LessEqual[d2, -1.35e+103], N[(d1 * d2), $MachinePrecision], If[Or[LessEqual[d2, -1.5e-246], And[N[Not[LessEqual[d2, 5.8e-266]], $MachinePrecision], LessEqual[d2, 1.55e-183]]], N[(d1 * (-d1)), $MachinePrecision], N[(d1 * d4), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;d2 \leq -1.35 \cdot 10^{+103}:\\
\;\;\;\;d1 \cdot d2\\
\mathbf{elif}\;d2 \leq -1.5 \cdot 10^{-246} \lor \neg \left(d2 \leq 5.8 \cdot 10^{-266}\right) \land d2 \leq 1.55 \cdot 10^{-183}:\\
\;\;\;\;d1 \cdot \left(-d1\right)\\
\mathbf{else}:\\
\;\;\;\;d1 \cdot d4\\
\end{array}
\end{array}
if d2 < -1.34999999999999996e103Initial program 81.0%
sub-neg81.0%
associate-+l+81.0%
*-commutative81.0%
+-commutative81.0%
*-commutative81.0%
sub-neg81.0%
+-commutative81.0%
associate--l+81.0%
distribute-lft-out--81.0%
distribute-rgt-out--89.1%
distribute-lft-out100.0%
+-commutative100.0%
Simplified100.0%
Taylor expanded in d2 around inf 79.1%
if -1.34999999999999996e103 < d2 < -1.5e-246 or 5.79999999999999991e-266 < d2 < 1.55e-183Initial program 92.7%
sub-neg92.7%
associate-+l+92.7%
*-commutative92.7%
+-commutative92.7%
*-commutative92.7%
sub-neg92.7%
+-commutative92.7%
associate--l+92.7%
distribute-lft-out--93.8%
distribute-rgt-out--93.8%
distribute-lft-out100.0%
+-commutative100.0%
Simplified100.0%
Taylor expanded in d1 around inf 42.3%
unpow242.3%
mul-1-neg42.3%
distribute-rgt-neg-in42.3%
Simplified42.3%
if -1.5e-246 < d2 < 5.79999999999999991e-266 or 1.55e-183 < d2 Initial program 89.4%
sub-neg89.4%
associate-+l+89.4%
*-commutative89.4%
+-commutative89.4%
*-commutative89.4%
sub-neg89.4%
+-commutative89.4%
associate--l+89.4%
distribute-lft-out--90.2%
distribute-rgt-out--96.7%
distribute-lft-out100.0%
+-commutative100.0%
Simplified100.0%
Taylor expanded in d4 around inf 32.0%
Final simplification42.7%
(FPCore (d1 d2 d3 d4)
:precision binary64
(let* ((t_0 (* d1 (- d2 d3))))
(if (<= d3 -3.2e+177)
t_0
(if (<= d3 8.6e-198)
(* d1 (- d4 d1))
(if (<= d3 3.95e+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 <= -3.2e+177) {
tmp = t_0;
} else if (d3 <= 8.6e-198) {
tmp = d1 * (d4 - d1);
} else if (d3 <= 3.95e+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 <= (-3.2d+177)) then
tmp = t_0
else if (d3 <= 8.6d-198) then
tmp = d1 * (d4 - d1)
else if (d3 <= 3.95d+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 <= -3.2e+177) {
tmp = t_0;
} else if (d3 <= 8.6e-198) {
tmp = d1 * (d4 - d1);
} else if (d3 <= 3.95e+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 <= -3.2e+177: tmp = t_0 elif d3 <= 8.6e-198: tmp = d1 * (d4 - d1) elif d3 <= 3.95e+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 <= -3.2e+177) tmp = t_0; elseif (d3 <= 8.6e-198) tmp = Float64(d1 * Float64(d4 - d1)); elseif (d3 <= 3.95e+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 <= -3.2e+177) tmp = t_0; elseif (d3 <= 8.6e-198) tmp = d1 * (d4 - d1); elseif (d3 <= 3.95e+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, -3.2e+177], t$95$0, If[LessEqual[d3, 8.6e-198], N[(d1 * N[(d4 - d1), $MachinePrecision]), $MachinePrecision], If[LessEqual[d3, 3.95e+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 -3.2 \cdot 10^{+177}:\\
\;\;\;\;t\_0\\
\mathbf{elif}\;d3 \leq 8.6 \cdot 10^{-198}:\\
\;\;\;\;d1 \cdot \left(d4 - d1\right)\\
\mathbf{elif}\;d3 \leq 3.95 \cdot 10^{+74}:\\
\;\;\;\;d1 \cdot \left(d2 + d4\right)\\
\mathbf{else}:\\
\;\;\;\;t\_0\\
\end{array}
\end{array}
if d3 < -3.2e177 or 3.94999999999999994e74 < d3 Initial program 83.8%
sub-neg83.8%
associate-+l+83.8%
*-commutative83.8%
+-commutative83.8%
*-commutative83.8%
sub-neg83.8%
+-commutative83.8%
associate--l+83.8%
distribute-lft-out--85.3%
distribute-rgt-out--86.8%
distribute-lft-out100.0%
+-commutative100.0%
Simplified100.0%
Taylor expanded in d4 around 0 91.4%
associate--r+91.4%
Simplified91.4%
Taylor expanded in d1 around 0 88.4%
if -3.2e177 < d3 < 8.6000000000000007e-198Initial program 91.1%
sub-neg91.1%
associate-+l+91.1%
*-commutative91.1%
+-commutative91.1%
*-commutative91.1%
sub-neg91.1%
+-commutative91.1%
associate--l+91.1%
distribute-lft-out--91.8%
distribute-rgt-out--97.0%
distribute-lft-out100.0%
+-commutative100.0%
Simplified100.0%
Taylor expanded in d3 around 0 94.3%
Taylor expanded in d2 around 0 69.4%
if 8.6000000000000007e-198 < d3 < 3.94999999999999994e74Initial program 92.5%
sub-neg92.5%
associate-+l+92.5%
*-commutative92.5%
+-commutative92.5%
*-commutative92.5%
sub-neg92.5%
+-commutative92.5%
associate--l+92.5%
distribute-lft-out--92.5%
distribute-rgt-out--98.1%
distribute-lft-out100.0%
+-commutative100.0%
Simplified100.0%
Taylor expanded in d3 around 0 90.1%
Taylor expanded in d1 around 0 65.4%
(FPCore (d1 d2 d3 d4) :precision binary64 (if (or (<= d3 -3.2e+177) (not (<= d3 9.2e+108))) (* d1 (- d2 d3)) (* d1 (- (+ d2 d4) d1))))
double code(double d1, double d2, double d3, double d4) {
double tmp;
if ((d3 <= -3.2e+177) || !(d3 <= 9.2e+108)) {
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 <= (-3.2d+177)) .or. (.not. (d3 <= 9.2d+108))) 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 <= -3.2e+177) || !(d3 <= 9.2e+108)) {
tmp = d1 * (d2 - d3);
} else {
tmp = d1 * ((d2 + d4) - d1);
}
return tmp;
}
def code(d1, d2, d3, d4): tmp = 0 if (d3 <= -3.2e+177) or not (d3 <= 9.2e+108): tmp = d1 * (d2 - d3) else: tmp = d1 * ((d2 + d4) - d1) return tmp
function code(d1, d2, d3, d4) tmp = 0.0 if ((d3 <= -3.2e+177) || !(d3 <= 9.2e+108)) 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 <= -3.2e+177) || ~((d3 <= 9.2e+108))) tmp = d1 * (d2 - d3); else tmp = d1 * ((d2 + d4) - d1); end tmp_2 = tmp; end
code[d1_, d2_, d3_, d4_] := If[Or[LessEqual[d3, -3.2e+177], N[Not[LessEqual[d3, 9.2e+108]], $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 -3.2 \cdot 10^{+177} \lor \neg \left(d3 \leq 9.2 \cdot 10^{+108}\right):\\
\;\;\;\;d1 \cdot \left(d2 - d3\right)\\
\mathbf{else}:\\
\;\;\;\;d1 \cdot \left(\left(d2 + d4\right) - d1\right)\\
\end{array}
\end{array}
if d3 < -3.2e177 or 9.1999999999999996e108 < d3 Initial program 84.1%
sub-neg84.1%
associate-+l+84.1%
*-commutative84.1%
+-commutative84.1%
*-commutative84.1%
sub-neg84.1%
+-commutative84.1%
associate--l+84.1%
distribute-lft-out--85.7%
distribute-rgt-out--87.3%
distribute-lft-out100.0%
+-commutative100.0%
Simplified100.0%
Taylor expanded in d4 around 0 90.7%
associate--r+90.7%
Simplified90.7%
Taylor expanded in d1 around 0 89.1%
if -3.2e177 < d3 < 9.1999999999999996e108Initial program 91.2%
sub-neg91.2%
associate-+l+91.2%
*-commutative91.2%
+-commutative91.2%
*-commutative91.2%
sub-neg91.2%
+-commutative91.2%
associate--l+91.2%
distribute-lft-out--91.7%
distribute-rgt-out--96.9%
distribute-lft-out100.0%
+-commutative100.0%
Simplified100.0%
Taylor expanded in d3 around 0 92.3%
Final simplification91.5%
(FPCore (d1 d2 d3 d4) :precision binary64 (if (<= d4 -5.9e-65) (* d1 (- d2 d3)) (if (<= d4 5.6e+76) (- (* d1 (+ d1 d3))) (* d1 (+ d2 d4)))))
double code(double d1, double d2, double d3, double d4) {
double tmp;
if (d4 <= -5.9e-65) {
tmp = d1 * (d2 - d3);
} else if (d4 <= 5.6e+76) {
tmp = -(d1 * (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 (d4 <= (-5.9d-65)) then
tmp = d1 * (d2 - d3)
else if (d4 <= 5.6d+76) then
tmp = -(d1 * (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 (d4 <= -5.9e-65) {
tmp = d1 * (d2 - d3);
} else if (d4 <= 5.6e+76) {
tmp = -(d1 * (d1 + d3));
} else {
tmp = d1 * (d2 + d4);
}
return tmp;
}
def code(d1, d2, d3, d4): tmp = 0 if d4 <= -5.9e-65: tmp = d1 * (d2 - d3) elif d4 <= 5.6e+76: tmp = -(d1 * (d1 + d3)) else: tmp = d1 * (d2 + d4) return tmp
function code(d1, d2, d3, d4) tmp = 0.0 if (d4 <= -5.9e-65) tmp = Float64(d1 * Float64(d2 - d3)); elseif (d4 <= 5.6e+76) tmp = Float64(-Float64(d1 * Float64(d1 + d3))); else tmp = Float64(d1 * Float64(d2 + d4)); end return tmp end
function tmp_2 = code(d1, d2, d3, d4) tmp = 0.0; if (d4 <= -5.9e-65) tmp = d1 * (d2 - d3); elseif (d4 <= 5.6e+76) tmp = -(d1 * (d1 + d3)); else tmp = d1 * (d2 + d4); end tmp_2 = tmp; end
code[d1_, d2_, d3_, d4_] := If[LessEqual[d4, -5.9e-65], N[(d1 * N[(d2 - d3), $MachinePrecision]), $MachinePrecision], If[LessEqual[d4, 5.6e+76], (-N[(d1 * N[(d1 + d3), $MachinePrecision]), $MachinePrecision]), N[(d1 * N[(d2 + d4), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;d4 \leq -5.9 \cdot 10^{-65}:\\
\;\;\;\;d1 \cdot \left(d2 - d3\right)\\
\mathbf{elif}\;d4 \leq 5.6 \cdot 10^{+76}:\\
\;\;\;\;-d1 \cdot \left(d1 + d3\right)\\
\mathbf{else}:\\
\;\;\;\;d1 \cdot \left(d2 + d4\right)\\
\end{array}
\end{array}
if d4 < -5.89999999999999978e-65Initial program 86.3%
sub-neg86.3%
associate-+l+86.3%
*-commutative86.3%
+-commutative86.3%
*-commutative86.3%
sub-neg86.3%
+-commutative86.3%
associate--l+86.3%
distribute-lft-out--89.4%
distribute-rgt-out--90.9%
distribute-lft-out99.9%
+-commutative99.9%
Simplified99.9%
Taylor expanded in d4 around 0 63.2%
associate--r+63.2%
Simplified63.2%
Taylor expanded in d1 around 0 48.4%
if -5.89999999999999978e-65 < d4 < 5.5999999999999997e76Initial program 89.1%
sub-neg89.1%
associate-+l+89.1%
*-commutative89.1%
+-commutative89.1%
*-commutative89.1%
sub-neg89.1%
+-commutative89.1%
associate--l+89.1%
distribute-lft-out--89.1%
distribute-rgt-out--96.4%
distribute-lft-out100.0%
+-commutative100.0%
Simplified100.0%
Taylor expanded in d4 around 0 97.8%
associate--r+97.8%
Simplified97.8%
Taylor expanded in d2 around 0 72.5%
mul-1-neg72.5%
distribute-rgt-neg-in72.5%
neg-sub072.5%
+-commutative72.5%
associate--r+72.5%
sub0-neg72.5%
Simplified72.5%
if 5.5999999999999997e76 < d4 Initial program 94.2%
sub-neg94.2%
associate-+l+94.2%
*-commutative94.2%
+-commutative94.2%
*-commutative94.2%
sub-neg94.2%
+-commutative94.2%
associate--l+94.2%
distribute-lft-out--94.2%
distribute-rgt-out--94.2%
distribute-lft-out100.0%
+-commutative100.0%
Simplified100.0%
Taylor expanded in d3 around 0 88.8%
Taylor expanded in d1 around 0 84.9%
Final simplification68.8%
(FPCore (d1 d2 d3 d4) :precision binary64 (if (<= d4 1.4e+67) (* d1 (- (- d2 d1) d3)) (* d1 (- (+ d2 d4) d1))))
double code(double d1, double d2, double d3, double d4) {
double tmp;
if (d4 <= 1.4e+67) {
tmp = d1 * ((d2 - d1) - 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 (d4 <= 1.4d+67) then
tmp = d1 * ((d2 - d1) - 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 (d4 <= 1.4e+67) {
tmp = d1 * ((d2 - d1) - d3);
} else {
tmp = d1 * ((d2 + d4) - d1);
}
return tmp;
}
def code(d1, d2, d3, d4): tmp = 0 if d4 <= 1.4e+67: tmp = d1 * ((d2 - d1) - d3) else: tmp = d1 * ((d2 + d4) - d1) return tmp
function code(d1, d2, d3, d4) tmp = 0.0 if (d4 <= 1.4e+67) tmp = Float64(d1 * Float64(Float64(d2 - d1) - 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 (d4 <= 1.4e+67) tmp = d1 * ((d2 - d1) - d3); else tmp = d1 * ((d2 + d4) - d1); end tmp_2 = tmp; end
code[d1_, d2_, d3_, d4_] := If[LessEqual[d4, 1.4e+67], N[(d1 * N[(N[(d2 - d1), $MachinePrecision] - d3), $MachinePrecision]), $MachinePrecision], N[(d1 * N[(N[(d2 + d4), $MachinePrecision] - d1), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;d4 \leq 1.4 \cdot 10^{+67}:\\
\;\;\;\;d1 \cdot \left(\left(d2 - d1\right) - d3\right)\\
\mathbf{else}:\\
\;\;\;\;d1 \cdot \left(\left(d2 + d4\right) - d1\right)\\
\end{array}
\end{array}
if d4 < 1.3999999999999999e67Initial program 88.1%
sub-neg88.1%
associate-+l+88.1%
*-commutative88.1%
+-commutative88.1%
*-commutative88.1%
sub-neg88.1%
+-commutative88.1%
associate--l+88.1%
distribute-lft-out--89.1%
distribute-rgt-out--94.5%
distribute-lft-out100.0%
+-commutative100.0%
Simplified100.0%
Taylor expanded in d4 around 0 86.6%
associate--r+86.6%
Simplified86.6%
if 1.3999999999999999e67 < d4 Initial program 94.4%
sub-neg94.4%
associate-+l+94.4%
*-commutative94.4%
+-commutative94.4%
*-commutative94.4%
sub-neg94.4%
+-commutative94.4%
associate--l+94.4%
distribute-lft-out--94.4%
distribute-rgt-out--94.4%
distribute-lft-out100.0%
+-commutative100.0%
Simplified100.0%
Taylor expanded in d3 around 0 89.2%
(FPCore (d1 d2 d3 d4) :precision binary64 (if (<= d4 7e+83) (* d1 (- d2 d1)) (* d1 (- d4 d1))))
double code(double d1, double d2, double d3, double d4) {
double tmp;
if (d4 <= 7e+83) {
tmp = d1 * (d2 - 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) :: tmp
if (d4 <= 7d+83) then
tmp = d1 * (d2 - 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 tmp;
if (d4 <= 7e+83) {
tmp = d1 * (d2 - d1);
} else {
tmp = d1 * (d4 - d1);
}
return tmp;
}
def code(d1, d2, d3, d4): tmp = 0 if d4 <= 7e+83: tmp = d1 * (d2 - d1) else: tmp = d1 * (d4 - d1) return tmp
function code(d1, d2, d3, d4) tmp = 0.0 if (d4 <= 7e+83) tmp = Float64(d1 * Float64(d2 - d1)); else tmp = Float64(d1 * Float64(d4 - d1)); end return tmp end
function tmp_2 = code(d1, d2, d3, d4) tmp = 0.0; if (d4 <= 7e+83) tmp = d1 * (d2 - d1); else tmp = d1 * (d4 - d1); end tmp_2 = tmp; end
code[d1_, d2_, d3_, d4_] := If[LessEqual[d4, 7e+83], N[(d1 * N[(d2 - d1), $MachinePrecision]), $MachinePrecision], N[(d1 * N[(d4 - d1), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;d4 \leq 7 \cdot 10^{+83}:\\
\;\;\;\;d1 \cdot \left(d2 - d1\right)\\
\mathbf{else}:\\
\;\;\;\;d1 \cdot \left(d4 - d1\right)\\
\end{array}
\end{array}
if d4 < 6.99999999999999954e83Initial program 88.3%
Taylor expanded in d2 around inf 57.7%
distribute-lft-out--63.0%
*-commutative63.0%
Applied egg-rr63.0%
if 6.99999999999999954e83 < d4 Initial program 94.0%
sub-neg94.0%
associate-+l+94.0%
*-commutative94.0%
+-commutative94.0%
*-commutative94.0%
sub-neg94.0%
+-commutative94.0%
associate--l+94.0%
distribute-lft-out--94.0%
distribute-rgt-out--94.0%
distribute-lft-out100.0%
+-commutative100.0%
Simplified100.0%
Taylor expanded in d3 around 0 88.3%
Taylor expanded in d2 around 0 77.8%
Final simplification65.9%
(FPCore (d1 d2 d3 d4) :precision binary64 (if (<= d4 8.4e+68) (* d1 (- d2 d3)) (* d1 (+ d2 d4))))
double code(double d1, double d2, double d3, double d4) {
double tmp;
if (d4 <= 8.4e+68) {
tmp = d1 * (d2 - d3);
} else {
tmp = d1 * (d2 + d4);
}
return tmp;
}
real(8) function code(d1, d2, d3, d4)
real(8), intent (in) :: d1
real(8), intent (in) :: d2
real(8), intent (in) :: d3
real(8), intent (in) :: d4
real(8) :: tmp
if (d4 <= 8.4d+68) then
tmp = d1 * (d2 - d3)
else
tmp = d1 * (d2 + d4)
end if
code = tmp
end function
public static double code(double d1, double d2, double d3, double d4) {
double tmp;
if (d4 <= 8.4e+68) {
tmp = d1 * (d2 - d3);
} else {
tmp = d1 * (d2 + d4);
}
return tmp;
}
def code(d1, d2, d3, d4): tmp = 0 if d4 <= 8.4e+68: tmp = d1 * (d2 - d3) else: tmp = d1 * (d2 + d4) return tmp
function code(d1, d2, d3, d4) tmp = 0.0 if (d4 <= 8.4e+68) tmp = Float64(d1 * Float64(d2 - d3)); else tmp = Float64(d1 * Float64(d2 + d4)); end return tmp end
function tmp_2 = code(d1, d2, d3, d4) tmp = 0.0; if (d4 <= 8.4e+68) tmp = d1 * (d2 - d3); else tmp = d1 * (d2 + d4); end tmp_2 = tmp; end
code[d1_, d2_, d3_, d4_] := If[LessEqual[d4, 8.4e+68], N[(d1 * N[(d2 - d3), $MachinePrecision]), $MachinePrecision], N[(d1 * N[(d2 + d4), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;d4 \leq 8.4 \cdot 10^{+68}:\\
\;\;\;\;d1 \cdot \left(d2 - d3\right)\\
\mathbf{else}:\\
\;\;\;\;d1 \cdot \left(d2 + d4\right)\\
\end{array}
\end{array}
if d4 < 8.40000000000000003e68Initial program 88.1%
sub-neg88.1%
associate-+l+88.1%
*-commutative88.1%
+-commutative88.1%
*-commutative88.1%
sub-neg88.1%
+-commutative88.1%
associate--l+88.1%
distribute-lft-out--89.1%
distribute-rgt-out--94.5%
distribute-lft-out100.0%
+-commutative100.0%
Simplified100.0%
Taylor expanded in d4 around 0 86.6%
associate--r+86.6%
Simplified86.6%
Taylor expanded in d1 around 0 59.5%
if 8.40000000000000003e68 < d4 Initial program 94.4%
sub-neg94.4%
associate-+l+94.4%
*-commutative94.4%
+-commutative94.4%
*-commutative94.4%
sub-neg94.4%
+-commutative94.4%
associate--l+94.4%
distribute-lft-out--94.4%
distribute-rgt-out--94.4%
distribute-lft-out100.0%
+-commutative100.0%
Simplified100.0%
Taylor expanded in d3 around 0 89.2%
Taylor expanded in d1 around 0 82.1%
(FPCore (d1 d2 d3 d4) :precision binary64 (if (<= d4 2.8e+85) (* d1 d2) (* d1 d4)))
double code(double d1, double d2, double d3, double d4) {
double tmp;
if (d4 <= 2.8e+85) {
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.8d+85) 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.8e+85) {
tmp = d1 * d2;
} else {
tmp = d1 * d4;
}
return tmp;
}
def code(d1, d2, d3, d4): tmp = 0 if d4 <= 2.8e+85: tmp = d1 * d2 else: tmp = d1 * d4 return tmp
function code(d1, d2, d3, d4) tmp = 0.0 if (d4 <= 2.8e+85) 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.8e+85) tmp = d1 * d2; else tmp = d1 * d4; end tmp_2 = tmp; end
code[d1_, d2_, d3_, d4_] := If[LessEqual[d4, 2.8e+85], N[(d1 * d2), $MachinePrecision], N[(d1 * d4), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;d4 \leq 2.8 \cdot 10^{+85}:\\
\;\;\;\;d1 \cdot d2\\
\mathbf{else}:\\
\;\;\;\;d1 \cdot d4\\
\end{array}
\end{array}
if d4 < 2.7999999999999999e85Initial program 88.3%
sub-neg88.3%
associate-+l+88.3%
*-commutative88.3%
+-commutative88.3%
*-commutative88.3%
sub-neg88.3%
+-commutative88.3%
associate--l+88.3%
distribute-lft-out--89.3%
distribute-rgt-out--94.7%
distribute-lft-out100.0%
+-commutative100.0%
Simplified100.0%
Taylor expanded in d2 around inf 32.5%
if 2.7999999999999999e85 < d4 Initial program 94.0%
sub-neg94.0%
associate-+l+94.0%
*-commutative94.0%
+-commutative94.0%
*-commutative94.0%
sub-neg94.0%
+-commutative94.0%
associate--l+94.0%
distribute-lft-out--94.0%
distribute-rgt-out--94.0%
distribute-lft-out100.0%
+-commutative100.0%
Simplified100.0%
Taylor expanded in d4 around inf 73.8%
(FPCore (d1 d2 d3 d4) :precision binary64 (* d1 d2))
double code(double d1, double d2, double d3, double d4) {
return d1 * d2;
}
real(8) function code(d1, d2, d3, d4)
real(8), intent (in) :: d1
real(8), intent (in) :: d2
real(8), intent (in) :: d3
real(8), intent (in) :: d4
code = d1 * d2
end function
public static double code(double d1, double d2, double d3, double d4) {
return d1 * d2;
}
def code(d1, d2, d3, d4): return d1 * d2
function code(d1, d2, d3, d4) return Float64(d1 * d2) end
function tmp = code(d1, d2, d3, d4) tmp = d1 * d2; end
code[d1_, d2_, d3_, d4_] := N[(d1 * d2), $MachinePrecision]
\begin{array}{l}
\\
d1 \cdot d2
\end{array}
Initial program 89.4%
sub-neg89.4%
associate-+l+89.4%
*-commutative89.4%
+-commutative89.4%
*-commutative89.4%
sub-neg89.4%
+-commutative89.4%
associate--l+89.4%
distribute-lft-out--90.2%
distribute-rgt-out--94.5%
distribute-lft-out100.0%
+-commutative100.0%
Simplified100.0%
Taylor expanded in d2 around inf 28.6%
(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 2024097
(FPCore (d1 d2 d3 d4)
:name "FastMath dist4"
:precision binary64
:alt
(* d1 (- (+ (- d2 d3) d4) d1))
(- (+ (- (* d1 d2) (* d1 d3)) (* d4 d1)) (* d1 d1)))