
(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 (+ (- (- d4 d3) d1) d2)))
double code(double d1, double d2, double d3, double d4) {
return d1 * (((d4 - d3) - 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 * (((d4 - d3) - d1) + d2)
end function
public static double code(double d1, double d2, double d3, double d4) {
return d1 * (((d4 - d3) - d1) + d2);
}
def code(d1, d2, d3, d4): return d1 * (((d4 - d3) - d1) + d2)
function code(d1, d2, d3, d4) return Float64(d1 * Float64(Float64(Float64(d4 - d3) - d1) + d2)) end
function tmp = code(d1, d2, d3, d4) tmp = d1 * (((d4 - d3) - d1) + d2); end
code[d1_, d2_, d3_, d4_] := N[(d1 * N[(N[(N[(d4 - d3), $MachinePrecision] - d1), $MachinePrecision] + d2), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
d1 \cdot \left(\left(\left(d4 - d3\right) - d1\right) + d2\right)
\end{array}
Initial program 89.4%
associate--l+89.4%
sub-neg89.4%
associate-+l+89.4%
+-commutative89.4%
--rgt-identity89.4%
associate--r-89.4%
associate-+r-89.4%
+-commutative89.4%
*-commutative89.4%
sub-neg89.4%
distribute-lft-out--91.0%
distribute-lft-out--96.5%
neg-sub096.5%
distribute-rgt-neg-out96.5%
distribute-lft-out--100.0%
sub-neg100.0%
remove-double-neg100.0%
Simplified100.0%
Final simplification100.0%
(FPCore (d1 d2 d3 d4)
:precision binary64
(let* ((t_0 (* d1 (- (- d1) d3))))
(if (<= d2 -1.9e+63)
(* d1 (- d2 d3))
(if (<= d2 -6e-12)
t_0
(if (<= d2 -7.5e-29)
(* d1 (+ d4 d2))
(if (<= d2 4.8e-251) t_0 (* d1 (- d4 d3))))))))
double code(double d1, double d2, double d3, double d4) {
double t_0 = d1 * (-d1 - d3);
double tmp;
if (d2 <= -1.9e+63) {
tmp = d1 * (d2 - d3);
} else if (d2 <= -6e-12) {
tmp = t_0;
} else if (d2 <= -7.5e-29) {
tmp = d1 * (d4 + d2);
} else if (d2 <= 4.8e-251) {
tmp = t_0;
} else {
tmp = d1 * (d4 - d3);
}
return tmp;
}
real(8) function code(d1, d2, d3, d4)
real(8), intent (in) :: d1
real(8), intent (in) :: d2
real(8), intent (in) :: d3
real(8), intent (in) :: d4
real(8) :: t_0
real(8) :: tmp
t_0 = d1 * (-d1 - d3)
if (d2 <= (-1.9d+63)) then
tmp = d1 * (d2 - d3)
else if (d2 <= (-6d-12)) then
tmp = t_0
else if (d2 <= (-7.5d-29)) then
tmp = d1 * (d4 + d2)
else if (d2 <= 4.8d-251) then
tmp = t_0
else
tmp = d1 * (d4 - d3)
end if
code = tmp
end function
public static double code(double d1, double d2, double d3, double d4) {
double t_0 = d1 * (-d1 - d3);
double tmp;
if (d2 <= -1.9e+63) {
tmp = d1 * (d2 - d3);
} else if (d2 <= -6e-12) {
tmp = t_0;
} else if (d2 <= -7.5e-29) {
tmp = d1 * (d4 + d2);
} else if (d2 <= 4.8e-251) {
tmp = t_0;
} else {
tmp = d1 * (d4 - d3);
}
return tmp;
}
def code(d1, d2, d3, d4): t_0 = d1 * (-d1 - d3) tmp = 0 if d2 <= -1.9e+63: tmp = d1 * (d2 - d3) elif d2 <= -6e-12: tmp = t_0 elif d2 <= -7.5e-29: tmp = d1 * (d4 + d2) elif d2 <= 4.8e-251: tmp = t_0 else: tmp = d1 * (d4 - d3) return tmp
function code(d1, d2, d3, d4) t_0 = Float64(d1 * Float64(Float64(-d1) - d3)) tmp = 0.0 if (d2 <= -1.9e+63) tmp = Float64(d1 * Float64(d2 - d3)); elseif (d2 <= -6e-12) tmp = t_0; elseif (d2 <= -7.5e-29) tmp = Float64(d1 * Float64(d4 + d2)); elseif (d2 <= 4.8e-251) tmp = t_0; else tmp = Float64(d1 * Float64(d4 - d3)); end return tmp end
function tmp_2 = code(d1, d2, d3, d4) t_0 = d1 * (-d1 - d3); tmp = 0.0; if (d2 <= -1.9e+63) tmp = d1 * (d2 - d3); elseif (d2 <= -6e-12) tmp = t_0; elseif (d2 <= -7.5e-29) tmp = d1 * (d4 + d2); elseif (d2 <= 4.8e-251) tmp = t_0; else tmp = d1 * (d4 - d3); end tmp_2 = tmp; end
code[d1_, d2_, d3_, d4_] := Block[{t$95$0 = N[(d1 * N[((-d1) - d3), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[d2, -1.9e+63], N[(d1 * N[(d2 - d3), $MachinePrecision]), $MachinePrecision], If[LessEqual[d2, -6e-12], t$95$0, If[LessEqual[d2, -7.5e-29], N[(d1 * N[(d4 + d2), $MachinePrecision]), $MachinePrecision], If[LessEqual[d2, 4.8e-251], t$95$0, N[(d1 * N[(d4 - d3), $MachinePrecision]), $MachinePrecision]]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := d1 \cdot \left(\left(-d1\right) - d3\right)\\
\mathbf{if}\;d2 \leq -1.9 \cdot 10^{+63}:\\
\;\;\;\;d1 \cdot \left(d2 - d3\right)\\
\mathbf{elif}\;d2 \leq -6 \cdot 10^{-12}:\\
\;\;\;\;t_0\\
\mathbf{elif}\;d2 \leq -7.5 \cdot 10^{-29}:\\
\;\;\;\;d1 \cdot \left(d4 + d2\right)\\
\mathbf{elif}\;d2 \leq 4.8 \cdot 10^{-251}:\\
\;\;\;\;t_0\\
\mathbf{else}:\\
\;\;\;\;d1 \cdot \left(d4 - d3\right)\\
\end{array}
\end{array}
if d2 < -1.9000000000000001e63Initial program 90.3%
associate--l+90.3%
sub-neg90.3%
associate-+l+90.3%
+-commutative90.3%
--rgt-identity90.3%
associate--r-90.3%
associate-+r-90.3%
+-commutative90.3%
*-commutative90.3%
sub-neg90.3%
distribute-lft-out--90.3%
distribute-lft-out--91.9%
neg-sub091.9%
distribute-rgt-neg-out91.9%
distribute-lft-out--100.0%
sub-neg100.0%
remove-double-neg100.0%
Simplified100.0%
Taylor expanded in d4 around 0 87.8%
Taylor expanded in d1 around 0 83.0%
if -1.9000000000000001e63 < d2 < -6.0000000000000003e-12 or -7.50000000000000006e-29 < d2 < 4.79999999999999992e-251Initial program 88.5%
associate--l+88.5%
sub-neg88.5%
associate-+l+88.5%
+-commutative88.5%
--rgt-identity88.5%
associate--r-88.5%
associate-+r-88.5%
+-commutative88.5%
*-commutative88.5%
sub-neg88.5%
distribute-lft-out--92.3%
distribute-lft-out--100.0%
neg-sub0100.0%
distribute-rgt-neg-out100.0%
distribute-lft-out--100.0%
sub-neg100.0%
remove-double-neg100.0%
Simplified100.0%
Taylor expanded in d4 around 0 72.0%
Taylor expanded in d2 around 0 69.0%
mul-1-neg69.0%
distribute-rgt-neg-in69.0%
Simplified69.0%
if -6.0000000000000003e-12 < d2 < -7.50000000000000006e-29Initial program 50.0%
associate--l+50.0%
sub-neg50.0%
associate-+l+50.0%
+-commutative50.0%
--rgt-identity50.0%
associate--r-50.0%
associate-+r-50.0%
+-commutative50.0%
*-commutative50.0%
sub-neg50.0%
distribute-lft-out--50.0%
distribute-lft-out--100.0%
neg-sub0100.0%
distribute-rgt-neg-out100.0%
distribute-lft-out--100.0%
sub-neg100.0%
remove-double-neg100.0%
Simplified100.0%
Taylor expanded in d1 around 0 100.0%
Taylor expanded in d3 around 0 100.0%
+-commutative100.0%
Simplified100.0%
if 4.79999999999999992e-251 < d2 Initial program 90.3%
associate--l+90.3%
sub-neg90.3%
associate-+l+90.3%
+-commutative90.3%
--rgt-identity90.3%
associate--r-90.3%
associate-+r-90.3%
+-commutative90.3%
*-commutative90.3%
sub-neg90.3%
distribute-lft-out--91.2%
distribute-lft-out--96.5%
neg-sub096.5%
distribute-rgt-neg-out96.5%
distribute-lft-out--100.0%
sub-neg100.0%
remove-double-neg100.0%
Simplified100.0%
Taylor expanded in d1 around 0 81.9%
Taylor expanded in d2 around 0 59.0%
Final simplification68.1%
(FPCore (d1 d2 d3 d4)
:precision binary64
(let* ((t_0 (* d1 (- d3))) (t_1 (* d1 (+ d4 d2))))
(if (<= d3 -3.8e+80)
t_0
(if (<= d3 6.5e-291)
t_1
(if (<= d3 5.7e-241) (* d1 (- d1)) (if (<= d3 2.45e+194) t_1 t_0))))))
double code(double d1, double d2, double d3, double d4) {
double t_0 = d1 * -d3;
double t_1 = d1 * (d4 + d2);
double tmp;
if (d3 <= -3.8e+80) {
tmp = t_0;
} else if (d3 <= 6.5e-291) {
tmp = t_1;
} else if (d3 <= 5.7e-241) {
tmp = d1 * -d1;
} else if (d3 <= 2.45e+194) {
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 * (d4 + d2)
if (d3 <= (-3.8d+80)) then
tmp = t_0
else if (d3 <= 6.5d-291) then
tmp = t_1
else if (d3 <= 5.7d-241) then
tmp = d1 * -d1
else if (d3 <= 2.45d+194) 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 * (d4 + d2);
double tmp;
if (d3 <= -3.8e+80) {
tmp = t_0;
} else if (d3 <= 6.5e-291) {
tmp = t_1;
} else if (d3 <= 5.7e-241) {
tmp = d1 * -d1;
} else if (d3 <= 2.45e+194) {
tmp = t_1;
} else {
tmp = t_0;
}
return tmp;
}
def code(d1, d2, d3, d4): t_0 = d1 * -d3 t_1 = d1 * (d4 + d2) tmp = 0 if d3 <= -3.8e+80: tmp = t_0 elif d3 <= 6.5e-291: tmp = t_1 elif d3 <= 5.7e-241: tmp = d1 * -d1 elif d3 <= 2.45e+194: 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(d4 + d2)) tmp = 0.0 if (d3 <= -3.8e+80) tmp = t_0; elseif (d3 <= 6.5e-291) tmp = t_1; elseif (d3 <= 5.7e-241) tmp = Float64(d1 * Float64(-d1)); elseif (d3 <= 2.45e+194) 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 * (d4 + d2); tmp = 0.0; if (d3 <= -3.8e+80) tmp = t_0; elseif (d3 <= 6.5e-291) tmp = t_1; elseif (d3 <= 5.7e-241) tmp = d1 * -d1; elseif (d3 <= 2.45e+194) 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[(d4 + d2), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[d3, -3.8e+80], t$95$0, If[LessEqual[d3, 6.5e-291], t$95$1, If[LessEqual[d3, 5.7e-241], N[(d1 * (-d1)), $MachinePrecision], If[LessEqual[d3, 2.45e+194], t$95$1, t$95$0]]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := d1 \cdot \left(-d3\right)\\
t_1 := d1 \cdot \left(d4 + d2\right)\\
\mathbf{if}\;d3 \leq -3.8 \cdot 10^{+80}:\\
\;\;\;\;t_0\\
\mathbf{elif}\;d3 \leq 6.5 \cdot 10^{-291}:\\
\;\;\;\;t_1\\
\mathbf{elif}\;d3 \leq 5.7 \cdot 10^{-241}:\\
\;\;\;\;d1 \cdot \left(-d1\right)\\
\mathbf{elif}\;d3 \leq 2.45 \cdot 10^{+194}:\\
\;\;\;\;t_1\\
\mathbf{else}:\\
\;\;\;\;t_0\\
\end{array}
\end{array}
if d3 < -3.79999999999999997e80 or 2.45000000000000013e194 < d3 Initial program 86.5%
associate--l+86.5%
sub-neg86.5%
associate-+l+86.5%
+-commutative86.5%
--rgt-identity86.5%
associate--r-86.5%
associate-+r-86.5%
+-commutative86.5%
*-commutative86.5%
sub-neg86.5%
distribute-lft-out--90.5%
distribute-lft-out--95.9%
neg-sub095.9%
distribute-rgt-neg-out95.9%
distribute-lft-out--100.0%
sub-neg100.0%
remove-double-neg100.0%
Simplified100.0%
Taylor expanded in d3 around inf 88.0%
associate-*r*88.0%
neg-mul-188.0%
Simplified88.0%
if -3.79999999999999997e80 < d3 < 6.50000000000000002e-291 or 5.6999999999999998e-241 < d3 < 2.45000000000000013e194Initial program 90.7%
associate--l+90.7%
sub-neg90.7%
associate-+l+90.7%
+-commutative90.7%
--rgt-identity90.7%
associate--r-90.7%
associate-+r-90.7%
+-commutative90.7%
*-commutative90.7%
sub-neg90.7%
distribute-lft-out--91.3%
distribute-lft-out--97.1%
neg-sub097.1%
distribute-rgt-neg-out97.1%
distribute-lft-out--100.0%
sub-neg100.0%
remove-double-neg100.0%
Simplified100.0%
Taylor expanded in d1 around 0 78.8%
Taylor expanded in d3 around 0 67.7%
+-commutative67.7%
Simplified67.7%
if 6.50000000000000002e-291 < d3 < 5.6999999999999998e-241Initial program 90.0%
associate--l+90.0%
sub-neg90.0%
associate-+l+90.0%
+-commutative90.0%
--rgt-identity90.0%
associate--r-90.0%
associate-+r-90.0%
+-commutative90.0%
*-commutative90.0%
sub-neg90.0%
distribute-lft-out--90.0%
distribute-lft-out--90.0%
neg-sub090.0%
distribute-rgt-neg-out90.0%
distribute-lft-out--100.0%
sub-neg100.0%
remove-double-neg100.0%
Simplified100.0%
Taylor expanded in d1 around inf 72.2%
unpow272.2%
mul-1-neg72.2%
distribute-rgt-neg-out72.2%
Simplified72.2%
Final simplification73.8%
(FPCore (d1 d2 d3 d4)
:precision binary64
(let* ((t_0 (* d1 (- d3))) (t_1 (* d1 (+ d4 d2))))
(if (<= d3 -9.5e+79)
t_0
(if (<= d3 -1.4e-289)
t_1
(if (<= d3 7.2e-239) (* d1 (- d4 d1)) (if (<= d3 2.4e+193) t_1 t_0))))))
double code(double d1, double d2, double d3, double d4) {
double t_0 = d1 * -d3;
double t_1 = d1 * (d4 + d2);
double tmp;
if (d3 <= -9.5e+79) {
tmp = t_0;
} else if (d3 <= -1.4e-289) {
tmp = t_1;
} else if (d3 <= 7.2e-239) {
tmp = d1 * (d4 - d1);
} else if (d3 <= 2.4e+193) {
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 * (d4 + d2)
if (d3 <= (-9.5d+79)) then
tmp = t_0
else if (d3 <= (-1.4d-289)) then
tmp = t_1
else if (d3 <= 7.2d-239) then
tmp = d1 * (d4 - d1)
else if (d3 <= 2.4d+193) 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 * (d4 + d2);
double tmp;
if (d3 <= -9.5e+79) {
tmp = t_0;
} else if (d3 <= -1.4e-289) {
tmp = t_1;
} else if (d3 <= 7.2e-239) {
tmp = d1 * (d4 - d1);
} else if (d3 <= 2.4e+193) {
tmp = t_1;
} else {
tmp = t_0;
}
return tmp;
}
def code(d1, d2, d3, d4): t_0 = d1 * -d3 t_1 = d1 * (d4 + d2) tmp = 0 if d3 <= -9.5e+79: tmp = t_0 elif d3 <= -1.4e-289: tmp = t_1 elif d3 <= 7.2e-239: tmp = d1 * (d4 - d1) elif d3 <= 2.4e+193: 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(d4 + d2)) tmp = 0.0 if (d3 <= -9.5e+79) tmp = t_0; elseif (d3 <= -1.4e-289) tmp = t_1; elseif (d3 <= 7.2e-239) tmp = Float64(d1 * Float64(d4 - d1)); elseif (d3 <= 2.4e+193) 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 * (d4 + d2); tmp = 0.0; if (d3 <= -9.5e+79) tmp = t_0; elseif (d3 <= -1.4e-289) tmp = t_1; elseif (d3 <= 7.2e-239) tmp = d1 * (d4 - d1); elseif (d3 <= 2.4e+193) 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[(d4 + d2), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[d3, -9.5e+79], t$95$0, If[LessEqual[d3, -1.4e-289], t$95$1, If[LessEqual[d3, 7.2e-239], N[(d1 * N[(d4 - d1), $MachinePrecision]), $MachinePrecision], If[LessEqual[d3, 2.4e+193], t$95$1, t$95$0]]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := d1 \cdot \left(-d3\right)\\
t_1 := d1 \cdot \left(d4 + d2\right)\\
\mathbf{if}\;d3 \leq -9.5 \cdot 10^{+79}:\\
\;\;\;\;t_0\\
\mathbf{elif}\;d3 \leq -1.4 \cdot 10^{-289}:\\
\;\;\;\;t_1\\
\mathbf{elif}\;d3 \leq 7.2 \cdot 10^{-239}:\\
\;\;\;\;d1 \cdot \left(d4 - d1\right)\\
\mathbf{elif}\;d3 \leq 2.4 \cdot 10^{+193}:\\
\;\;\;\;t_1\\
\mathbf{else}:\\
\;\;\;\;t_0\\
\end{array}
\end{array}
if d3 < -9.49999999999999994e79 or 2.4e193 < d3 Initial program 86.5%
associate--l+86.5%
sub-neg86.5%
associate-+l+86.5%
+-commutative86.5%
--rgt-identity86.5%
associate--r-86.5%
associate-+r-86.5%
+-commutative86.5%
*-commutative86.5%
sub-neg86.5%
distribute-lft-out--90.5%
distribute-lft-out--95.9%
neg-sub095.9%
distribute-rgt-neg-out95.9%
distribute-lft-out--100.0%
sub-neg100.0%
remove-double-neg100.0%
Simplified100.0%
Taylor expanded in d3 around inf 88.0%
associate-*r*88.0%
neg-mul-188.0%
Simplified88.0%
if -9.49999999999999994e79 < d3 < -1.39999999999999993e-289 or 7.2000000000000002e-239 < d3 < 2.4e193Initial program 90.3%
associate--l+90.3%
sub-neg90.3%
associate-+l+90.3%
+-commutative90.3%
--rgt-identity90.3%
associate--r-90.3%
associate-+r-90.3%
+-commutative90.3%
*-commutative90.3%
sub-neg90.3%
distribute-lft-out--90.9%
distribute-lft-out--97.0%
neg-sub097.0%
distribute-rgt-neg-out97.0%
distribute-lft-out--100.0%
sub-neg100.0%
remove-double-neg100.0%
Simplified100.0%
Taylor expanded in d1 around 0 79.1%
Taylor expanded in d3 around 0 67.5%
+-commutative67.5%
Simplified67.5%
if -1.39999999999999993e-289 < d3 < 7.2000000000000002e-239Initial program 94.1%
associate--l+94.1%
sub-neg94.1%
associate-+l+94.1%
+-commutative94.1%
--rgt-identity94.1%
associate--r-94.1%
associate-+r-94.1%
+-commutative94.1%
*-commutative94.1%
sub-neg94.1%
distribute-lft-out--94.1%
distribute-lft-out--94.1%
neg-sub094.1%
distribute-rgt-neg-out94.1%
distribute-lft-out--100.0%
sub-neg100.0%
remove-double-neg100.0%
Simplified100.0%
Taylor expanded in d2 around 0 71.9%
associate--r+71.9%
Simplified71.9%
Taylor expanded in d3 around 0 71.9%
Final simplification73.7%
(FPCore (d1 d2 d3 d4)
:precision binary64
(let* ((t_0 (* d1 (- d2 d3))))
(if (<= d2 -6e+64)
t_0
(if (<= d2 -1.14e+33)
(* d1 (- d1))
(if (<= d2 -4.2e+16)
t_0
(if (<= d2 -1.9e-66) (* d1 (- d4 d1)) (* d1 (- d4 d3))))))))
double code(double d1, double d2, double d3, double d4) {
double t_0 = d1 * (d2 - d3);
double tmp;
if (d2 <= -6e+64) {
tmp = t_0;
} else if (d2 <= -1.14e+33) {
tmp = d1 * -d1;
} else if (d2 <= -4.2e+16) {
tmp = t_0;
} else if (d2 <= -1.9e-66) {
tmp = d1 * (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) :: t_0
real(8) :: tmp
t_0 = d1 * (d2 - d3)
if (d2 <= (-6d+64)) then
tmp = t_0
else if (d2 <= (-1.14d+33)) then
tmp = d1 * -d1
else if (d2 <= (-4.2d+16)) then
tmp = t_0
else if (d2 <= (-1.9d-66)) then
tmp = d1 * (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 t_0 = d1 * (d2 - d3);
double tmp;
if (d2 <= -6e+64) {
tmp = t_0;
} else if (d2 <= -1.14e+33) {
tmp = d1 * -d1;
} else if (d2 <= -4.2e+16) {
tmp = t_0;
} else if (d2 <= -1.9e-66) {
tmp = d1 * (d4 - d1);
} else {
tmp = d1 * (d4 - d3);
}
return tmp;
}
def code(d1, d2, d3, d4): t_0 = d1 * (d2 - d3) tmp = 0 if d2 <= -6e+64: tmp = t_0 elif d2 <= -1.14e+33: tmp = d1 * -d1 elif d2 <= -4.2e+16: tmp = t_0 elif d2 <= -1.9e-66: tmp = d1 * (d4 - d1) else: tmp = d1 * (d4 - d3) return tmp
function code(d1, d2, d3, d4) t_0 = Float64(d1 * Float64(d2 - d3)) tmp = 0.0 if (d2 <= -6e+64) tmp = t_0; elseif (d2 <= -1.14e+33) tmp = Float64(d1 * Float64(-d1)); elseif (d2 <= -4.2e+16) tmp = t_0; elseif (d2 <= -1.9e-66) tmp = Float64(d1 * Float64(d4 - d1)); else tmp = Float64(d1 * Float64(d4 - d3)); end return tmp end
function tmp_2 = code(d1, d2, d3, d4) t_0 = d1 * (d2 - d3); tmp = 0.0; if (d2 <= -6e+64) tmp = t_0; elseif (d2 <= -1.14e+33) tmp = d1 * -d1; elseif (d2 <= -4.2e+16) tmp = t_0; elseif (d2 <= -1.9e-66) tmp = d1 * (d4 - d1); else tmp = d1 * (d4 - d3); end tmp_2 = tmp; end
code[d1_, d2_, d3_, d4_] := Block[{t$95$0 = N[(d1 * N[(d2 - d3), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[d2, -6e+64], t$95$0, If[LessEqual[d2, -1.14e+33], N[(d1 * (-d1)), $MachinePrecision], If[LessEqual[d2, -4.2e+16], t$95$0, If[LessEqual[d2, -1.9e-66], N[(d1 * N[(d4 - d1), $MachinePrecision]), $MachinePrecision], N[(d1 * N[(d4 - d3), $MachinePrecision]), $MachinePrecision]]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := d1 \cdot \left(d2 - d3\right)\\
\mathbf{if}\;d2 \leq -6 \cdot 10^{+64}:\\
\;\;\;\;t_0\\
\mathbf{elif}\;d2 \leq -1.14 \cdot 10^{+33}:\\
\;\;\;\;d1 \cdot \left(-d1\right)\\
\mathbf{elif}\;d2 \leq -4.2 \cdot 10^{+16}:\\
\;\;\;\;t_0\\
\mathbf{elif}\;d2 \leq -1.9 \cdot 10^{-66}:\\
\;\;\;\;d1 \cdot \left(d4 - d1\right)\\
\mathbf{else}:\\
\;\;\;\;d1 \cdot \left(d4 - d3\right)\\
\end{array}
\end{array}
if d2 < -6.0000000000000004e64 or -1.14e33 < d2 < -4.2e16Initial program 89.7%
associate--l+89.7%
sub-neg89.7%
associate-+l+89.7%
+-commutative89.7%
--rgt-identity89.7%
associate--r-89.7%
associate-+r-89.7%
+-commutative89.7%
*-commutative89.7%
sub-neg89.7%
distribute-lft-out--89.7%
distribute-lft-out--92.6%
neg-sub092.6%
distribute-rgt-neg-out92.6%
distribute-lft-out--100.0%
sub-neg100.0%
remove-double-neg100.0%
Simplified100.0%
Taylor expanded in d4 around 0 88.9%
Taylor expanded in d1 around 0 80.2%
if -6.0000000000000004e64 < d2 < -1.14e33Initial program 100.0%
associate--l+100.0%
sub-neg100.0%
associate-+l+100.0%
+-commutative100.0%
--rgt-identity100.0%
associate--r-100.0%
associate-+r-100.0%
+-commutative100.0%
*-commutative100.0%
sub-neg100.0%
distribute-lft-out--100.0%
distribute-lft-out--100.0%
neg-sub0100.0%
distribute-rgt-neg-out100.0%
distribute-lft-out--100.0%
sub-neg100.0%
remove-double-neg100.0%
Simplified100.0%
Taylor expanded in d1 around inf 67.6%
unpow267.6%
mul-1-neg67.6%
distribute-rgt-neg-out67.6%
Simplified67.6%
if -4.2e16 < d2 < -1.8999999999999999e-66Initial program 70.0%
associate--l+70.0%
sub-neg70.0%
associate-+l+70.0%
+-commutative70.0%
--rgt-identity70.0%
associate--r-70.0%
associate-+r-70.0%
+-commutative70.0%
*-commutative70.0%
sub-neg70.0%
distribute-lft-out--70.0%
distribute-lft-out--100.0%
neg-sub0100.0%
distribute-rgt-neg-out100.0%
distribute-lft-out--100.0%
sub-neg100.0%
remove-double-neg100.0%
Simplified100.0%
Taylor expanded in d2 around 0 81.1%
associate--r+81.1%
Simplified81.1%
Taylor expanded in d3 around 0 52.0%
if -1.8999999999999999e-66 < d2 Initial program 90.3%
associate--l+90.3%
sub-neg90.3%
associate-+l+90.3%
+-commutative90.3%
--rgt-identity90.3%
associate--r-90.3%
associate-+r-90.3%
+-commutative90.3%
*-commutative90.3%
sub-neg90.3%
distribute-lft-out--92.6%
distribute-lft-out--97.7%
neg-sub097.7%
distribute-rgt-neg-out97.7%
distribute-lft-out--100.0%
sub-neg100.0%
remove-double-neg100.0%
Simplified100.0%
Taylor expanded in d1 around 0 80.3%
Taylor expanded in d2 around 0 65.2%
Final simplification68.7%
(FPCore (d1 d2 d3 d4)
:precision binary64
(let* ((t_0 (* d1 (- d2 d3))))
(if (<= d4 8.2e-107)
t_0
(if (<= d4 8e-97)
(* d1 (- d1))
(if (<= d4 2.55e+120) t_0 (* d1 (+ d4 d2)))))))
double code(double d1, double d2, double d3, double d4) {
double t_0 = d1 * (d2 - d3);
double tmp;
if (d4 <= 8.2e-107) {
tmp = t_0;
} else if (d4 <= 8e-97) {
tmp = d1 * -d1;
} else if (d4 <= 2.55e+120) {
tmp = t_0;
} else {
tmp = d1 * (d4 + d2);
}
return tmp;
}
real(8) function code(d1, d2, d3, d4)
real(8), intent (in) :: d1
real(8), intent (in) :: d2
real(8), intent (in) :: d3
real(8), intent (in) :: d4
real(8) :: t_0
real(8) :: tmp
t_0 = d1 * (d2 - d3)
if (d4 <= 8.2d-107) then
tmp = t_0
else if (d4 <= 8d-97) then
tmp = d1 * -d1
else if (d4 <= 2.55d+120) then
tmp = t_0
else
tmp = d1 * (d4 + d2)
end if
code = tmp
end function
public static double code(double d1, double d2, double d3, double d4) {
double t_0 = d1 * (d2 - d3);
double tmp;
if (d4 <= 8.2e-107) {
tmp = t_0;
} else if (d4 <= 8e-97) {
tmp = d1 * -d1;
} else if (d4 <= 2.55e+120) {
tmp = t_0;
} else {
tmp = d1 * (d4 + d2);
}
return tmp;
}
def code(d1, d2, d3, d4): t_0 = d1 * (d2 - d3) tmp = 0 if d4 <= 8.2e-107: tmp = t_0 elif d4 <= 8e-97: tmp = d1 * -d1 elif d4 <= 2.55e+120: tmp = t_0 else: tmp = d1 * (d4 + d2) return tmp
function code(d1, d2, d3, d4) t_0 = Float64(d1 * Float64(d2 - d3)) tmp = 0.0 if (d4 <= 8.2e-107) tmp = t_0; elseif (d4 <= 8e-97) tmp = Float64(d1 * Float64(-d1)); elseif (d4 <= 2.55e+120) tmp = t_0; else tmp = Float64(d1 * Float64(d4 + d2)); end return tmp end
function tmp_2 = code(d1, d2, d3, d4) t_0 = d1 * (d2 - d3); tmp = 0.0; if (d4 <= 8.2e-107) tmp = t_0; elseif (d4 <= 8e-97) tmp = d1 * -d1; elseif (d4 <= 2.55e+120) tmp = t_0; else tmp = d1 * (d4 + d2); end tmp_2 = tmp; end
code[d1_, d2_, d3_, d4_] := Block[{t$95$0 = N[(d1 * N[(d2 - d3), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[d4, 8.2e-107], t$95$0, If[LessEqual[d4, 8e-97], N[(d1 * (-d1)), $MachinePrecision], If[LessEqual[d4, 2.55e+120], t$95$0, N[(d1 * N[(d4 + d2), $MachinePrecision]), $MachinePrecision]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := d1 \cdot \left(d2 - d3\right)\\
\mathbf{if}\;d4 \leq 8.2 \cdot 10^{-107}:\\
\;\;\;\;t_0\\
\mathbf{elif}\;d4 \leq 8 \cdot 10^{-97}:\\
\;\;\;\;d1 \cdot \left(-d1\right)\\
\mathbf{elif}\;d4 \leq 2.55 \cdot 10^{+120}:\\
\;\;\;\;t_0\\
\mathbf{else}:\\
\;\;\;\;d1 \cdot \left(d4 + d2\right)\\
\end{array}
\end{array}
if d4 < 8.1999999999999998e-107 or 8.00000000000000029e-97 < d4 < 2.55000000000000014e120Initial program 90.0%
associate--l+90.0%
sub-neg90.0%
associate-+l+90.0%
+-commutative90.0%
--rgt-identity90.0%
associate--r-90.0%
associate-+r-90.0%
+-commutative90.0%
*-commutative90.0%
sub-neg90.0%
distribute-lft-out--91.8%
distribute-lft-out--96.4%
neg-sub096.4%
distribute-rgt-neg-out96.4%
distribute-lft-out--100.0%
sub-neg100.0%
remove-double-neg100.0%
Simplified100.0%
Taylor expanded in d4 around 0 85.7%
Taylor expanded in d1 around 0 64.3%
if 8.1999999999999998e-107 < d4 < 8.00000000000000029e-97Initial program 100.0%
associate--l+100.0%
sub-neg100.0%
associate-+l+100.0%
+-commutative100.0%
--rgt-identity100.0%
associate--r-100.0%
associate-+r-100.0%
+-commutative100.0%
*-commutative100.0%
sub-neg100.0%
distribute-lft-out--100.0%
distribute-lft-out--100.0%
neg-sub0100.0%
distribute-rgt-neg-out100.0%
distribute-lft-out--100.0%
sub-neg100.0%
remove-double-neg100.0%
Simplified100.0%
Taylor expanded in d1 around inf 52.8%
unpow252.8%
mul-1-neg52.8%
distribute-rgt-neg-out52.8%
Simplified52.8%
if 2.55000000000000014e120 < d4 Initial program 85.3%
associate--l+85.3%
sub-neg85.3%
associate-+l+85.3%
+-commutative85.3%
--rgt-identity85.3%
associate--r-85.3%
associate-+r-85.3%
+-commutative85.3%
*-commutative85.3%
sub-neg85.3%
distribute-lft-out--85.2%
distribute-lft-out--97.0%
neg-sub097.0%
distribute-rgt-neg-out97.0%
distribute-lft-out--100.0%
sub-neg100.0%
remove-double-neg100.0%
Simplified100.0%
Taylor expanded in d1 around 0 93.5%
Taylor expanded in d3 around 0 75.6%
+-commutative75.6%
Simplified75.6%
Final simplification65.7%
(FPCore (d1 d2 d3 d4) :precision binary64 (if (<= d1 -1.75e+161) (* d1 (- (- d1) d3)) (if (<= d1 1.5e+102) (* d1 (- (+ d4 d2) d3)) (* d1 (- d4 d1)))))
double code(double d1, double d2, double d3, double d4) {
double tmp;
if (d1 <= -1.75e+161) {
tmp = d1 * (-d1 - d3);
} else if (d1 <= 1.5e+102) {
tmp = d1 * ((d4 + d2) - 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 (d1 <= (-1.75d+161)) then
tmp = d1 * (-d1 - d3)
else if (d1 <= 1.5d+102) then
tmp = d1 * ((d4 + d2) - 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 (d1 <= -1.75e+161) {
tmp = d1 * (-d1 - d3);
} else if (d1 <= 1.5e+102) {
tmp = d1 * ((d4 + d2) - d3);
} else {
tmp = d1 * (d4 - d1);
}
return tmp;
}
def code(d1, d2, d3, d4): tmp = 0 if d1 <= -1.75e+161: tmp = d1 * (-d1 - d3) elif d1 <= 1.5e+102: tmp = d1 * ((d4 + d2) - d3) else: tmp = d1 * (d4 - d1) return tmp
function code(d1, d2, d3, d4) tmp = 0.0 if (d1 <= -1.75e+161) tmp = Float64(d1 * Float64(Float64(-d1) - d3)); elseif (d1 <= 1.5e+102) tmp = Float64(d1 * Float64(Float64(d4 + d2) - d3)); else tmp = Float64(d1 * Float64(d4 - d1)); end return tmp end
function tmp_2 = code(d1, d2, d3, d4) tmp = 0.0; if (d1 <= -1.75e+161) tmp = d1 * (-d1 - d3); elseif (d1 <= 1.5e+102) tmp = d1 * ((d4 + d2) - d3); else tmp = d1 * (d4 - d1); end tmp_2 = tmp; end
code[d1_, d2_, d3_, d4_] := If[LessEqual[d1, -1.75e+161], N[(d1 * N[((-d1) - d3), $MachinePrecision]), $MachinePrecision], If[LessEqual[d1, 1.5e+102], N[(d1 * N[(N[(d4 + d2), $MachinePrecision] - d3), $MachinePrecision]), $MachinePrecision], N[(d1 * N[(d4 - d1), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;d1 \leq -1.75 \cdot 10^{+161}:\\
\;\;\;\;d1 \cdot \left(\left(-d1\right) - d3\right)\\
\mathbf{elif}\;d1 \leq 1.5 \cdot 10^{+102}:\\
\;\;\;\;d1 \cdot \left(\left(d4 + d2\right) - d3\right)\\
\mathbf{else}:\\
\;\;\;\;d1 \cdot \left(d4 - d1\right)\\
\end{array}
\end{array}
if d1 < -1.74999999999999994e161Initial program 58.6%
associate--l+58.6%
sub-neg58.6%
associate-+l+58.6%
+-commutative58.6%
--rgt-identity58.6%
associate--r-58.6%
associate-+r-58.6%
+-commutative58.6%
*-commutative58.6%
sub-neg58.6%
distribute-lft-out--62.1%
distribute-lft-out--86.2%
neg-sub086.2%
distribute-rgt-neg-out86.2%
distribute-lft-out--100.0%
sub-neg100.0%
remove-double-neg100.0%
Simplified100.0%
Taylor expanded in d4 around 0 89.7%
Taylor expanded in d2 around 0 89.7%
mul-1-neg89.7%
distribute-rgt-neg-in89.7%
Simplified89.7%
if -1.74999999999999994e161 < d1 < 1.4999999999999999e102Initial program 96.6%
associate--l+96.6%
sub-neg96.6%
associate-+l+96.6%
+-commutative96.6%
--rgt-identity96.6%
associate--r-96.6%
associate-+r-96.6%
+-commutative96.6%
*-commutative96.6%
sub-neg96.6%
distribute-lft-out--97.7%
distribute-lft-out--97.8%
neg-sub097.8%
distribute-rgt-neg-out97.8%
distribute-lft-out--100.0%
sub-neg100.0%
remove-double-neg100.0%
Simplified100.0%
Taylor expanded in d1 around 0 92.8%
if 1.4999999999999999e102 < d1 Initial program 81.3%
associate--l+81.3%
sub-neg81.3%
associate-+l+81.3%
+-commutative81.3%
--rgt-identity81.3%
associate--r-81.3%
associate-+r-81.3%
+-commutative81.3%
*-commutative81.3%
sub-neg81.3%
distribute-lft-out--83.3%
distribute-lft-out--97.9%
neg-sub097.9%
distribute-rgt-neg-out97.9%
distribute-lft-out--100.0%
sub-neg100.0%
remove-double-neg100.0%
Simplified100.0%
Taylor expanded in d2 around 0 94.1%
associate--r+94.1%
Simplified94.1%
Taylor expanded in d3 around 0 81.6%
Final simplification90.4%
(FPCore (d1 d2 d3 d4)
:precision binary64
(if (<= d2 -6.8e+64)
(* d1 d2)
(if (<= d2 -6.2e-76)
(* d1 (- d1))
(if (<= d2 3.1e-193) (* d1 (- d3)) (* d1 d4)))))
double code(double d1, double d2, double d3, double d4) {
double tmp;
if (d2 <= -6.8e+64) {
tmp = d1 * d2;
} else if (d2 <= -6.2e-76) {
tmp = d1 * -d1;
} else if (d2 <= 3.1e-193) {
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 <= (-6.8d+64)) then
tmp = d1 * d2
else if (d2 <= (-6.2d-76)) then
tmp = d1 * -d1
else if (d2 <= 3.1d-193) 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 <= -6.8e+64) {
tmp = d1 * d2;
} else if (d2 <= -6.2e-76) {
tmp = d1 * -d1;
} else if (d2 <= 3.1e-193) {
tmp = d1 * -d3;
} else {
tmp = d1 * d4;
}
return tmp;
}
def code(d1, d2, d3, d4): tmp = 0 if d2 <= -6.8e+64: tmp = d1 * d2 elif d2 <= -6.2e-76: tmp = d1 * -d1 elif d2 <= 3.1e-193: tmp = d1 * -d3 else: tmp = d1 * d4 return tmp
function code(d1, d2, d3, d4) tmp = 0.0 if (d2 <= -6.8e+64) tmp = Float64(d1 * d2); elseif (d2 <= -6.2e-76) tmp = Float64(d1 * Float64(-d1)); elseif (d2 <= 3.1e-193) 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 <= -6.8e+64) tmp = d1 * d2; elseif (d2 <= -6.2e-76) tmp = d1 * -d1; elseif (d2 <= 3.1e-193) tmp = d1 * -d3; else tmp = d1 * d4; end tmp_2 = tmp; end
code[d1_, d2_, d3_, d4_] := If[LessEqual[d2, -6.8e+64], N[(d1 * d2), $MachinePrecision], If[LessEqual[d2, -6.2e-76], N[(d1 * (-d1)), $MachinePrecision], If[LessEqual[d2, 3.1e-193], N[(d1 * (-d3)), $MachinePrecision], N[(d1 * d4), $MachinePrecision]]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;d2 \leq -6.8 \cdot 10^{+64}:\\
\;\;\;\;d1 \cdot d2\\
\mathbf{elif}\;d2 \leq -6.2 \cdot 10^{-76}:\\
\;\;\;\;d1 \cdot \left(-d1\right)\\
\mathbf{elif}\;d2 \leq 3.1 \cdot 10^{-193}:\\
\;\;\;\;d1 \cdot \left(-d3\right)\\
\mathbf{else}:\\
\;\;\;\;d1 \cdot d4\\
\end{array}
\end{array}
if d2 < -6.8000000000000003e64Initial program 90.3%
associate--l+90.3%
sub-neg90.3%
associate-+l+90.3%
+-commutative90.3%
--rgt-identity90.3%
associate--r-90.3%
associate-+r-90.3%
+-commutative90.3%
*-commutative90.3%
sub-neg90.3%
distribute-lft-out--90.3%
distribute-lft-out--91.9%
neg-sub091.9%
distribute-rgt-neg-out91.9%
distribute-lft-out--100.0%
sub-neg100.0%
remove-double-neg100.0%
Simplified100.0%
Taylor expanded in d2 around inf 69.0%
if -6.8000000000000003e64 < d2 < -6.19999999999999939e-76Initial program 76.2%
associate--l+76.2%
sub-neg76.2%
associate-+l+76.2%
+-commutative76.2%
--rgt-identity76.2%
associate--r-76.2%
associate-+r-76.2%
+-commutative76.2%
*-commutative76.2%
sub-neg76.2%
distribute-lft-out--76.2%
distribute-lft-out--100.0%
neg-sub0100.0%
distribute-rgt-neg-out100.0%
distribute-lft-out--100.0%
sub-neg100.0%
remove-double-neg100.0%
Simplified100.0%
Taylor expanded in d1 around inf 35.1%
unpow235.1%
mul-1-neg35.1%
distribute-rgt-neg-out35.1%
Simplified35.1%
if -6.19999999999999939e-76 < d2 < 3.1000000000000002e-193Initial program 92.5%
associate--l+92.5%
sub-neg92.5%
associate-+l+92.5%
+-commutative92.5%
--rgt-identity92.5%
associate--r-92.5%
associate-+r-92.5%
+-commutative92.5%
*-commutative92.5%
sub-neg92.5%
distribute-lft-out--97.0%
distribute-lft-out--100.0%
neg-sub0100.0%
distribute-rgt-neg-out100.0%
distribute-lft-out--100.0%
sub-neg100.0%
remove-double-neg100.0%
Simplified100.0%
Taylor expanded in d3 around inf 43.5%
associate-*r*43.5%
neg-mul-143.5%
Simplified43.5%
if 3.1000000000000002e-193 < d2 Initial program 89.6%
associate--l+89.6%
sub-neg89.6%
associate-+l+89.6%
+-commutative89.6%
--rgt-identity89.6%
associate--r-89.6%
associate-+r-89.6%
+-commutative89.6%
*-commutative89.6%
sub-neg89.6%
distribute-lft-out--90.6%
distribute-lft-out--96.2%
neg-sub096.2%
distribute-rgt-neg-out96.2%
distribute-lft-out--100.0%
sub-neg100.0%
remove-double-neg100.0%
Simplified100.0%
Taylor expanded in d4 around inf 24.9%
Final simplification41.3%
(FPCore (d1 d2 d3 d4) :precision binary64 (if (<= d2 -6e+63) (* d1 (- (+ d4 d2) d3)) (* d1 (- (- d4 d1) d3))))
double code(double d1, double d2, double d3, double d4) {
double tmp;
if (d2 <= -6e+63) {
tmp = d1 * ((d4 + d2) - d3);
} else {
tmp = d1 * ((d4 - d1) - d3);
}
return tmp;
}
real(8) function code(d1, d2, d3, d4)
real(8), intent (in) :: d1
real(8), intent (in) :: d2
real(8), intent (in) :: d3
real(8), intent (in) :: d4
real(8) :: tmp
if (d2 <= (-6d+63)) then
tmp = d1 * ((d4 + d2) - d3)
else
tmp = d1 * ((d4 - d1) - d3)
end if
code = tmp
end function
public static double code(double d1, double d2, double d3, double d4) {
double tmp;
if (d2 <= -6e+63) {
tmp = d1 * ((d4 + d2) - d3);
} else {
tmp = d1 * ((d4 - d1) - d3);
}
return tmp;
}
def code(d1, d2, d3, d4): tmp = 0 if d2 <= -6e+63: tmp = d1 * ((d4 + d2) - d3) else: tmp = d1 * ((d4 - d1) - d3) return tmp
function code(d1, d2, d3, d4) tmp = 0.0 if (d2 <= -6e+63) tmp = Float64(d1 * Float64(Float64(d4 + d2) - d3)); else tmp = Float64(d1 * Float64(Float64(d4 - d1) - d3)); end return tmp end
function tmp_2 = code(d1, d2, d3, d4) tmp = 0.0; if (d2 <= -6e+63) tmp = d1 * ((d4 + d2) - d3); else tmp = d1 * ((d4 - d1) - d3); end tmp_2 = tmp; end
code[d1_, d2_, d3_, d4_] := If[LessEqual[d2, -6e+63], N[(d1 * N[(N[(d4 + d2), $MachinePrecision] - d3), $MachinePrecision]), $MachinePrecision], N[(d1 * N[(N[(d4 - d1), $MachinePrecision] - d3), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;d2 \leq -6 \cdot 10^{+63}:\\
\;\;\;\;d1 \cdot \left(\left(d4 + d2\right) - d3\right)\\
\mathbf{else}:\\
\;\;\;\;d1 \cdot \left(\left(d4 - d1\right) - d3\right)\\
\end{array}
\end{array}
if d2 < -5.99999999999999998e63Initial program 90.3%
associate--l+90.3%
sub-neg90.3%
associate-+l+90.3%
+-commutative90.3%
--rgt-identity90.3%
associate--r-90.3%
associate-+r-90.3%
+-commutative90.3%
*-commutative90.3%
sub-neg90.3%
distribute-lft-out--90.3%
distribute-lft-out--91.9%
neg-sub091.9%
distribute-rgt-neg-out91.9%
distribute-lft-out--100.0%
sub-neg100.0%
remove-double-neg100.0%
Simplified100.0%
Taylor expanded in d1 around 0 93.5%
if -5.99999999999999998e63 < d2 Initial program 89.2%
associate--l+89.2%
sub-neg89.2%
associate-+l+89.2%
+-commutative89.2%
--rgt-identity89.2%
associate--r-89.2%
associate-+r-89.2%
+-commutative89.2%
*-commutative89.2%
sub-neg89.2%
distribute-lft-out--91.2%
distribute-lft-out--97.9%
neg-sub097.9%
distribute-rgt-neg-out97.9%
distribute-lft-out--100.0%
sub-neg100.0%
remove-double-neg100.0%
Simplified100.0%
Taylor expanded in d2 around 0 86.4%
associate--r+86.4%
Simplified86.4%
Final simplification88.1%
(FPCore (d1 d2 d3 d4) :precision binary64 (if (<= d4 7.5e+44) (* d1 (- d2 (+ d1 d3))) (* d1 (- (- d4 d1) d3))))
double code(double d1, double d2, double d3, double d4) {
double tmp;
if (d4 <= 7.5e+44) {
tmp = d1 * (d2 - (d1 + d3));
} else {
tmp = d1 * ((d4 - d1) - d3);
}
return tmp;
}
real(8) function code(d1, d2, d3, d4)
real(8), intent (in) :: d1
real(8), intent (in) :: d2
real(8), intent (in) :: d3
real(8), intent (in) :: d4
real(8) :: tmp
if (d4 <= 7.5d+44) then
tmp = d1 * (d2 - (d1 + d3))
else
tmp = d1 * ((d4 - d1) - d3)
end if
code = tmp
end function
public static double code(double d1, double d2, double d3, double d4) {
double tmp;
if (d4 <= 7.5e+44) {
tmp = d1 * (d2 - (d1 + d3));
} else {
tmp = d1 * ((d4 - d1) - d3);
}
return tmp;
}
def code(d1, d2, d3, d4): tmp = 0 if d4 <= 7.5e+44: tmp = d1 * (d2 - (d1 + d3)) else: tmp = d1 * ((d4 - d1) - d3) return tmp
function code(d1, d2, d3, d4) tmp = 0.0 if (d4 <= 7.5e+44) tmp = Float64(d1 * Float64(d2 - Float64(d1 + d3))); else tmp = Float64(d1 * Float64(Float64(d4 - d1) - d3)); end return tmp end
function tmp_2 = code(d1, d2, d3, d4) tmp = 0.0; if (d4 <= 7.5e+44) tmp = d1 * (d2 - (d1 + d3)); else tmp = d1 * ((d4 - d1) - d3); end tmp_2 = tmp; end
code[d1_, d2_, d3_, d4_] := If[LessEqual[d4, 7.5e+44], N[(d1 * N[(d2 - N[(d1 + d3), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(d1 * N[(N[(d4 - d1), $MachinePrecision] - d3), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;d4 \leq 7.5 \cdot 10^{+44}:\\
\;\;\;\;d1 \cdot \left(d2 - \left(d1 + d3\right)\right)\\
\mathbf{else}:\\
\;\;\;\;d1 \cdot \left(\left(d4 - d1\right) - d3\right)\\
\end{array}
\end{array}
if d4 < 7.50000000000000027e44Initial program 90.5%
associate--l+90.5%
sub-neg90.5%
associate-+l+90.5%
+-commutative90.5%
--rgt-identity90.5%
associate--r-90.5%
associate-+r-90.5%
+-commutative90.5%
*-commutative90.5%
sub-neg90.5%
distribute-lft-out--92.4%
distribute-lft-out--96.2%
neg-sub096.2%
distribute-rgt-neg-out96.2%
distribute-lft-out--100.0%
sub-neg100.0%
remove-double-neg100.0%
Simplified100.0%
Taylor expanded in d4 around 0 86.0%
if 7.50000000000000027e44 < d4 Initial program 84.8%
associate--l+84.8%
sub-neg84.8%
associate-+l+84.8%
+-commutative84.8%
--rgt-identity84.8%
associate--r-84.8%
associate-+r-84.8%
+-commutative84.8%
*-commutative84.8%
sub-neg84.8%
distribute-lft-out--84.7%
distribute-lft-out--97.8%
neg-sub097.8%
distribute-rgt-neg-out97.8%
distribute-lft-out--100.0%
sub-neg100.0%
remove-double-neg100.0%
Simplified100.0%
Taylor expanded in d2 around 0 85.2%
associate--r+85.2%
Simplified85.2%
Final simplification85.8%
(FPCore (d1 d2 d3 d4) :precision binary64 (if (<= d2 -6.2e+64) (* d1 d2) (if (<= d2 3.3e-277) (* d1 (- d1)) (* d1 d4))))
double code(double d1, double d2, double d3, double d4) {
double tmp;
if (d2 <= -6.2e+64) {
tmp = d1 * d2;
} else if (d2 <= 3.3e-277) {
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 <= (-6.2d+64)) then
tmp = d1 * d2
else if (d2 <= 3.3d-277) 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 <= -6.2e+64) {
tmp = d1 * d2;
} else if (d2 <= 3.3e-277) {
tmp = d1 * -d1;
} else {
tmp = d1 * d4;
}
return tmp;
}
def code(d1, d2, d3, d4): tmp = 0 if d2 <= -6.2e+64: tmp = d1 * d2 elif d2 <= 3.3e-277: tmp = d1 * -d1 else: tmp = d1 * d4 return tmp
function code(d1, d2, d3, d4) tmp = 0.0 if (d2 <= -6.2e+64) tmp = Float64(d1 * d2); elseif (d2 <= 3.3e-277) 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 <= -6.2e+64) tmp = d1 * d2; elseif (d2 <= 3.3e-277) tmp = d1 * -d1; else tmp = d1 * d4; end tmp_2 = tmp; end
code[d1_, d2_, d3_, d4_] := If[LessEqual[d2, -6.2e+64], N[(d1 * d2), $MachinePrecision], If[LessEqual[d2, 3.3e-277], N[(d1 * (-d1)), $MachinePrecision], N[(d1 * d4), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;d2 \leq -6.2 \cdot 10^{+64}:\\
\;\;\;\;d1 \cdot d2\\
\mathbf{elif}\;d2 \leq 3.3 \cdot 10^{-277}:\\
\;\;\;\;d1 \cdot \left(-d1\right)\\
\mathbf{else}:\\
\;\;\;\;d1 \cdot d4\\
\end{array}
\end{array}
if d2 < -6.1999999999999998e64Initial program 90.3%
associate--l+90.3%
sub-neg90.3%
associate-+l+90.3%
+-commutative90.3%
--rgt-identity90.3%
associate--r-90.3%
associate-+r-90.3%
+-commutative90.3%
*-commutative90.3%
sub-neg90.3%
distribute-lft-out--90.3%
distribute-lft-out--91.9%
neg-sub091.9%
distribute-rgt-neg-out91.9%
distribute-lft-out--100.0%
sub-neg100.0%
remove-double-neg100.0%
Simplified100.0%
Taylor expanded in d2 around inf 69.0%
if -6.1999999999999998e64 < d2 < 3.29999999999999981e-277Initial program 86.8%
associate--l+86.8%
sub-neg86.8%
associate-+l+86.8%
+-commutative86.8%
--rgt-identity86.8%
associate--r-86.8%
associate-+r-86.8%
+-commutative86.8%
*-commutative86.8%
sub-neg86.8%
distribute-lft-out--90.8%
distribute-lft-out--100.0%
neg-sub0100.0%
distribute-rgt-neg-out100.0%
distribute-lft-out--100.0%
sub-neg100.0%
remove-double-neg100.0%
Simplified100.0%
Taylor expanded in d1 around inf 39.9%
unpow239.9%
mul-1-neg39.9%
distribute-rgt-neg-out39.9%
Simplified39.9%
if 3.29999999999999981e-277 < d2 Initial program 90.7%
associate--l+90.7%
sub-neg90.7%
associate-+l+90.7%
+-commutative90.7%
--rgt-identity90.7%
associate--r-90.7%
associate-+r-90.7%
+-commutative90.7%
*-commutative90.7%
sub-neg90.7%
distribute-lft-out--91.5%
distribute-lft-out--96.6%
neg-sub096.6%
distribute-rgt-neg-out96.6%
distribute-lft-out--100.0%
sub-neg100.0%
remove-double-neg100.0%
Simplified100.0%
Taylor expanded in d4 around inf 27.5%
Final simplification41.2%
(FPCore (d1 d2 d3 d4) :precision binary64 (if (<= d4 1.36e+45) (* d1 d2) (* d1 d4)))
double code(double d1, double d2, double d3, double d4) {
double tmp;
if (d4 <= 1.36e+45) {
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 <= 1.36d+45) 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 <= 1.36e+45) {
tmp = d1 * d2;
} else {
tmp = d1 * d4;
}
return tmp;
}
def code(d1, d2, d3, d4): tmp = 0 if d4 <= 1.36e+45: tmp = d1 * d2 else: tmp = d1 * d4 return tmp
function code(d1, d2, d3, d4) tmp = 0.0 if (d4 <= 1.36e+45) 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 <= 1.36e+45) tmp = d1 * d2; else tmp = d1 * d4; end tmp_2 = tmp; end
code[d1_, d2_, d3_, d4_] := If[LessEqual[d4, 1.36e+45], N[(d1 * d2), $MachinePrecision], N[(d1 * d4), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;d4 \leq 1.36 \cdot 10^{+45}:\\
\;\;\;\;d1 \cdot d2\\
\mathbf{else}:\\
\;\;\;\;d1 \cdot d4\\
\end{array}
\end{array}
if d4 < 1.36e45Initial program 90.5%
associate--l+90.5%
sub-neg90.5%
associate-+l+90.5%
+-commutative90.5%
--rgt-identity90.5%
associate--r-90.5%
associate-+r-90.5%
+-commutative90.5%
*-commutative90.5%
sub-neg90.5%
distribute-lft-out--92.4%
distribute-lft-out--96.2%
neg-sub096.2%
distribute-rgt-neg-out96.2%
distribute-lft-out--100.0%
sub-neg100.0%
remove-double-neg100.0%
Simplified100.0%
Taylor expanded in d2 around inf 35.4%
if 1.36e45 < d4 Initial program 84.8%
associate--l+84.8%
sub-neg84.8%
associate-+l+84.8%
+-commutative84.8%
--rgt-identity84.8%
associate--r-84.8%
associate-+r-84.8%
+-commutative84.8%
*-commutative84.8%
sub-neg84.8%
distribute-lft-out--84.7%
distribute-lft-out--97.8%
neg-sub097.8%
distribute-rgt-neg-out97.8%
distribute-lft-out--100.0%
sub-neg100.0%
remove-double-neg100.0%
Simplified100.0%
Taylor expanded in d4 around inf 48.1%
Final simplification37.7%
(FPCore (d1 d2 d3 d4) :precision binary64 (* d1 d4))
double code(double d1, double d2, double d3, double d4) {
return d1 * d4;
}
real(8) function code(d1, d2, d3, d4)
real(8), intent (in) :: d1
real(8), intent (in) :: d2
real(8), intent (in) :: d3
real(8), intent (in) :: d4
code = d1 * d4
end function
public static double code(double d1, double d2, double d3, double d4) {
return d1 * d4;
}
def code(d1, d2, d3, d4): return d1 * d4
function code(d1, d2, d3, d4) return Float64(d1 * d4) end
function tmp = code(d1, d2, d3, d4) tmp = d1 * d4; end
code[d1_, d2_, d3_, d4_] := N[(d1 * d4), $MachinePrecision]
\begin{array}{l}
\\
d1 \cdot d4
\end{array}
Initial program 89.4%
associate--l+89.4%
sub-neg89.4%
associate-+l+89.4%
+-commutative89.4%
--rgt-identity89.4%
associate--r-89.4%
associate-+r-89.4%
+-commutative89.4%
*-commutative89.4%
sub-neg89.4%
distribute-lft-out--91.0%
distribute-lft-out--96.5%
neg-sub096.5%
distribute-rgt-neg-out96.5%
distribute-lft-out--100.0%
sub-neg100.0%
remove-double-neg100.0%
Simplified100.0%
Taylor expanded in d4 around inf 28.0%
Final simplification28.0%
(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 2023268
(FPCore (d1 d2 d3 d4)
:name "FastMath dist4"
:precision binary64
:herbie-target
(* d1 (- (+ (- d2 d3) d4) d1))
(- (+ (- (* d1 d2) (* d1 d3)) (* d4 d1)) (* d1 d1)))