
(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 14 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 90.2%
associate--l+90.2%
sub-neg90.2%
associate-+l+90.2%
+-commutative90.2%
--rgt-identity90.2%
associate--r-90.2%
associate-+r-90.2%
+-commutative90.2%
*-commutative90.2%
sub-neg90.2%
distribute-lft-out--90.6%
distribute-lft-out--96.1%
neg-sub096.1%
distribute-rgt-neg-out96.1%
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 (- d2 d3))) (t_1 (* d1 (- (+ d4 d2) d1))))
(if (<= d3 -1.15e+142)
t_0
(if (<= d3 -3.4e+63)
t_1
(if (<= d3 -0.135)
t_0
(if (<= d3 -2.9e-26)
(* d1 (- d4 d3))
(if (<= d3 3.4e+99) t_1 (* d1 (- (- d3) d1)))))))))
double code(double d1, double d2, double d3, double d4) {
double t_0 = d1 * (d2 - d3);
double t_1 = d1 * ((d4 + d2) - d1);
double tmp;
if (d3 <= -1.15e+142) {
tmp = t_0;
} else if (d3 <= -3.4e+63) {
tmp = t_1;
} else if (d3 <= -0.135) {
tmp = t_0;
} else if (d3 <= -2.9e-26) {
tmp = d1 * (d4 - d3);
} else if (d3 <= 3.4e+99) {
tmp = t_1;
} else {
tmp = d1 * (-d3 - 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 - d3)
t_1 = d1 * ((d4 + d2) - d1)
if (d3 <= (-1.15d+142)) then
tmp = t_0
else if (d3 <= (-3.4d+63)) then
tmp = t_1
else if (d3 <= (-0.135d0)) then
tmp = t_0
else if (d3 <= (-2.9d-26)) then
tmp = d1 * (d4 - d3)
else if (d3 <= 3.4d+99) then
tmp = t_1
else
tmp = d1 * (-d3 - 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 t_1 = d1 * ((d4 + d2) - d1);
double tmp;
if (d3 <= -1.15e+142) {
tmp = t_0;
} else if (d3 <= -3.4e+63) {
tmp = t_1;
} else if (d3 <= -0.135) {
tmp = t_0;
} else if (d3 <= -2.9e-26) {
tmp = d1 * (d4 - d3);
} else if (d3 <= 3.4e+99) {
tmp = t_1;
} else {
tmp = d1 * (-d3 - d1);
}
return tmp;
}
def code(d1, d2, d3, d4): t_0 = d1 * (d2 - d3) t_1 = d1 * ((d4 + d2) - d1) tmp = 0 if d3 <= -1.15e+142: tmp = t_0 elif d3 <= -3.4e+63: tmp = t_1 elif d3 <= -0.135: tmp = t_0 elif d3 <= -2.9e-26: tmp = d1 * (d4 - d3) elif d3 <= 3.4e+99: tmp = t_1 else: tmp = d1 * (-d3 - d1) return tmp
function code(d1, d2, d3, d4) t_0 = Float64(d1 * Float64(d2 - d3)) t_1 = Float64(d1 * Float64(Float64(d4 + d2) - d1)) tmp = 0.0 if (d3 <= -1.15e+142) tmp = t_0; elseif (d3 <= -3.4e+63) tmp = t_1; elseif (d3 <= -0.135) tmp = t_0; elseif (d3 <= -2.9e-26) tmp = Float64(d1 * Float64(d4 - d3)); elseif (d3 <= 3.4e+99) tmp = t_1; else tmp = Float64(d1 * Float64(Float64(-d3) - d1)); end return tmp end
function tmp_2 = code(d1, d2, d3, d4) t_0 = d1 * (d2 - d3); t_1 = d1 * ((d4 + d2) - d1); tmp = 0.0; if (d3 <= -1.15e+142) tmp = t_0; elseif (d3 <= -3.4e+63) tmp = t_1; elseif (d3 <= -0.135) tmp = t_0; elseif (d3 <= -2.9e-26) tmp = d1 * (d4 - d3); elseif (d3 <= 3.4e+99) tmp = t_1; else tmp = d1 * (-d3 - d1); end tmp_2 = tmp; end
code[d1_, d2_, d3_, d4_] := Block[{t$95$0 = N[(d1 * N[(d2 - d3), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$1 = N[(d1 * N[(N[(d4 + d2), $MachinePrecision] - d1), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[d3, -1.15e+142], t$95$0, If[LessEqual[d3, -3.4e+63], t$95$1, If[LessEqual[d3, -0.135], t$95$0, If[LessEqual[d3, -2.9e-26], N[(d1 * N[(d4 - d3), $MachinePrecision]), $MachinePrecision], If[LessEqual[d3, 3.4e+99], t$95$1, N[(d1 * N[((-d3) - d1), $MachinePrecision]), $MachinePrecision]]]]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := d1 \cdot \left(d2 - d3\right)\\
t_1 := d1 \cdot \left(\left(d4 + d2\right) - d1\right)\\
\mathbf{if}\;d3 \leq -1.15 \cdot 10^{+142}:\\
\;\;\;\;t_0\\
\mathbf{elif}\;d3 \leq -3.4 \cdot 10^{+63}:\\
\;\;\;\;t_1\\
\mathbf{elif}\;d3 \leq -0.135:\\
\;\;\;\;t_0\\
\mathbf{elif}\;d3 \leq -2.9 \cdot 10^{-26}:\\
\;\;\;\;d1 \cdot \left(d4 - d3\right)\\
\mathbf{elif}\;d3 \leq 3.4 \cdot 10^{+99}:\\
\;\;\;\;t_1\\
\mathbf{else}:\\
\;\;\;\;d1 \cdot \left(\left(-d3\right) - d1\right)\\
\end{array}
\end{array}
if d3 < -1.15000000000000001e142 or -3.3999999999999999e63 < d3 < -0.13500000000000001Initial program 85.9%
associate--l+85.9%
sub-neg85.9%
associate-+l+85.9%
+-commutative85.9%
--rgt-identity85.9%
associate--r-85.9%
associate-+r-85.9%
+-commutative85.9%
*-commutative85.9%
sub-neg85.9%
distribute-lft-out--87.7%
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 0 87.6%
Taylor expanded in d1 around 0 82.3%
if -1.15000000000000001e142 < d3 < -3.3999999999999999e63 or -2.8999999999999998e-26 < d3 < 3.39999999999999984e99Initial program 93.0%
associate--l+93.0%
sub-neg93.0%
associate-+l+93.0%
+-commutative93.0%
--rgt-identity93.0%
associate--r-93.0%
associate-+r-93.0%
+-commutative93.0%
*-commutative93.0%
sub-neg93.0%
distribute-lft-out--93.0%
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 d3 around 0 94.7%
if -0.13500000000000001 < d3 < -2.8999999999999998e-26Initial 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 0 100.0%
Taylor expanded in d2 around 0 68.4%
if 3.39999999999999984e99 < d3 Initial program 83.3%
associate--l+83.3%
sub-neg83.3%
associate-+l+83.3%
+-commutative83.3%
--rgt-identity83.3%
associate--r-83.3%
associate-+r-83.3%
+-commutative83.3%
*-commutative83.3%
sub-neg83.3%
distribute-lft-out--83.3%
distribute-lft-out--94.4%
neg-sub094.4%
distribute-rgt-neg-out94.4%
distribute-lft-out--100.0%
sub-neg100.0%
remove-double-neg100.0%
Simplified100.0%
Taylor expanded in d4 around 0 94.4%
Taylor expanded in d2 around 0 86.6%
mul-1-neg86.6%
distribute-rgt-neg-in86.6%
Simplified86.6%
Final simplification90.2%
(FPCore (d1 d2 d3 d4)
:precision binary64
(let* ((t_0 (* d1 (- d3))) (t_1 (* d1 (+ d4 d2))))
(if (<= d3 -2.5e+73)
t_0
(if (<= d3 -7e-137)
t_1
(if (<= d3 17.0) (* d1 (- d2 d1)) (if (<= d3 1.95e+100) 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 <= -2.5e+73) {
tmp = t_0;
} else if (d3 <= -7e-137) {
tmp = t_1;
} else if (d3 <= 17.0) {
tmp = d1 * (d2 - d1);
} else if (d3 <= 1.95e+100) {
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 <= (-2.5d+73)) then
tmp = t_0
else if (d3 <= (-7d-137)) then
tmp = t_1
else if (d3 <= 17.0d0) then
tmp = d1 * (d2 - d1)
else if (d3 <= 1.95d+100) 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 <= -2.5e+73) {
tmp = t_0;
} else if (d3 <= -7e-137) {
tmp = t_1;
} else if (d3 <= 17.0) {
tmp = d1 * (d2 - d1);
} else if (d3 <= 1.95e+100) {
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 <= -2.5e+73: tmp = t_0 elif d3 <= -7e-137: tmp = t_1 elif d3 <= 17.0: tmp = d1 * (d2 - d1) elif d3 <= 1.95e+100: 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 <= -2.5e+73) tmp = t_0; elseif (d3 <= -7e-137) tmp = t_1; elseif (d3 <= 17.0) tmp = Float64(d1 * Float64(d2 - d1)); elseif (d3 <= 1.95e+100) 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 <= -2.5e+73) tmp = t_0; elseif (d3 <= -7e-137) tmp = t_1; elseif (d3 <= 17.0) tmp = d1 * (d2 - d1); elseif (d3 <= 1.95e+100) 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, -2.5e+73], t$95$0, If[LessEqual[d3, -7e-137], t$95$1, If[LessEqual[d3, 17.0], N[(d1 * N[(d2 - d1), $MachinePrecision]), $MachinePrecision], If[LessEqual[d3, 1.95e+100], 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 -2.5 \cdot 10^{+73}:\\
\;\;\;\;t_0\\
\mathbf{elif}\;d3 \leq -7 \cdot 10^{-137}:\\
\;\;\;\;t_1\\
\mathbf{elif}\;d3 \leq 17:\\
\;\;\;\;d1 \cdot \left(d2 - d1\right)\\
\mathbf{elif}\;d3 \leq 1.95 \cdot 10^{+100}:\\
\;\;\;\;t_1\\
\mathbf{else}:\\
\;\;\;\;t_0\\
\end{array}
\end{array}
if d3 < -2.49999999999999988e73 or 1.95e100 < d3 Initial program 83.1%
associate--l+83.1%
sub-neg83.1%
associate-+l+83.1%
+-commutative83.1%
--rgt-identity83.1%
associate--r-83.1%
associate-+r-83.1%
+-commutative83.1%
*-commutative83.1%
sub-neg83.1%
distribute-lft-out--84.2%
distribute-lft-out--94.7%
neg-sub094.7%
distribute-rgt-neg-out94.7%
distribute-lft-out--100.0%
sub-neg100.0%
remove-double-neg100.0%
Simplified100.0%
Taylor expanded in d3 around inf 71.9%
associate-*r*71.9%
neg-mul-171.9%
Simplified71.9%
if -2.49999999999999988e73 < d3 < -7.0000000000000002e-137 or 17 < d3 < 1.95e100Initial program 92.3%
associate--l+92.3%
sub-neg92.3%
associate-+l+92.3%
+-commutative92.3%
--rgt-identity92.3%
associate--r-92.3%
associate-+r-92.3%
+-commutative92.3%
*-commutative92.3%
sub-neg92.3%
distribute-lft-out--92.3%
distribute-lft-out--96.9%
neg-sub096.9%
distribute-rgt-neg-out96.9%
distribute-lft-out--100.0%
sub-neg100.0%
remove-double-neg100.0%
Simplified100.0%
Taylor expanded in d3 around 0 83.9%
Taylor expanded in d1 around 0 73.3%
if -7.0000000000000002e-137 < d3 < 17Initial program 95.8%
associate--l+95.8%
sub-neg95.8%
associate-+l+95.8%
+-commutative95.8%
--rgt-identity95.8%
associate--r-95.8%
associate-+r-95.8%
+-commutative95.8%
*-commutative95.8%
sub-neg95.8%
distribute-lft-out--95.8%
distribute-lft-out--96.9%
neg-sub096.9%
distribute-rgt-neg-out96.9%
distribute-lft-out--100.0%
sub-neg100.0%
remove-double-neg100.0%
Simplified100.0%
Taylor expanded in d3 around 0 98.8%
Taylor expanded in d4 around 0 74.2%
Final simplification73.1%
(FPCore (d1 d2 d3 d4)
:precision binary64
(let* ((t_0 (* d1 (- d2 d3))) (t_1 (* d1 (+ d4 d2))))
(if (<= d3 -4.2e+72)
t_0
(if (<= d3 -1.2e-137)
t_1
(if (<= d3 21.0) (* d1 (- d2 d1)) (if (<= d3 8.5e+96) t_1 t_0))))))
double code(double d1, double d2, double d3, double d4) {
double t_0 = d1 * (d2 - d3);
double t_1 = d1 * (d4 + d2);
double tmp;
if (d3 <= -4.2e+72) {
tmp = t_0;
} else if (d3 <= -1.2e-137) {
tmp = t_1;
} else if (d3 <= 21.0) {
tmp = d1 * (d2 - d1);
} else if (d3 <= 8.5e+96) {
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 * (d2 - d3)
t_1 = d1 * (d4 + d2)
if (d3 <= (-4.2d+72)) then
tmp = t_0
else if (d3 <= (-1.2d-137)) then
tmp = t_1
else if (d3 <= 21.0d0) then
tmp = d1 * (d2 - d1)
else if (d3 <= 8.5d+96) 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 * (d2 - d3);
double t_1 = d1 * (d4 + d2);
double tmp;
if (d3 <= -4.2e+72) {
tmp = t_0;
} else if (d3 <= -1.2e-137) {
tmp = t_1;
} else if (d3 <= 21.0) {
tmp = d1 * (d2 - d1);
} else if (d3 <= 8.5e+96) {
tmp = t_1;
} else {
tmp = t_0;
}
return tmp;
}
def code(d1, d2, d3, d4): t_0 = d1 * (d2 - d3) t_1 = d1 * (d4 + d2) tmp = 0 if d3 <= -4.2e+72: tmp = t_0 elif d3 <= -1.2e-137: tmp = t_1 elif d3 <= 21.0: tmp = d1 * (d2 - d1) elif d3 <= 8.5e+96: tmp = t_1 else: tmp = t_0 return tmp
function code(d1, d2, d3, d4) t_0 = Float64(d1 * Float64(d2 - d3)) t_1 = Float64(d1 * Float64(d4 + d2)) tmp = 0.0 if (d3 <= -4.2e+72) tmp = t_0; elseif (d3 <= -1.2e-137) tmp = t_1; elseif (d3 <= 21.0) tmp = Float64(d1 * Float64(d2 - d1)); elseif (d3 <= 8.5e+96) tmp = t_1; else tmp = t_0; end return tmp end
function tmp_2 = code(d1, d2, d3, d4) t_0 = d1 * (d2 - d3); t_1 = d1 * (d4 + d2); tmp = 0.0; if (d3 <= -4.2e+72) tmp = t_0; elseif (d3 <= -1.2e-137) tmp = t_1; elseif (d3 <= 21.0) tmp = d1 * (d2 - d1); elseif (d3 <= 8.5e+96) tmp = t_1; 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]}, Block[{t$95$1 = N[(d1 * N[(d4 + d2), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[d3, -4.2e+72], t$95$0, If[LessEqual[d3, -1.2e-137], t$95$1, If[LessEqual[d3, 21.0], N[(d1 * N[(d2 - d1), $MachinePrecision]), $MachinePrecision], If[LessEqual[d3, 8.5e+96], t$95$1, t$95$0]]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := d1 \cdot \left(d2 - d3\right)\\
t_1 := d1 \cdot \left(d4 + d2\right)\\
\mathbf{if}\;d3 \leq -4.2 \cdot 10^{+72}:\\
\;\;\;\;t_0\\
\mathbf{elif}\;d3 \leq -1.2 \cdot 10^{-137}:\\
\;\;\;\;t_1\\
\mathbf{elif}\;d3 \leq 21:\\
\;\;\;\;d1 \cdot \left(d2 - d1\right)\\
\mathbf{elif}\;d3 \leq 8.5 \cdot 10^{+96}:\\
\;\;\;\;t_1\\
\mathbf{else}:\\
\;\;\;\;t_0\\
\end{array}
\end{array}
if d3 < -4.2000000000000003e72 or 8.50000000000000025e96 < d3 Initial program 83.1%
associate--l+83.1%
sub-neg83.1%
associate-+l+83.1%
+-commutative83.1%
--rgt-identity83.1%
associate--r-83.1%
associate-+r-83.1%
+-commutative83.1%
*-commutative83.1%
sub-neg83.1%
distribute-lft-out--84.2%
distribute-lft-out--94.7%
neg-sub094.7%
distribute-rgt-neg-out94.7%
distribute-lft-out--100.0%
sub-neg100.0%
remove-double-neg100.0%
Simplified100.0%
Taylor expanded in d4 around 0 89.5%
Taylor expanded in d1 around 0 79.4%
if -4.2000000000000003e72 < d3 < -1.2e-137 or 21 < d3 < 8.50000000000000025e96Initial program 92.3%
associate--l+92.3%
sub-neg92.3%
associate-+l+92.3%
+-commutative92.3%
--rgt-identity92.3%
associate--r-92.3%
associate-+r-92.3%
+-commutative92.3%
*-commutative92.3%
sub-neg92.3%
distribute-lft-out--92.3%
distribute-lft-out--96.9%
neg-sub096.9%
distribute-rgt-neg-out96.9%
distribute-lft-out--100.0%
sub-neg100.0%
remove-double-neg100.0%
Simplified100.0%
Taylor expanded in d3 around 0 83.9%
Taylor expanded in d1 around 0 73.3%
if -1.2e-137 < d3 < 21Initial program 95.8%
associate--l+95.8%
sub-neg95.8%
associate-+l+95.8%
+-commutative95.8%
--rgt-identity95.8%
associate--r-95.8%
associate-+r-95.8%
+-commutative95.8%
*-commutative95.8%
sub-neg95.8%
distribute-lft-out--95.8%
distribute-lft-out--96.9%
neg-sub096.9%
distribute-rgt-neg-out96.9%
distribute-lft-out--100.0%
sub-neg100.0%
remove-double-neg100.0%
Simplified100.0%
Taylor expanded in d3 around 0 98.8%
Taylor expanded in d4 around 0 74.2%
Final simplification75.9%
(FPCore (d1 d2 d3 d4) :precision binary64 (if (or (<= d3 -5.5e-23) (not (<= d3 3.7e+73))) (* d1 (- (+ d4 d2) d3)) (* d1 (- (+ d4 d2) d1))))
double code(double d1, double d2, double d3, double d4) {
double tmp;
if ((d3 <= -5.5e-23) || !(d3 <= 3.7e+73)) {
tmp = d1 * ((d4 + d2) - d3);
} else {
tmp = d1 * ((d4 + d2) - 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 <= (-5.5d-23)) .or. (.not. (d3 <= 3.7d+73))) then
tmp = d1 * ((d4 + d2) - d3)
else
tmp = d1 * ((d4 + d2) - d1)
end if
code = tmp
end function
public static double code(double d1, double d2, double d3, double d4) {
double tmp;
if ((d3 <= -5.5e-23) || !(d3 <= 3.7e+73)) {
tmp = d1 * ((d4 + d2) - d3);
} else {
tmp = d1 * ((d4 + d2) - d1);
}
return tmp;
}
def code(d1, d2, d3, d4): tmp = 0 if (d3 <= -5.5e-23) or not (d3 <= 3.7e+73): tmp = d1 * ((d4 + d2) - d3) else: tmp = d1 * ((d4 + d2) - d1) return tmp
function code(d1, d2, d3, d4) tmp = 0.0 if ((d3 <= -5.5e-23) || !(d3 <= 3.7e+73)) tmp = Float64(d1 * Float64(Float64(d4 + d2) - d3)); else tmp = Float64(d1 * Float64(Float64(d4 + d2) - d1)); end return tmp end
function tmp_2 = code(d1, d2, d3, d4) tmp = 0.0; if ((d3 <= -5.5e-23) || ~((d3 <= 3.7e+73))) tmp = d1 * ((d4 + d2) - d3); else tmp = d1 * ((d4 + d2) - d1); end tmp_2 = tmp; end
code[d1_, d2_, d3_, d4_] := If[Or[LessEqual[d3, -5.5e-23], N[Not[LessEqual[d3, 3.7e+73]], $MachinePrecision]], N[(d1 * N[(N[(d4 + d2), $MachinePrecision] - d3), $MachinePrecision]), $MachinePrecision], N[(d1 * N[(N[(d4 + d2), $MachinePrecision] - d1), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;d3 \leq -5.5 \cdot 10^{-23} \lor \neg \left(d3 \leq 3.7 \cdot 10^{+73}\right):\\
\;\;\;\;d1 \cdot \left(\left(d4 + d2\right) - d3\right)\\
\mathbf{else}:\\
\;\;\;\;d1 \cdot \left(\left(d4 + d2\right) - d1\right)\\
\end{array}
\end{array}
if d3 < -5.5000000000000001e-23 or 3.69999999999999973e73 < d3 Initial program 87.4%
associate--l+87.4%
sub-neg87.4%
associate-+l+87.4%
+-commutative87.4%
--rgt-identity87.4%
associate--r-87.4%
associate-+r-87.4%
+-commutative87.4%
*-commutative87.4%
sub-neg87.4%
distribute-lft-out--88.2%
distribute-lft-out--96.0%
neg-sub096.0%
distribute-rgt-neg-out96.0%
distribute-lft-out--100.0%
sub-neg100.0%
remove-double-neg100.0%
Simplified100.0%
Taylor expanded in d1 around 0 91.6%
if -5.5000000000000001e-23 < d3 < 3.69999999999999973e73Initial program 93.0%
associate--l+93.0%
sub-neg93.0%
associate-+l+93.0%
+-commutative93.0%
--rgt-identity93.0%
associate--r-93.0%
associate-+r-93.0%
+-commutative93.0%
*-commutative93.0%
sub-neg93.0%
distribute-lft-out--93.0%
distribute-lft-out--96.1%
neg-sub096.1%
distribute-rgt-neg-out96.1%
distribute-lft-out--100.0%
sub-neg100.0%
remove-double-neg100.0%
Simplified100.0%
Taylor expanded in d3 around 0 97.6%
Final simplification94.7%
(FPCore (d1 d2 d3 d4) :precision binary64 (if (or (<= d1 -3.3e+35) (not (<= d1 1.3e-35))) (* d1 (- d2 (+ d1 d3))) (* d1 (- (+ d4 d2) d3))))
double code(double d1, double d2, double d3, double d4) {
double tmp;
if ((d1 <= -3.3e+35) || !(d1 <= 1.3e-35)) {
tmp = d1 * (d2 - (d1 + d3));
} else {
tmp = d1 * ((d4 + d2) - d3);
}
return tmp;
}
real(8) function code(d1, d2, d3, d4)
real(8), intent (in) :: d1
real(8), intent (in) :: d2
real(8), intent (in) :: d3
real(8), intent (in) :: d4
real(8) :: tmp
if ((d1 <= (-3.3d+35)) .or. (.not. (d1 <= 1.3d-35))) then
tmp = d1 * (d2 - (d1 + d3))
else
tmp = d1 * ((d4 + d2) - d3)
end if
code = tmp
end function
public static double code(double d1, double d2, double d3, double d4) {
double tmp;
if ((d1 <= -3.3e+35) || !(d1 <= 1.3e-35)) {
tmp = d1 * (d2 - (d1 + d3));
} else {
tmp = d1 * ((d4 + d2) - d3);
}
return tmp;
}
def code(d1, d2, d3, d4): tmp = 0 if (d1 <= -3.3e+35) or not (d1 <= 1.3e-35): tmp = d1 * (d2 - (d1 + d3)) else: tmp = d1 * ((d4 + d2) - d3) return tmp
function code(d1, d2, d3, d4) tmp = 0.0 if ((d1 <= -3.3e+35) || !(d1 <= 1.3e-35)) tmp = Float64(d1 * Float64(d2 - Float64(d1 + d3))); else tmp = Float64(d1 * Float64(Float64(d4 + d2) - d3)); end return tmp end
function tmp_2 = code(d1, d2, d3, d4) tmp = 0.0; if ((d1 <= -3.3e+35) || ~((d1 <= 1.3e-35))) tmp = d1 * (d2 - (d1 + d3)); else tmp = d1 * ((d4 + d2) - d3); end tmp_2 = tmp; end
code[d1_, d2_, d3_, d4_] := If[Or[LessEqual[d1, -3.3e+35], N[Not[LessEqual[d1, 1.3e-35]], $MachinePrecision]], N[(d1 * N[(d2 - N[(d1 + d3), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(d1 * N[(N[(d4 + d2), $MachinePrecision] - d3), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;d1 \leq -3.3 \cdot 10^{+35} \lor \neg \left(d1 \leq 1.3 \cdot 10^{-35}\right):\\
\;\;\;\;d1 \cdot \left(d2 - \left(d1 + d3\right)\right)\\
\mathbf{else}:\\
\;\;\;\;d1 \cdot \left(\left(d4 + d2\right) - d3\right)\\
\end{array}
\end{array}
if d1 < -3.3000000000000002e35 or 1.30000000000000002e-35 < d1 Initial program 79.0%
associate--l+79.0%
sub-neg79.0%
associate-+l+79.0%
+-commutative79.0%
--rgt-identity79.0%
associate--r-79.0%
associate-+r-79.0%
+-commutative79.0%
*-commutative79.0%
sub-neg79.0%
distribute-lft-out--79.8%
distribute-lft-out--91.6%
neg-sub091.6%
distribute-rgt-neg-out91.6%
distribute-lft-out--100.0%
sub-neg100.0%
remove-double-neg100.0%
Simplified100.0%
Taylor expanded in d4 around 0 91.2%
if -3.3000000000000002e35 < d1 < 1.30000000000000002e-35Initial program 99.9%
associate--l+99.9%
sub-neg99.9%
associate-+l+99.9%
+-commutative99.9%
--rgt-identity99.9%
associate--r-99.9%
associate-+r-99.9%
+-commutative99.9%
*-commutative99.9%
sub-neg99.9%
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 0 97.4%
Final simplification94.5%
(FPCore (d1 d2 d3 d4) :precision binary64 (if (<= d2 -1e+95) (* d1 (- d2 d3)) (if (<= d2 -1.05e-274) (* d1 (- (- d3) d1)) (* d1 (- d4 d1)))))
double code(double d1, double d2, double d3, double d4) {
double tmp;
if (d2 <= -1e+95) {
tmp = d1 * (d2 - d3);
} else if (d2 <= -1.05e-274) {
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) :: tmp
if (d2 <= (-1d+95)) then
tmp = d1 * (d2 - d3)
else if (d2 <= (-1.05d-274)) 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 tmp;
if (d2 <= -1e+95) {
tmp = d1 * (d2 - d3);
} else if (d2 <= -1.05e-274) {
tmp = d1 * (-d3 - d1);
} else {
tmp = d1 * (d4 - d1);
}
return tmp;
}
def code(d1, d2, d3, d4): tmp = 0 if d2 <= -1e+95: tmp = d1 * (d2 - d3) elif d2 <= -1.05e-274: tmp = d1 * (-d3 - d1) else: tmp = d1 * (d4 - d1) return tmp
function code(d1, d2, d3, d4) tmp = 0.0 if (d2 <= -1e+95) tmp = Float64(d1 * Float64(d2 - d3)); elseif (d2 <= -1.05e-274) 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) tmp = 0.0; if (d2 <= -1e+95) tmp = d1 * (d2 - d3); elseif (d2 <= -1.05e-274) tmp = d1 * (-d3 - d1); else tmp = d1 * (d4 - d1); end tmp_2 = tmp; end
code[d1_, d2_, d3_, d4_] := If[LessEqual[d2, -1e+95], N[(d1 * N[(d2 - d3), $MachinePrecision]), $MachinePrecision], If[LessEqual[d2, -1.05e-274], N[(d1 * N[((-d3) - d1), $MachinePrecision]), $MachinePrecision], N[(d1 * N[(d4 - d1), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;d2 \leq -1 \cdot 10^{+95}:\\
\;\;\;\;d1 \cdot \left(d2 - d3\right)\\
\mathbf{elif}\;d2 \leq -1.05 \cdot 10^{-274}:\\
\;\;\;\;d1 \cdot \left(\left(-d3\right) - d1\right)\\
\mathbf{else}:\\
\;\;\;\;d1 \cdot \left(d4 - d1\right)\\
\end{array}
\end{array}
if d2 < -1.00000000000000002e95Initial program 82.9%
associate--l+82.9%
sub-neg82.9%
associate-+l+82.9%
+-commutative82.9%
--rgt-identity82.9%
associate--r-82.9%
associate-+r-82.9%
+-commutative82.9%
*-commutative82.9%
sub-neg82.9%
distribute-lft-out--82.9%
distribute-lft-out--87.2%
neg-sub087.2%
distribute-rgt-neg-out87.2%
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 79.3%
if -1.00000000000000002e95 < d2 < -1.04999999999999997e-274Initial program 95.1%
associate--l+95.1%
sub-neg95.1%
associate-+l+95.1%
+-commutative95.1%
--rgt-identity95.1%
associate--r-95.1%
associate-+r-95.1%
+-commutative95.1%
*-commutative95.1%
sub-neg95.1%
distribute-lft-out--95.2%
distribute-lft-out--98.8%
neg-sub098.8%
distribute-rgt-neg-out98.8%
distribute-lft-out--100.0%
sub-neg100.0%
remove-double-neg100.0%
Simplified100.0%
Taylor expanded in d4 around 0 78.1%
Taylor expanded in d2 around 0 70.1%
mul-1-neg70.1%
distribute-rgt-neg-in70.1%
Simplified70.1%
if -1.04999999999999997e-274 < d2 Initial 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--90.5%
distribute-lft-out--97.6%
neg-sub097.6%
distribute-rgt-neg-out97.6%
distribute-lft-out--100.0%
sub-neg100.0%
remove-double-neg100.0%
Simplified100.0%
Taylor expanded in d3 around 0 78.8%
Taylor expanded in d2 around 0 58.4%
Final simplification66.0%
(FPCore (d1 d2 d3 d4) :precision binary64 (if (or (<= d3 -3.8e+74) (not (<= d3 7e+98))) (* d1 (- d3)) (* d1 (+ d4 d2))))
double code(double d1, double d2, double d3, double d4) {
double tmp;
if ((d3 <= -3.8e+74) || !(d3 <= 7e+98)) {
tmp = d1 * -d3;
} 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) :: tmp
if ((d3 <= (-3.8d+74)) .or. (.not. (d3 <= 7d+98))) then
tmp = d1 * -d3
else
tmp = d1 * (d4 + d2)
end if
code = tmp
end function
public static double code(double d1, double d2, double d3, double d4) {
double tmp;
if ((d3 <= -3.8e+74) || !(d3 <= 7e+98)) {
tmp = d1 * -d3;
} else {
tmp = d1 * (d4 + d2);
}
return tmp;
}
def code(d1, d2, d3, d4): tmp = 0 if (d3 <= -3.8e+74) or not (d3 <= 7e+98): tmp = d1 * -d3 else: tmp = d1 * (d4 + d2) return tmp
function code(d1, d2, d3, d4) tmp = 0.0 if ((d3 <= -3.8e+74) || !(d3 <= 7e+98)) tmp = Float64(d1 * Float64(-d3)); else tmp = Float64(d1 * Float64(d4 + d2)); end return tmp end
function tmp_2 = code(d1, d2, d3, d4) tmp = 0.0; if ((d3 <= -3.8e+74) || ~((d3 <= 7e+98))) tmp = d1 * -d3; else tmp = d1 * (d4 + d2); end tmp_2 = tmp; end
code[d1_, d2_, d3_, d4_] := If[Or[LessEqual[d3, -3.8e+74], N[Not[LessEqual[d3, 7e+98]], $MachinePrecision]], N[(d1 * (-d3)), $MachinePrecision], N[(d1 * N[(d4 + d2), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;d3 \leq -3.8 \cdot 10^{+74} \lor \neg \left(d3 \leq 7 \cdot 10^{+98}\right):\\
\;\;\;\;d1 \cdot \left(-d3\right)\\
\mathbf{else}:\\
\;\;\;\;d1 \cdot \left(d4 + d2\right)\\
\end{array}
\end{array}
if d3 < -3.7999999999999998e74 or 7e98 < d3 Initial program 83.1%
associate--l+83.1%
sub-neg83.1%
associate-+l+83.1%
+-commutative83.1%
--rgt-identity83.1%
associate--r-83.1%
associate-+r-83.1%
+-commutative83.1%
*-commutative83.1%
sub-neg83.1%
distribute-lft-out--84.2%
distribute-lft-out--94.7%
neg-sub094.7%
distribute-rgt-neg-out94.7%
distribute-lft-out--100.0%
sub-neg100.0%
remove-double-neg100.0%
Simplified100.0%
Taylor expanded in d3 around inf 71.9%
associate-*r*71.9%
neg-mul-171.9%
Simplified71.9%
if -3.7999999999999998e74 < d3 < 7e98Initial program 94.4%
associate--l+94.4%
sub-neg94.4%
associate-+l+94.4%
+-commutative94.4%
--rgt-identity94.4%
associate--r-94.4%
associate-+r-94.4%
+-commutative94.4%
*-commutative94.4%
sub-neg94.4%
distribute-lft-out--94.4%
distribute-lft-out--96.9%
neg-sub096.9%
distribute-rgt-neg-out96.9%
distribute-lft-out--100.0%
sub-neg100.0%
remove-double-neg100.0%
Simplified100.0%
Taylor expanded in d3 around 0 92.8%
Taylor expanded in d1 around 0 70.5%
Final simplification71.0%
(FPCore (d1 d2 d3 d4) :precision binary64 (if (<= d2 -1.4e+73) (* d1 (+ d4 d2)) (if (<= d2 -1.05e-81) (* d1 (- d3)) (* d1 (- d4 d1)))))
double code(double d1, double d2, double d3, double d4) {
double tmp;
if (d2 <= -1.4e+73) {
tmp = d1 * (d4 + d2);
} else if (d2 <= -1.05e-81) {
tmp = d1 * -d3;
} else {
tmp = d1 * (d4 - d1);
}
return tmp;
}
real(8) function code(d1, d2, d3, d4)
real(8), intent (in) :: d1
real(8), intent (in) :: d2
real(8), intent (in) :: d3
real(8), intent (in) :: d4
real(8) :: tmp
if (d2 <= (-1.4d+73)) then
tmp = d1 * (d4 + d2)
else if (d2 <= (-1.05d-81)) then
tmp = d1 * -d3
else
tmp = d1 * (d4 - d1)
end if
code = tmp
end function
public static double code(double d1, double d2, double d3, double d4) {
double tmp;
if (d2 <= -1.4e+73) {
tmp = d1 * (d4 + d2);
} else if (d2 <= -1.05e-81) {
tmp = d1 * -d3;
} else {
tmp = d1 * (d4 - d1);
}
return tmp;
}
def code(d1, d2, d3, d4): tmp = 0 if d2 <= -1.4e+73: tmp = d1 * (d4 + d2) elif d2 <= -1.05e-81: tmp = d1 * -d3 else: tmp = d1 * (d4 - d1) return tmp
function code(d1, d2, d3, d4) tmp = 0.0 if (d2 <= -1.4e+73) tmp = Float64(d1 * Float64(d4 + d2)); elseif (d2 <= -1.05e-81) tmp = Float64(d1 * Float64(-d3)); else tmp = Float64(d1 * Float64(d4 - d1)); end return tmp end
function tmp_2 = code(d1, d2, d3, d4) tmp = 0.0; if (d2 <= -1.4e+73) tmp = d1 * (d4 + d2); elseif (d2 <= -1.05e-81) tmp = d1 * -d3; else tmp = d1 * (d4 - d1); end tmp_2 = tmp; end
code[d1_, d2_, d3_, d4_] := If[LessEqual[d2, -1.4e+73], N[(d1 * N[(d4 + d2), $MachinePrecision]), $MachinePrecision], If[LessEqual[d2, -1.05e-81], N[(d1 * (-d3)), $MachinePrecision], N[(d1 * N[(d4 - d1), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;d2 \leq -1.4 \cdot 10^{+73}:\\
\;\;\;\;d1 \cdot \left(d4 + d2\right)\\
\mathbf{elif}\;d2 \leq -1.05 \cdot 10^{-81}:\\
\;\;\;\;d1 \cdot \left(-d3\right)\\
\mathbf{else}:\\
\;\;\;\;d1 \cdot \left(d4 - d1\right)\\
\end{array}
\end{array}
if d2 < -1.40000000000000004e73Initial program 81.9%
associate--l+81.9%
sub-neg81.9%
associate-+l+81.9%
+-commutative81.9%
--rgt-identity81.9%
associate--r-81.9%
associate-+r-81.9%
+-commutative81.9%
*-commutative81.9%
sub-neg81.9%
distribute-lft-out--81.9%
distribute-lft-out--87.9%
neg-sub087.9%
distribute-rgt-neg-out87.9%
distribute-lft-out--100.0%
sub-neg100.0%
remove-double-neg100.0%
Simplified100.0%
Taylor expanded in d3 around 0 79.3%
Taylor expanded in d1 around 0 71.3%
if -1.40000000000000004e73 < d2 < -1.05e-81Initial program 96.8%
associate--l+96.8%
sub-neg96.8%
associate-+l+96.8%
+-commutative96.8%
--rgt-identity96.8%
associate--r-96.8%
associate-+r-96.8%
+-commutative96.8%
*-commutative96.8%
sub-neg96.8%
distribute-lft-out--96.8%
distribute-lft-out--96.8%
neg-sub096.8%
distribute-rgt-neg-out96.8%
distribute-lft-out--100.0%
sub-neg100.0%
remove-double-neg100.0%
Simplified100.0%
Taylor expanded in d3 around inf 47.5%
associate-*r*47.5%
neg-mul-147.5%
Simplified47.5%
if -1.05e-81 < d2 Initial program 91.4%
associate--l+91.4%
sub-neg91.4%
associate-+l+91.4%
+-commutative91.4%
--rgt-identity91.4%
associate--r-91.4%
associate-+r-91.4%
+-commutative91.4%
*-commutative91.4%
sub-neg91.4%
distribute-lft-out--92.0%
distribute-lft-out--98.3%
neg-sub098.3%
distribute-rgt-neg-out98.3%
distribute-lft-out--100.0%
sub-neg100.0%
remove-double-neg100.0%
Simplified100.0%
Taylor expanded in d3 around 0 74.2%
Taylor expanded in d2 around 0 57.9%
Final simplification59.3%
(FPCore (d1 d2 d3 d4) :precision binary64 (if (<= d2 -5.4e+95) (* d1 d2) (if (<= d2 9.5e-158) (* d1 (- d1)) (* d1 d4))))
double code(double d1, double d2, double d3, double d4) {
double tmp;
if (d2 <= -5.4e+95) {
tmp = d1 * d2;
} else if (d2 <= 9.5e-158) {
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 <= (-5.4d+95)) then
tmp = d1 * d2
else if (d2 <= 9.5d-158) 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 <= -5.4e+95) {
tmp = d1 * d2;
} else if (d2 <= 9.5e-158) {
tmp = d1 * -d1;
} else {
tmp = d1 * d4;
}
return tmp;
}
def code(d1, d2, d3, d4): tmp = 0 if d2 <= -5.4e+95: tmp = d1 * d2 elif d2 <= 9.5e-158: tmp = d1 * -d1 else: tmp = d1 * d4 return tmp
function code(d1, d2, d3, d4) tmp = 0.0 if (d2 <= -5.4e+95) tmp = Float64(d1 * d2); elseif (d2 <= 9.5e-158) 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 <= -5.4e+95) tmp = d1 * d2; elseif (d2 <= 9.5e-158) tmp = d1 * -d1; else tmp = d1 * d4; end tmp_2 = tmp; end
code[d1_, d2_, d3_, d4_] := If[LessEqual[d2, -5.4e+95], N[(d1 * d2), $MachinePrecision], If[LessEqual[d2, 9.5e-158], N[(d1 * (-d1)), $MachinePrecision], N[(d1 * d4), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;d2 \leq -5.4 \cdot 10^{+95}:\\
\;\;\;\;d1 \cdot d2\\
\mathbf{elif}\;d2 \leq 9.5 \cdot 10^{-158}:\\
\;\;\;\;d1 \cdot \left(-d1\right)\\
\mathbf{else}:\\
\;\;\;\;d1 \cdot d4\\
\end{array}
\end{array}
if d2 < -5.4e95Initial program 82.9%
associate--l+82.9%
sub-neg82.9%
associate-+l+82.9%
+-commutative82.9%
--rgt-identity82.9%
associate--r-82.9%
associate-+r-82.9%
+-commutative82.9%
*-commutative82.9%
sub-neg82.9%
distribute-lft-out--82.9%
distribute-lft-out--87.2%
neg-sub087.2%
distribute-rgt-neg-out87.2%
distribute-lft-out--100.0%
sub-neg100.0%
remove-double-neg100.0%
Simplified100.0%
Taylor expanded in d2 around inf 61.6%
if -5.4e95 < d2 < 9.50000000000000051e-158Initial program 93.9%
associate--l+93.9%
sub-neg93.9%
associate-+l+93.9%
+-commutative93.9%
--rgt-identity93.9%
associate--r-93.9%
associate-+r-93.9%
+-commutative93.9%
*-commutative93.9%
sub-neg93.9%
distribute-lft-out--94.0%
distribute-lft-out--99.1%
neg-sub099.1%
distribute-rgt-neg-out99.1%
distribute-lft-out--100.0%
sub-neg100.0%
remove-double-neg100.0%
Simplified100.0%
Taylor expanded in d1 around inf 36.9%
unpow236.9%
mul-1-neg36.9%
distribute-rgt-neg-out36.9%
Simplified36.9%
if 9.50000000000000051e-158 < 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--90.3%
distribute-lft-out--96.7%
neg-sub096.7%
distribute-rgt-neg-out96.7%
distribute-lft-out--100.0%
sub-neg100.0%
remove-double-neg100.0%
Simplified100.0%
Taylor expanded in d4 around inf 31.1%
Final simplification39.3%
(FPCore (d1 d2 d3 d4) :precision binary64 (if (<= d2 -4.5e+74) (* d1 d2) (if (<= d2 -2.1e-272) (* d1 (- d3)) (* d1 d4))))
double code(double d1, double d2, double d3, double d4) {
double tmp;
if (d2 <= -4.5e+74) {
tmp = d1 * d2;
} else if (d2 <= -2.1e-272) {
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 <= (-4.5d+74)) then
tmp = d1 * d2
else if (d2 <= (-2.1d-272)) 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 <= -4.5e+74) {
tmp = d1 * d2;
} else if (d2 <= -2.1e-272) {
tmp = d1 * -d3;
} else {
tmp = d1 * d4;
}
return tmp;
}
def code(d1, d2, d3, d4): tmp = 0 if d2 <= -4.5e+74: tmp = d1 * d2 elif d2 <= -2.1e-272: tmp = d1 * -d3 else: tmp = d1 * d4 return tmp
function code(d1, d2, d3, d4) tmp = 0.0 if (d2 <= -4.5e+74) tmp = Float64(d1 * d2); elseif (d2 <= -2.1e-272) 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 <= -4.5e+74) tmp = d1 * d2; elseif (d2 <= -2.1e-272) tmp = d1 * -d3; else tmp = d1 * d4; end tmp_2 = tmp; end
code[d1_, d2_, d3_, d4_] := If[LessEqual[d2, -4.5e+74], N[(d1 * d2), $MachinePrecision], If[LessEqual[d2, -2.1e-272], N[(d1 * (-d3)), $MachinePrecision], N[(d1 * d4), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;d2 \leq -4.5 \cdot 10^{+74}:\\
\;\;\;\;d1 \cdot d2\\
\mathbf{elif}\;d2 \leq -2.1 \cdot 10^{-272}:\\
\;\;\;\;d1 \cdot \left(-d3\right)\\
\mathbf{else}:\\
\;\;\;\;d1 \cdot d4\\
\end{array}
\end{array}
if d2 < -4.5e74Initial program 81.9%
associate--l+81.9%
sub-neg81.9%
associate-+l+81.9%
+-commutative81.9%
--rgt-identity81.9%
associate--r-81.9%
associate-+r-81.9%
+-commutative81.9%
*-commutative81.9%
sub-neg81.9%
distribute-lft-out--81.9%
distribute-lft-out--87.9%
neg-sub087.9%
distribute-rgt-neg-out87.9%
distribute-lft-out--100.0%
sub-neg100.0%
remove-double-neg100.0%
Simplified100.0%
Taylor expanded in d2 around inf 60.0%
if -4.5e74 < d2 < -2.09999999999999987e-272Initial program 97.4%
associate--l+97.4%
sub-neg97.4%
associate-+l+97.4%
+-commutative97.4%
--rgt-identity97.4%
associate--r-97.4%
associate-+r-97.4%
+-commutative97.4%
*-commutative97.4%
sub-neg97.4%
distribute-lft-out--97.4%
distribute-lft-out--98.7%
neg-sub098.7%
distribute-rgt-neg-out98.7%
distribute-lft-out--100.0%
sub-neg100.0%
remove-double-neg100.0%
Simplified100.0%
Taylor expanded in d3 around inf 48.5%
associate-*r*48.5%
neg-mul-148.5%
Simplified48.5%
if -2.09999999999999987e-272 < d2 Initial program 89.0%
associate--l+89.0%
sub-neg89.0%
associate-+l+89.0%
+-commutative89.0%
--rgt-identity89.0%
associate--r-89.0%
associate-+r-89.0%
+-commutative89.0%
*-commutative89.0%
sub-neg89.0%
distribute-lft-out--89.7%
distribute-lft-out--97.6%
neg-sub097.6%
distribute-rgt-neg-out97.6%
distribute-lft-out--100.0%
sub-neg100.0%
remove-double-neg100.0%
Simplified100.0%
Taylor expanded in d4 around inf 32.0%
Final simplification42.6%
(FPCore (d1 d2 d3 d4) :precision binary64 (if (<= d2 -2.3e-96) (* d1 (- d2 d3)) (* d1 (- d4 d3))))
double code(double d1, double d2, double d3, double d4) {
double tmp;
if (d2 <= -2.3e-96) {
tmp = d1 * (d2 - d3);
} else {
tmp = d1 * (d4 - d3);
}
return tmp;
}
real(8) function code(d1, d2, d3, d4)
real(8), intent (in) :: d1
real(8), intent (in) :: d2
real(8), intent (in) :: d3
real(8), intent (in) :: d4
real(8) :: tmp
if (d2 <= (-2.3d-96)) then
tmp = d1 * (d2 - d3)
else
tmp = d1 * (d4 - d3)
end if
code = tmp
end function
public static double code(double d1, double d2, double d3, double d4) {
double tmp;
if (d2 <= -2.3e-96) {
tmp = d1 * (d2 - d3);
} else {
tmp = d1 * (d4 - d3);
}
return tmp;
}
def code(d1, d2, d3, d4): tmp = 0 if d2 <= -2.3e-96: tmp = d1 * (d2 - d3) else: tmp = d1 * (d4 - d3) return tmp
function code(d1, d2, d3, d4) tmp = 0.0 if (d2 <= -2.3e-96) tmp = Float64(d1 * Float64(d2 - d3)); else tmp = Float64(d1 * Float64(d4 - d3)); end return tmp end
function tmp_2 = code(d1, d2, d3, d4) tmp = 0.0; if (d2 <= -2.3e-96) tmp = d1 * (d2 - d3); else tmp = d1 * (d4 - d3); end tmp_2 = tmp; end
code[d1_, d2_, d3_, d4_] := If[LessEqual[d2, -2.3e-96], N[(d1 * N[(d2 - d3), $MachinePrecision]), $MachinePrecision], N[(d1 * N[(d4 - d3), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;d2 \leq -2.3 \cdot 10^{-96}:\\
\;\;\;\;d1 \cdot \left(d2 - d3\right)\\
\mathbf{else}:\\
\;\;\;\;d1 \cdot \left(d4 - d3\right)\\
\end{array}
\end{array}
if d2 < -2.3e-96Initial program 88.2%
associate--l+88.2%
sub-neg88.2%
associate-+l+88.2%
+-commutative88.2%
--rgt-identity88.2%
associate--r-88.2%
associate-+r-88.2%
+-commutative88.2%
*-commutative88.2%
sub-neg88.2%
distribute-lft-out--88.2%
distribute-lft-out--91.7%
neg-sub091.7%
distribute-rgt-neg-out91.7%
distribute-lft-out--100.0%
sub-neg100.0%
remove-double-neg100.0%
Simplified100.0%
Taylor expanded in d4 around 0 85.5%
Taylor expanded in d1 around 0 69.5%
if -2.3e-96 < d2 Initial program 91.2%
associate--l+91.2%
sub-neg91.2%
associate-+l+91.2%
+-commutative91.2%
--rgt-identity91.2%
associate--r-91.2%
associate-+r-91.2%
+-commutative91.2%
*-commutative91.2%
sub-neg91.2%
distribute-lft-out--91.8%
distribute-lft-out--98.2%
neg-sub098.2%
distribute-rgt-neg-out98.2%
distribute-lft-out--100.0%
sub-neg100.0%
remove-double-neg100.0%
Simplified100.0%
Taylor expanded in d1 around 0 79.7%
Taylor expanded in d2 around 0 62.1%
Final simplification64.5%
(FPCore (d1 d2 d3 d4) :precision binary64 (if (<= d2 -4.9e-96) (* d1 d2) (* d1 d4)))
double code(double d1, double d2, double d3, double d4) {
double tmp;
if (d2 <= -4.9e-96) {
tmp = d1 * d2;
} else {
tmp = d1 * d4;
}
return tmp;
}
real(8) function code(d1, d2, d3, d4)
real(8), intent (in) :: d1
real(8), intent (in) :: d2
real(8), intent (in) :: d3
real(8), intent (in) :: d4
real(8) :: tmp
if (d2 <= (-4.9d-96)) then
tmp = d1 * d2
else
tmp = d1 * d4
end if
code = tmp
end function
public static double code(double d1, double d2, double d3, double d4) {
double tmp;
if (d2 <= -4.9e-96) {
tmp = d1 * d2;
} else {
tmp = d1 * d4;
}
return tmp;
}
def code(d1, d2, d3, d4): tmp = 0 if d2 <= -4.9e-96: tmp = d1 * d2 else: tmp = d1 * d4 return tmp
function code(d1, d2, d3, d4) tmp = 0.0 if (d2 <= -4.9e-96) tmp = Float64(d1 * d2); else tmp = Float64(d1 * d4); end return tmp end
function tmp_2 = code(d1, d2, d3, d4) tmp = 0.0; if (d2 <= -4.9e-96) tmp = d1 * d2; else tmp = d1 * d4; end tmp_2 = tmp; end
code[d1_, d2_, d3_, d4_] := If[LessEqual[d2, -4.9e-96], N[(d1 * d2), $MachinePrecision], N[(d1 * d4), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;d2 \leq -4.9 \cdot 10^{-96}:\\
\;\;\;\;d1 \cdot d2\\
\mathbf{else}:\\
\;\;\;\;d1 \cdot d4\\
\end{array}
\end{array}
if d2 < -4.90000000000000016e-96Initial program 88.2%
associate--l+88.2%
sub-neg88.2%
associate-+l+88.2%
+-commutative88.2%
--rgt-identity88.2%
associate--r-88.2%
associate-+r-88.2%
+-commutative88.2%
*-commutative88.2%
sub-neg88.2%
distribute-lft-out--88.2%
distribute-lft-out--91.7%
neg-sub091.7%
distribute-rgt-neg-out91.7%
distribute-lft-out--100.0%
sub-neg100.0%
remove-double-neg100.0%
Simplified100.0%
Taylor expanded in d2 around inf 44.4%
if -4.90000000000000016e-96 < d2 Initial program 91.2%
associate--l+91.2%
sub-neg91.2%
associate-+l+91.2%
+-commutative91.2%
--rgt-identity91.2%
associate--r-91.2%
associate-+r-91.2%
+-commutative91.2%
*-commutative91.2%
sub-neg91.2%
distribute-lft-out--91.8%
distribute-lft-out--98.2%
neg-sub098.2%
distribute-rgt-neg-out98.2%
distribute-lft-out--100.0%
sub-neg100.0%
remove-double-neg100.0%
Simplified100.0%
Taylor expanded in d4 around inf 32.1%
Final simplification36.2%
(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 90.2%
associate--l+90.2%
sub-neg90.2%
associate-+l+90.2%
+-commutative90.2%
--rgt-identity90.2%
associate--r-90.2%
associate-+r-90.2%
+-commutative90.2%
*-commutative90.2%
sub-neg90.2%
distribute-lft-out--90.6%
distribute-lft-out--96.1%
neg-sub096.1%
distribute-rgt-neg-out96.1%
distribute-lft-out--100.0%
sub-neg100.0%
remove-double-neg100.0%
Simplified100.0%
Taylor expanded in d4 around inf 29.5%
Final simplification29.5%
(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 2023279
(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)))