
(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 d1) (- d2 d3))))
double code(double d1, double d2, double d3, double d4) {
return d1 * ((d4 - d1) + (d2 - d3));
}
real(8) function code(d1, d2, d3, d4)
real(8), intent (in) :: d1
real(8), intent (in) :: d2
real(8), intent (in) :: d3
real(8), intent (in) :: d4
code = d1 * ((d4 - d1) + (d2 - d3))
end function
public static double code(double d1, double d2, double d3, double d4) {
return d1 * ((d4 - d1) + (d2 - d3));
}
def code(d1, d2, d3, d4): return d1 * ((d4 - d1) + (d2 - d3))
function code(d1, d2, d3, d4) return Float64(d1 * Float64(Float64(d4 - d1) + Float64(d2 - d3))) end
function tmp = code(d1, d2, d3, d4) tmp = d1 * ((d4 - d1) + (d2 - d3)); end
code[d1_, d2_, d3_, d4_] := N[(d1 * N[(N[(d4 - d1), $MachinePrecision] + N[(d2 - d3), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
d1 \cdot \left(\left(d4 - d1\right) + \left(d2 - d3\right)\right)
\end{array}
Initial program 88.2%
associate--l+88.2%
+-commutative88.2%
distribute-rgt-out--90.6%
distribute-lft-out--92.5%
distribute-lft-out100.0%
Simplified100.0%
Final simplification100.0%
(FPCore (d1 d2 d3 d4)
:precision binary64
(let* ((t_0 (* d1 (- d1))) (t_1 (* d3 (- d1))))
(if (<= d4 -3.9e-170)
(* d1 d2)
(if (<= d4 -1.8e-230)
t_1
(if (<= d4 3.6e-255)
(* d1 d2)
(if (<= d4 4e-151)
t_0
(if (<= d4 9.6e-16) t_1 (if (<= d4 4.1e+68) t_0 (* d1 d4)))))))))
double code(double d1, double d2, double d3, double d4) {
double t_0 = d1 * -d1;
double t_1 = d3 * -d1;
double tmp;
if (d4 <= -3.9e-170) {
tmp = d1 * d2;
} else if (d4 <= -1.8e-230) {
tmp = t_1;
} else if (d4 <= 3.6e-255) {
tmp = d1 * d2;
} else if (d4 <= 4e-151) {
tmp = t_0;
} else if (d4 <= 9.6e-16) {
tmp = t_1;
} else if (d4 <= 4.1e+68) {
tmp = t_0;
} 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) :: t_0
real(8) :: t_1
real(8) :: tmp
t_0 = d1 * -d1
t_1 = d3 * -d1
if (d4 <= (-3.9d-170)) then
tmp = d1 * d2
else if (d4 <= (-1.8d-230)) then
tmp = t_1
else if (d4 <= 3.6d-255) then
tmp = d1 * d2
else if (d4 <= 4d-151) then
tmp = t_0
else if (d4 <= 9.6d-16) then
tmp = t_1
else if (d4 <= 4.1d+68) then
tmp = t_0
else
tmp = d1 * d4
end if
code = tmp
end function
public static double code(double d1, double d2, double d3, double d4) {
double t_0 = d1 * -d1;
double t_1 = d3 * -d1;
double tmp;
if (d4 <= -3.9e-170) {
tmp = d1 * d2;
} else if (d4 <= -1.8e-230) {
tmp = t_1;
} else if (d4 <= 3.6e-255) {
tmp = d1 * d2;
} else if (d4 <= 4e-151) {
tmp = t_0;
} else if (d4 <= 9.6e-16) {
tmp = t_1;
} else if (d4 <= 4.1e+68) {
tmp = t_0;
} else {
tmp = d1 * d4;
}
return tmp;
}
def code(d1, d2, d3, d4): t_0 = d1 * -d1 t_1 = d3 * -d1 tmp = 0 if d4 <= -3.9e-170: tmp = d1 * d2 elif d4 <= -1.8e-230: tmp = t_1 elif d4 <= 3.6e-255: tmp = d1 * d2 elif d4 <= 4e-151: tmp = t_0 elif d4 <= 9.6e-16: tmp = t_1 elif d4 <= 4.1e+68: tmp = t_0 else: tmp = d1 * d4 return tmp
function code(d1, d2, d3, d4) t_0 = Float64(d1 * Float64(-d1)) t_1 = Float64(d3 * Float64(-d1)) tmp = 0.0 if (d4 <= -3.9e-170) tmp = Float64(d1 * d2); elseif (d4 <= -1.8e-230) tmp = t_1; elseif (d4 <= 3.6e-255) tmp = Float64(d1 * d2); elseif (d4 <= 4e-151) tmp = t_0; elseif (d4 <= 9.6e-16) tmp = t_1; elseif (d4 <= 4.1e+68) tmp = t_0; else tmp = Float64(d1 * d4); end return tmp end
function tmp_2 = code(d1, d2, d3, d4) t_0 = d1 * -d1; t_1 = d3 * -d1; tmp = 0.0; if (d4 <= -3.9e-170) tmp = d1 * d2; elseif (d4 <= -1.8e-230) tmp = t_1; elseif (d4 <= 3.6e-255) tmp = d1 * d2; elseif (d4 <= 4e-151) tmp = t_0; elseif (d4 <= 9.6e-16) tmp = t_1; elseif (d4 <= 4.1e+68) tmp = t_0; else tmp = d1 * d4; end tmp_2 = tmp; end
code[d1_, d2_, d3_, d4_] := Block[{t$95$0 = N[(d1 * (-d1)), $MachinePrecision]}, Block[{t$95$1 = N[(d3 * (-d1)), $MachinePrecision]}, If[LessEqual[d4, -3.9e-170], N[(d1 * d2), $MachinePrecision], If[LessEqual[d4, -1.8e-230], t$95$1, If[LessEqual[d4, 3.6e-255], N[(d1 * d2), $MachinePrecision], If[LessEqual[d4, 4e-151], t$95$0, If[LessEqual[d4, 9.6e-16], t$95$1, If[LessEqual[d4, 4.1e+68], t$95$0, N[(d1 * d4), $MachinePrecision]]]]]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := d1 \cdot \left(-d1\right)\\
t_1 := d3 \cdot \left(-d1\right)\\
\mathbf{if}\;d4 \leq -3.9 \cdot 10^{-170}:\\
\;\;\;\;d1 \cdot d2\\
\mathbf{elif}\;d4 \leq -1.8 \cdot 10^{-230}:\\
\;\;\;\;t_1\\
\mathbf{elif}\;d4 \leq 3.6 \cdot 10^{-255}:\\
\;\;\;\;d1 \cdot d2\\
\mathbf{elif}\;d4 \leq 4 \cdot 10^{-151}:\\
\;\;\;\;t_0\\
\mathbf{elif}\;d4 \leq 9.6 \cdot 10^{-16}:\\
\;\;\;\;t_1\\
\mathbf{elif}\;d4 \leq 4.1 \cdot 10^{+68}:\\
\;\;\;\;t_0\\
\mathbf{else}:\\
\;\;\;\;d1 \cdot d4\\
\end{array}
\end{array}
if d4 < -3.90000000000000021e-170 or -1.7999999999999999e-230 < d4 < 3.6000000000000002e-255Initial program 88.8%
associate--l+88.8%
+-commutative88.8%
distribute-rgt-out--91.1%
distribute-lft-out--93.3%
distribute-lft-out100.0%
Simplified100.0%
Taylor expanded in d2 around inf 35.5%
if -3.90000000000000021e-170 < d4 < -1.7999999999999999e-230 or 3.9999999999999998e-151 < d4 < 9.60000000000000019e-16Initial program 85.7%
associate--l+85.7%
+-commutative85.7%
distribute-rgt-out--85.7%
distribute-lft-out--88.0%
distribute-lft-out100.0%
Simplified100.0%
Taylor expanded in d3 around inf 45.2%
associate-*r*45.2%
neg-mul-145.2%
Simplified45.2%
if 3.6000000000000002e-255 < d4 < 3.9999999999999998e-151 or 9.60000000000000019e-16 < d4 < 4.0999999999999999e68Initial program 90.0%
associate--l+90.0%
+-commutative90.0%
distribute-rgt-out--90.0%
distribute-lft-out--93.3%
distribute-lft-out100.0%
Simplified100.0%
Taylor expanded in d1 around inf 49.1%
neg-mul-149.1%
Simplified49.1%
if 4.0999999999999999e68 < d4 Initial program 87.8%
associate--l+87.8%
+-commutative87.8%
distribute-rgt-out--93.9%
distribute-lft-out--93.9%
distribute-lft-out100.0%
Simplified100.0%
Taylor expanded in d4 around inf 66.7%
Final simplification44.7%
(FPCore (d1 d2 d3 d4)
:precision binary64
(let* ((t_0 (* d1 (- d2 d1))) (t_1 (* d3 (- d1))))
(if (<= d4 -2.3e-173)
t_0
(if (<= d4 -4.5e-219)
t_1
(if (<= d4 4.5e-151)
t_0
(if (<= d4 2.6e-119)
t_1
(if (<= d4 1.25e+67) t_0 (* d1 (+ d4 d2)))))))))
double code(double d1, double d2, double d3, double d4) {
double t_0 = d1 * (d2 - d1);
double t_1 = d3 * -d1;
double tmp;
if (d4 <= -2.3e-173) {
tmp = t_0;
} else if (d4 <= -4.5e-219) {
tmp = t_1;
} else if (d4 <= 4.5e-151) {
tmp = t_0;
} else if (d4 <= 2.6e-119) {
tmp = t_1;
} else if (d4 <= 1.25e+67) {
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) :: t_1
real(8) :: tmp
t_0 = d1 * (d2 - d1)
t_1 = d3 * -d1
if (d4 <= (-2.3d-173)) then
tmp = t_0
else if (d4 <= (-4.5d-219)) then
tmp = t_1
else if (d4 <= 4.5d-151) then
tmp = t_0
else if (d4 <= 2.6d-119) then
tmp = t_1
else if (d4 <= 1.25d+67) 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 - d1);
double t_1 = d3 * -d1;
double tmp;
if (d4 <= -2.3e-173) {
tmp = t_0;
} else if (d4 <= -4.5e-219) {
tmp = t_1;
} else if (d4 <= 4.5e-151) {
tmp = t_0;
} else if (d4 <= 2.6e-119) {
tmp = t_1;
} else if (d4 <= 1.25e+67) {
tmp = t_0;
} else {
tmp = d1 * (d4 + d2);
}
return tmp;
}
def code(d1, d2, d3, d4): t_0 = d1 * (d2 - d1) t_1 = d3 * -d1 tmp = 0 if d4 <= -2.3e-173: tmp = t_0 elif d4 <= -4.5e-219: tmp = t_1 elif d4 <= 4.5e-151: tmp = t_0 elif d4 <= 2.6e-119: tmp = t_1 elif d4 <= 1.25e+67: tmp = t_0 else: tmp = d1 * (d4 + d2) return tmp
function code(d1, d2, d3, d4) t_0 = Float64(d1 * Float64(d2 - d1)) t_1 = Float64(d3 * Float64(-d1)) tmp = 0.0 if (d4 <= -2.3e-173) tmp = t_0; elseif (d4 <= -4.5e-219) tmp = t_1; elseif (d4 <= 4.5e-151) tmp = t_0; elseif (d4 <= 2.6e-119) tmp = t_1; elseif (d4 <= 1.25e+67) 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 - d1); t_1 = d3 * -d1; tmp = 0.0; if (d4 <= -2.3e-173) tmp = t_0; elseif (d4 <= -4.5e-219) tmp = t_1; elseif (d4 <= 4.5e-151) tmp = t_0; elseif (d4 <= 2.6e-119) tmp = t_1; elseif (d4 <= 1.25e+67) 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 - d1), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$1 = N[(d3 * (-d1)), $MachinePrecision]}, If[LessEqual[d4, -2.3e-173], t$95$0, If[LessEqual[d4, -4.5e-219], t$95$1, If[LessEqual[d4, 4.5e-151], t$95$0, If[LessEqual[d4, 2.6e-119], t$95$1, If[LessEqual[d4, 1.25e+67], t$95$0, N[(d1 * N[(d4 + d2), $MachinePrecision]), $MachinePrecision]]]]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := d1 \cdot \left(d2 - d1\right)\\
t_1 := d3 \cdot \left(-d1\right)\\
\mathbf{if}\;d4 \leq -2.3 \cdot 10^{-173}:\\
\;\;\;\;t_0\\
\mathbf{elif}\;d4 \leq -4.5 \cdot 10^{-219}:\\
\;\;\;\;t_1\\
\mathbf{elif}\;d4 \leq 4.5 \cdot 10^{-151}:\\
\;\;\;\;t_0\\
\mathbf{elif}\;d4 \leq 2.6 \cdot 10^{-119}:\\
\;\;\;\;t_1\\
\mathbf{elif}\;d4 \leq 1.25 \cdot 10^{+67}:\\
\;\;\;\;t_0\\
\mathbf{else}:\\
\;\;\;\;d1 \cdot \left(d4 + d2\right)\\
\end{array}
\end{array}
if d4 < -2.29999999999999988e-173 or -4.50000000000000014e-219 < d4 < 4.5000000000000002e-151 or 2.60000000000000012e-119 < d4 < 1.24999999999999994e67Initial program 88.7%
associate--l+88.7%
+-commutative88.7%
distribute-rgt-out--90.3%
distribute-lft-out--92.5%
distribute-lft-out100.0%
Simplified100.0%
Taylor expanded in d3 around 0 80.6%
Taylor expanded in d4 around 0 59.0%
if -2.29999999999999988e-173 < d4 < -4.50000000000000014e-219 or 4.5000000000000002e-151 < d4 < 2.60000000000000012e-119Initial program 84.2%
associate--l+84.2%
+-commutative84.2%
distribute-rgt-out--84.2%
distribute-lft-out--89.5%
distribute-lft-out100.0%
Simplified100.0%
Taylor expanded in d3 around inf 51.9%
associate-*r*51.9%
neg-mul-151.9%
Simplified51.9%
if 1.24999999999999994e67 < d4 Initial program 88.0%
associate--l+88.0%
+-commutative88.0%
distribute-rgt-out--94.0%
distribute-lft-out--94.0%
distribute-lft-out100.0%
Simplified100.0%
Taylor expanded in d3 around 0 84.4%
Taylor expanded in d1 around 0 76.7%
Final simplification61.9%
(FPCore (d1 d2 d3 d4)
:precision binary64
(let* ((t_0 (* d1 (- d2 d1))) (t_1 (* d1 (- d2 d3))))
(if (<= d4 -7.2e-267)
t_1
(if (<= d4 1.3e-151)
t_0
(if (<= d4 1.3e-16)
t_1
(if (<= d4 2.9e+66)
t_0
(if (<= d4 5.2e+74) t_1 (* d1 (+ d4 d2)))))))))
double code(double d1, double d2, double d3, double d4) {
double t_0 = d1 * (d2 - d1);
double t_1 = d1 * (d2 - d3);
double tmp;
if (d4 <= -7.2e-267) {
tmp = t_1;
} else if (d4 <= 1.3e-151) {
tmp = t_0;
} else if (d4 <= 1.3e-16) {
tmp = t_1;
} else if (d4 <= 2.9e+66) {
tmp = t_0;
} else if (d4 <= 5.2e+74) {
tmp = t_1;
} 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) :: t_1
real(8) :: tmp
t_0 = d1 * (d2 - d1)
t_1 = d1 * (d2 - d3)
if (d4 <= (-7.2d-267)) then
tmp = t_1
else if (d4 <= 1.3d-151) then
tmp = t_0
else if (d4 <= 1.3d-16) then
tmp = t_1
else if (d4 <= 2.9d+66) then
tmp = t_0
else if (d4 <= 5.2d+74) then
tmp = t_1
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 - d1);
double t_1 = d1 * (d2 - d3);
double tmp;
if (d4 <= -7.2e-267) {
tmp = t_1;
} else if (d4 <= 1.3e-151) {
tmp = t_0;
} else if (d4 <= 1.3e-16) {
tmp = t_1;
} else if (d4 <= 2.9e+66) {
tmp = t_0;
} else if (d4 <= 5.2e+74) {
tmp = t_1;
} else {
tmp = d1 * (d4 + d2);
}
return tmp;
}
def code(d1, d2, d3, d4): t_0 = d1 * (d2 - d1) t_1 = d1 * (d2 - d3) tmp = 0 if d4 <= -7.2e-267: tmp = t_1 elif d4 <= 1.3e-151: tmp = t_0 elif d4 <= 1.3e-16: tmp = t_1 elif d4 <= 2.9e+66: tmp = t_0 elif d4 <= 5.2e+74: tmp = t_1 else: tmp = d1 * (d4 + d2) return tmp
function code(d1, d2, d3, d4) t_0 = Float64(d1 * Float64(d2 - d1)) t_1 = Float64(d1 * Float64(d2 - d3)) tmp = 0.0 if (d4 <= -7.2e-267) tmp = t_1; elseif (d4 <= 1.3e-151) tmp = t_0; elseif (d4 <= 1.3e-16) tmp = t_1; elseif (d4 <= 2.9e+66) tmp = t_0; elseif (d4 <= 5.2e+74) tmp = t_1; else tmp = Float64(d1 * Float64(d4 + d2)); end return tmp end
function tmp_2 = code(d1, d2, d3, d4) t_0 = d1 * (d2 - d1); t_1 = d1 * (d2 - d3); tmp = 0.0; if (d4 <= -7.2e-267) tmp = t_1; elseif (d4 <= 1.3e-151) tmp = t_0; elseif (d4 <= 1.3e-16) tmp = t_1; elseif (d4 <= 2.9e+66) tmp = t_0; elseif (d4 <= 5.2e+74) tmp = t_1; else tmp = d1 * (d4 + d2); end tmp_2 = tmp; end
code[d1_, d2_, d3_, d4_] := Block[{t$95$0 = N[(d1 * N[(d2 - d1), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$1 = N[(d1 * N[(d2 - d3), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[d4, -7.2e-267], t$95$1, If[LessEqual[d4, 1.3e-151], t$95$0, If[LessEqual[d4, 1.3e-16], t$95$1, If[LessEqual[d4, 2.9e+66], t$95$0, If[LessEqual[d4, 5.2e+74], t$95$1, N[(d1 * N[(d4 + d2), $MachinePrecision]), $MachinePrecision]]]]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := d1 \cdot \left(d2 - d1\right)\\
t_1 := d1 \cdot \left(d2 - d3\right)\\
\mathbf{if}\;d4 \leq -7.2 \cdot 10^{-267}:\\
\;\;\;\;t_1\\
\mathbf{elif}\;d4 \leq 1.3 \cdot 10^{-151}:\\
\;\;\;\;t_0\\
\mathbf{elif}\;d4 \leq 1.3 \cdot 10^{-16}:\\
\;\;\;\;t_1\\
\mathbf{elif}\;d4 \leq 2.9 \cdot 10^{+66}:\\
\;\;\;\;t_0\\
\mathbf{elif}\;d4 \leq 5.2 \cdot 10^{+74}:\\
\;\;\;\;t_1\\
\mathbf{else}:\\
\;\;\;\;d1 \cdot \left(d4 + d2\right)\\
\end{array}
\end{array}
if d4 < -7.2000000000000002e-267 or 1.3e-151 < d4 < 1.2999999999999999e-16 or 2.89999999999999986e66 < d4 < 5.2000000000000001e74Initial program 87.7%
associate--l+87.7%
+-commutative87.7%
distribute-rgt-out--89.6%
distribute-lft-out--92.2%
distribute-lft-out100.0%
Simplified100.0%
Taylor expanded in d4 around 0 74.6%
+-commutative74.6%
associate--r+74.6%
Simplified74.6%
Taylor expanded in d1 around 0 57.9%
if -7.2000000000000002e-267 < d4 < 1.3e-151 or 1.2999999999999999e-16 < d4 < 2.89999999999999986e66Initial program 90.7%
associate--l+90.7%
+-commutative90.7%
distribute-rgt-out--90.7%
distribute-lft-out--92.6%
distribute-lft-out100.0%
Simplified100.0%
Taylor expanded in d3 around 0 75.1%
Taylor expanded in d4 around 0 71.5%
if 5.2000000000000001e74 < d4 Initial program 87.2%
associate--l+87.2%
+-commutative87.2%
distribute-rgt-out--93.6%
distribute-lft-out--93.6%
distribute-lft-out100.0%
Simplified100.0%
Taylor expanded in d3 around 0 87.4%
Taylor expanded in d1 around 0 79.2%
Final simplification64.7%
(FPCore (d1 d2 d3 d4)
:precision binary64
(if (<= d2 -1e-38)
(* d1 (+ d4 d2))
(if (<= d2 -3.1e-84)
(* d1 (- d2 d1))
(if (or (<= d2 -2.4e-177) (not (<= d2 -3.5e-300)))
(* d1 (- d4 d3))
(* d1 (- d4 d1))))))
double code(double d1, double d2, double d3, double d4) {
double tmp;
if (d2 <= -1e-38) {
tmp = d1 * (d4 + d2);
} else if (d2 <= -3.1e-84) {
tmp = d1 * (d2 - d1);
} else if ((d2 <= -2.4e-177) || !(d2 <= -3.5e-300)) {
tmp = d1 * (d4 - d3);
} else {
tmp = d1 * (d4 - d1);
}
return tmp;
}
real(8) function code(d1, d2, d3, d4)
real(8), intent (in) :: d1
real(8), intent (in) :: d2
real(8), intent (in) :: d3
real(8), intent (in) :: d4
real(8) :: tmp
if (d2 <= (-1d-38)) then
tmp = d1 * (d4 + d2)
else if (d2 <= (-3.1d-84)) then
tmp = d1 * (d2 - d1)
else if ((d2 <= (-2.4d-177)) .or. (.not. (d2 <= (-3.5d-300)))) then
tmp = d1 * (d4 - d3)
else
tmp = d1 * (d4 - d1)
end if
code = tmp
end function
public static double code(double d1, double d2, double d3, double d4) {
double tmp;
if (d2 <= -1e-38) {
tmp = d1 * (d4 + d2);
} else if (d2 <= -3.1e-84) {
tmp = d1 * (d2 - d1);
} else if ((d2 <= -2.4e-177) || !(d2 <= -3.5e-300)) {
tmp = d1 * (d4 - d3);
} else {
tmp = d1 * (d4 - d1);
}
return tmp;
}
def code(d1, d2, d3, d4): tmp = 0 if d2 <= -1e-38: tmp = d1 * (d4 + d2) elif d2 <= -3.1e-84: tmp = d1 * (d2 - d1) elif (d2 <= -2.4e-177) or not (d2 <= -3.5e-300): tmp = d1 * (d4 - d3) else: tmp = d1 * (d4 - d1) return tmp
function code(d1, d2, d3, d4) tmp = 0.0 if (d2 <= -1e-38) tmp = Float64(d1 * Float64(d4 + d2)); elseif (d2 <= -3.1e-84) tmp = Float64(d1 * Float64(d2 - d1)); elseif ((d2 <= -2.4e-177) || !(d2 <= -3.5e-300)) tmp = Float64(d1 * Float64(d4 - d3)); else tmp = Float64(d1 * Float64(d4 - d1)); end return tmp end
function tmp_2 = code(d1, d2, d3, d4) tmp = 0.0; if (d2 <= -1e-38) tmp = d1 * (d4 + d2); elseif (d2 <= -3.1e-84) tmp = d1 * (d2 - d1); elseif ((d2 <= -2.4e-177) || ~((d2 <= -3.5e-300))) tmp = d1 * (d4 - d3); else tmp = d1 * (d4 - d1); end tmp_2 = tmp; end
code[d1_, d2_, d3_, d4_] := If[LessEqual[d2, -1e-38], N[(d1 * N[(d4 + d2), $MachinePrecision]), $MachinePrecision], If[LessEqual[d2, -3.1e-84], N[(d1 * N[(d2 - d1), $MachinePrecision]), $MachinePrecision], If[Or[LessEqual[d2, -2.4e-177], N[Not[LessEqual[d2, -3.5e-300]], $MachinePrecision]], N[(d1 * N[(d4 - d3), $MachinePrecision]), $MachinePrecision], N[(d1 * N[(d4 - d1), $MachinePrecision]), $MachinePrecision]]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;d2 \leq -1 \cdot 10^{-38}:\\
\;\;\;\;d1 \cdot \left(d4 + d2\right)\\
\mathbf{elif}\;d2 \leq -3.1 \cdot 10^{-84}:\\
\;\;\;\;d1 \cdot \left(d2 - d1\right)\\
\mathbf{elif}\;d2 \leq -2.4 \cdot 10^{-177} \lor \neg \left(d2 \leq -3.5 \cdot 10^{-300}\right):\\
\;\;\;\;d1 \cdot \left(d4 - d3\right)\\
\mathbf{else}:\\
\;\;\;\;d1 \cdot \left(d4 - d1\right)\\
\end{array}
\end{array}
if d2 < -9.9999999999999996e-39Initial program 88.1%
associate--l+88.1%
+-commutative88.1%
distribute-rgt-out--88.1%
distribute-lft-out--93.2%
distribute-lft-out100.0%
Simplified100.0%
Taylor expanded in d3 around 0 86.5%
Taylor expanded in d1 around 0 80.1%
if -9.9999999999999996e-39 < d2 < -3.10000000000000002e-84Initial program 71.4%
associate--l+71.4%
+-commutative71.4%
distribute-rgt-out--85.7%
distribute-lft-out--85.7%
distribute-lft-out100.0%
Simplified100.0%
Taylor expanded in d3 around 0 100.0%
Taylor expanded in d4 around 0 72.3%
if -3.10000000000000002e-84 < d2 < -2.3999999999999999e-177 or -3.5000000000000002e-300 < d2 Initial program 89.0%
associate--l+89.0%
+-commutative89.0%
distribute-rgt-out--91.4%
distribute-lft-out--92.6%
distribute-lft-out100.0%
Simplified100.0%
Taylor expanded in d1 around 0 81.0%
Taylor expanded in d2 around 0 58.9%
if -2.3999999999999999e-177 < d2 < -3.5000000000000002e-300Initial program 88.3%
associate--l+88.3%
+-commutative88.3%
distribute-rgt-out--92.2%
distribute-lft-out--92.2%
distribute-lft-out100.0%
Simplified100.0%
Taylor expanded in d3 around 0 77.5%
Taylor expanded in d2 around 0 77.5%
Final simplification66.1%
(FPCore (d1 d2 d3 d4) :precision binary64 (if (or (<= d3 -3.2e+109) (not (<= d3 1.05e+194))) (* d1 (- d4 d3)) (* d1 (- (+ d4 d2) d1))))
double code(double d1, double d2, double d3, double d4) {
double tmp;
if ((d3 <= -3.2e+109) || !(d3 <= 1.05e+194)) {
tmp = d1 * (d4 - 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 <= (-3.2d+109)) .or. (.not. (d3 <= 1.05d+194))) then
tmp = d1 * (d4 - 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 <= -3.2e+109) || !(d3 <= 1.05e+194)) {
tmp = d1 * (d4 - d3);
} else {
tmp = d1 * ((d4 + d2) - d1);
}
return tmp;
}
def code(d1, d2, d3, d4): tmp = 0 if (d3 <= -3.2e+109) or not (d3 <= 1.05e+194): tmp = d1 * (d4 - d3) else: tmp = d1 * ((d4 + d2) - d1) return tmp
function code(d1, d2, d3, d4) tmp = 0.0 if ((d3 <= -3.2e+109) || !(d3 <= 1.05e+194)) tmp = Float64(d1 * Float64(d4 - 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 <= -3.2e+109) || ~((d3 <= 1.05e+194))) tmp = d1 * (d4 - d3); else tmp = d1 * ((d4 + d2) - d1); end tmp_2 = tmp; end
code[d1_, d2_, d3_, d4_] := If[Or[LessEqual[d3, -3.2e+109], N[Not[LessEqual[d3, 1.05e+194]], $MachinePrecision]], N[(d1 * N[(d4 - d3), $MachinePrecision]), $MachinePrecision], N[(d1 * N[(N[(d4 + d2), $MachinePrecision] - d1), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;d3 \leq -3.2 \cdot 10^{+109} \lor \neg \left(d3 \leq 1.05 \cdot 10^{+194}\right):\\
\;\;\;\;d1 \cdot \left(d4 - d3\right)\\
\mathbf{else}:\\
\;\;\;\;d1 \cdot \left(\left(d4 + d2\right) - d1\right)\\
\end{array}
\end{array}
if d3 < -3.2000000000000001e109 or 1.05000000000000008e194 < d3 Initial program 80.3%
associate--l+80.3%
+-commutative80.3%
distribute-rgt-out--82.0%
distribute-lft-out--86.9%
distribute-lft-out100.0%
Simplified100.0%
Taylor expanded in d1 around 0 94.9%
Taylor expanded in d2 around 0 84.9%
if -3.2000000000000001e109 < d3 < 1.05000000000000008e194Initial program 90.7%
associate--l+90.7%
+-commutative90.7%
distribute-rgt-out--93.3%
distribute-lft-out--94.3%
distribute-lft-out100.0%
Simplified100.0%
Taylor expanded in d3 around 0 93.1%
Final simplification91.1%
(FPCore (d1 d2 d3 d4) :precision binary64 (if (or (<= d3 -2.4e+105) (not (<= d3 1.85e+18))) (* d1 (- (+ d4 d2) d3)) (* d1 (- (+ d4 d2) d1))))
double code(double d1, double d2, double d3, double d4) {
double tmp;
if ((d3 <= -2.4e+105) || !(d3 <= 1.85e+18)) {
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 <= (-2.4d+105)) .or. (.not. (d3 <= 1.85d+18))) 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 <= -2.4e+105) || !(d3 <= 1.85e+18)) {
tmp = d1 * ((d4 + d2) - d3);
} else {
tmp = d1 * ((d4 + d2) - d1);
}
return tmp;
}
def code(d1, d2, d3, d4): tmp = 0 if (d3 <= -2.4e+105) or not (d3 <= 1.85e+18): tmp = d1 * ((d4 + d2) - d3) else: tmp = d1 * ((d4 + d2) - d1) return tmp
function code(d1, d2, d3, d4) tmp = 0.0 if ((d3 <= -2.4e+105) || !(d3 <= 1.85e+18)) 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 <= -2.4e+105) || ~((d3 <= 1.85e+18))) 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, -2.4e+105], N[Not[LessEqual[d3, 1.85e+18]], $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 -2.4 \cdot 10^{+105} \lor \neg \left(d3 \leq 1.85 \cdot 10^{+18}\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 < -2.39999999999999975e105 or 1.85e18 < d3 Initial program 83.0%
associate--l+83.0%
+-commutative83.0%
distribute-rgt-out--85.0%
distribute-lft-out--89.0%
distribute-lft-out100.0%
Simplified100.0%
Taylor expanded in d1 around 0 91.1%
if -2.39999999999999975e105 < d3 < 1.85e18Initial program 91.6%
associate--l+91.6%
+-commutative91.6%
distribute-rgt-out--94.2%
distribute-lft-out--94.8%
distribute-lft-out100.0%
Simplified100.0%
Taylor expanded in d3 around 0 96.7%
Final simplification94.5%
(FPCore (d1 d2 d3 d4) :precision binary64 (if (<= d2 -1.42e-36) (* d1 (+ d4 d2)) (if (<= d2 2.05e-134) (* (- d1) (+ d1 d3)) (* d1 (- d4 d3)))))
double code(double d1, double d2, double d3, double d4) {
double tmp;
if (d2 <= -1.42e-36) {
tmp = d1 * (d4 + d2);
} else if (d2 <= 2.05e-134) {
tmp = -d1 * (d1 + 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 <= (-1.42d-36)) then
tmp = d1 * (d4 + d2)
else if (d2 <= 2.05d-134) then
tmp = -d1 * (d1 + 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 <= -1.42e-36) {
tmp = d1 * (d4 + d2);
} else if (d2 <= 2.05e-134) {
tmp = -d1 * (d1 + d3);
} else {
tmp = d1 * (d4 - d3);
}
return tmp;
}
def code(d1, d2, d3, d4): tmp = 0 if d2 <= -1.42e-36: tmp = d1 * (d4 + d2) elif d2 <= 2.05e-134: tmp = -d1 * (d1 + d3) else: tmp = d1 * (d4 - d3) return tmp
function code(d1, d2, d3, d4) tmp = 0.0 if (d2 <= -1.42e-36) tmp = Float64(d1 * Float64(d4 + d2)); elseif (d2 <= 2.05e-134) tmp = Float64(Float64(-d1) * Float64(d1 + 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 <= -1.42e-36) tmp = d1 * (d4 + d2); elseif (d2 <= 2.05e-134) tmp = -d1 * (d1 + d3); else tmp = d1 * (d4 - d3); end tmp_2 = tmp; end
code[d1_, d2_, d3_, d4_] := If[LessEqual[d2, -1.42e-36], N[(d1 * N[(d4 + d2), $MachinePrecision]), $MachinePrecision], If[LessEqual[d2, 2.05e-134], N[((-d1) * N[(d1 + d3), $MachinePrecision]), $MachinePrecision], N[(d1 * N[(d4 - d3), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;d2 \leq -1.42 \cdot 10^{-36}:\\
\;\;\;\;d1 \cdot \left(d4 + d2\right)\\
\mathbf{elif}\;d2 \leq 2.05 \cdot 10^{-134}:\\
\;\;\;\;\left(-d1\right) \cdot \left(d1 + d3\right)\\
\mathbf{else}:\\
\;\;\;\;d1 \cdot \left(d4 - d3\right)\\
\end{array}
\end{array}
if d2 < -1.41999999999999996e-36Initial program 88.1%
associate--l+88.1%
+-commutative88.1%
distribute-rgt-out--88.1%
distribute-lft-out--93.2%
distribute-lft-out100.0%
Simplified100.0%
Taylor expanded in d3 around 0 86.5%
Taylor expanded in d1 around 0 80.1%
if -1.41999999999999996e-36 < d2 < 2.0500000000000001e-134Initial program 91.3%
associate--l+91.3%
+-commutative91.3%
distribute-rgt-out--94.6%
distribute-lft-out--94.6%
distribute-lft-out100.0%
Simplified100.0%
Taylor expanded in d4 around 0 66.8%
+-commutative66.8%
associate--r+66.8%
Simplified66.8%
Taylor expanded in d2 around 0 65.9%
neg-mul-165.9%
distribute-neg-in65.9%
sub-neg65.9%
Simplified65.9%
if 2.0500000000000001e-134 < d2 Initial program 85.5%
associate--l+85.5%
+-commutative85.5%
distribute-rgt-out--88.4%
distribute-lft-out--90.3%
distribute-lft-out100.0%
Simplified100.0%
Taylor expanded in d1 around 0 86.2%
Taylor expanded in d2 around 0 51.5%
Final simplification63.3%
(FPCore (d1 d2 d3 d4) :precision binary64 (if (or (<= d3 -3.6e+118) (not (<= d3 5.4e+195))) (* d3 (- d1)) (* d1 (+ d4 d2))))
double code(double d1, double d2, double d3, double d4) {
double tmp;
if ((d3 <= -3.6e+118) || !(d3 <= 5.4e+195)) {
tmp = d3 * -d1;
} 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.6d+118)) .or. (.not. (d3 <= 5.4d+195))) then
tmp = d3 * -d1
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.6e+118) || !(d3 <= 5.4e+195)) {
tmp = d3 * -d1;
} else {
tmp = d1 * (d4 + d2);
}
return tmp;
}
def code(d1, d2, d3, d4): tmp = 0 if (d3 <= -3.6e+118) or not (d3 <= 5.4e+195): tmp = d3 * -d1 else: tmp = d1 * (d4 + d2) return tmp
function code(d1, d2, d3, d4) tmp = 0.0 if ((d3 <= -3.6e+118) || !(d3 <= 5.4e+195)) tmp = Float64(d3 * Float64(-d1)); 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.6e+118) || ~((d3 <= 5.4e+195))) tmp = d3 * -d1; else tmp = d1 * (d4 + d2); end tmp_2 = tmp; end
code[d1_, d2_, d3_, d4_] := If[Or[LessEqual[d3, -3.6e+118], N[Not[LessEqual[d3, 5.4e+195]], $MachinePrecision]], N[(d3 * (-d1)), $MachinePrecision], N[(d1 * N[(d4 + d2), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;d3 \leq -3.6 \cdot 10^{+118} \lor \neg \left(d3 \leq 5.4 \cdot 10^{+195}\right):\\
\;\;\;\;d3 \cdot \left(-d1\right)\\
\mathbf{else}:\\
\;\;\;\;d1 \cdot \left(d4 + d2\right)\\
\end{array}
\end{array}
if d3 < -3.6e118 or 5.4000000000000003e195 < d3 Initial program 78.9%
associate--l+78.9%
+-commutative78.9%
distribute-rgt-out--80.7%
distribute-lft-out--85.9%
distribute-lft-out100.0%
Simplified100.0%
Taylor expanded in d3 around inf 79.0%
associate-*r*79.0%
neg-mul-179.0%
Simplified79.0%
if -3.6e118 < d3 < 5.4000000000000003e195Initial program 90.9%
associate--l+90.9%
+-commutative90.9%
distribute-rgt-out--93.4%
distribute-lft-out--94.4%
distribute-lft-out100.0%
Simplified100.0%
Taylor expanded in d3 around 0 92.6%
Taylor expanded in d1 around 0 71.3%
Final simplification73.0%
(FPCore (d1 d2 d3 d4) :precision binary64 (if (<= d4 2.3e+66) (* d1 (- (- d2 d3) d1)) (* d1 (- (+ d4 d2) d3))))
double code(double d1, double d2, double d3, double d4) {
double tmp;
if (d4 <= 2.3e+66) {
tmp = d1 * ((d2 - d3) - d1);
} 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 (d4 <= 2.3d+66) then
tmp = d1 * ((d2 - d3) - d1)
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 (d4 <= 2.3e+66) {
tmp = d1 * ((d2 - d3) - d1);
} else {
tmp = d1 * ((d4 + d2) - d3);
}
return tmp;
}
def code(d1, d2, d3, d4): tmp = 0 if d4 <= 2.3e+66: tmp = d1 * ((d2 - d3) - d1) else: tmp = d1 * ((d4 + d2) - d3) return tmp
function code(d1, d2, d3, d4) tmp = 0.0 if (d4 <= 2.3e+66) tmp = Float64(d1 * Float64(Float64(d2 - d3) - d1)); 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 (d4 <= 2.3e+66) tmp = d1 * ((d2 - d3) - d1); else tmp = d1 * ((d4 + d2) - d3); end tmp_2 = tmp; end
code[d1_, d2_, d3_, d4_] := If[LessEqual[d4, 2.3e+66], N[(d1 * N[(N[(d2 - d3), $MachinePrecision] - d1), $MachinePrecision]), $MachinePrecision], N[(d1 * N[(N[(d4 + d2), $MachinePrecision] - d3), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;d4 \leq 2.3 \cdot 10^{+66}:\\
\;\;\;\;d1 \cdot \left(\left(d2 - d3\right) - d1\right)\\
\mathbf{else}:\\
\;\;\;\;d1 \cdot \left(\left(d4 + d2\right) - d3\right)\\
\end{array}
\end{array}
if d4 < 2.3e66Initial program 88.3%
associate--l+88.3%
+-commutative88.3%
distribute-rgt-out--89.8%
distribute-lft-out--92.2%
distribute-lft-out100.0%
Simplified100.0%
Taylor expanded in d4 around 0 79.9%
+-commutative79.9%
associate--r+79.9%
Simplified79.9%
if 2.3e66 < d4 Initial program 88.0%
associate--l+88.0%
+-commutative88.0%
distribute-rgt-out--94.0%
distribute-lft-out--94.0%
distribute-lft-out100.0%
Simplified100.0%
Taylor expanded in d1 around 0 92.4%
Final simplification82.4%
(FPCore (d1 d2 d3 d4) :precision binary64 (if (<= d2 -4.2e-31) (* d1 d2) (if (<= d2 1.05e-131) (* d1 (- d1)) (* d1 d4))))
double code(double d1, double d2, double d3, double d4) {
double tmp;
if (d2 <= -4.2e-31) {
tmp = d1 * d2;
} else if (d2 <= 1.05e-131) {
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 <= (-4.2d-31)) then
tmp = d1 * d2
else if (d2 <= 1.05d-131) 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 <= -4.2e-31) {
tmp = d1 * d2;
} else if (d2 <= 1.05e-131) {
tmp = d1 * -d1;
} else {
tmp = d1 * d4;
}
return tmp;
}
def code(d1, d2, d3, d4): tmp = 0 if d2 <= -4.2e-31: tmp = d1 * d2 elif d2 <= 1.05e-131: tmp = d1 * -d1 else: tmp = d1 * d4 return tmp
function code(d1, d2, d3, d4) tmp = 0.0 if (d2 <= -4.2e-31) tmp = Float64(d1 * d2); elseif (d2 <= 1.05e-131) 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 <= -4.2e-31) tmp = d1 * d2; elseif (d2 <= 1.05e-131) tmp = d1 * -d1; else tmp = d1 * d4; end tmp_2 = tmp; end
code[d1_, d2_, d3_, d4_] := If[LessEqual[d2, -4.2e-31], N[(d1 * d2), $MachinePrecision], If[LessEqual[d2, 1.05e-131], N[(d1 * (-d1)), $MachinePrecision], N[(d1 * d4), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;d2 \leq -4.2 \cdot 10^{-31}:\\
\;\;\;\;d1 \cdot d2\\
\mathbf{elif}\;d2 \leq 1.05 \cdot 10^{-131}:\\
\;\;\;\;d1 \cdot \left(-d1\right)\\
\mathbf{else}:\\
\;\;\;\;d1 \cdot d4\\
\end{array}
\end{array}
if d2 < -4.19999999999999982e-31Initial program 87.9%
associate--l+87.9%
+-commutative87.9%
distribute-rgt-out--87.9%
distribute-lft-out--93.0%
distribute-lft-out100.0%
Simplified100.0%
Taylor expanded in d2 around inf 58.4%
if -4.19999999999999982e-31 < d2 < 1.04999999999999999e-131Initial program 91.4%
associate--l+91.4%
+-commutative91.4%
distribute-rgt-out--94.6%
distribute-lft-out--94.6%
distribute-lft-out100.0%
Simplified100.0%
Taylor expanded in d1 around inf 42.5%
neg-mul-142.5%
Simplified42.5%
if 1.04999999999999999e-131 < d2 Initial program 85.5%
associate--l+85.5%
+-commutative85.5%
distribute-rgt-out--88.4%
distribute-lft-out--90.3%
distribute-lft-out100.0%
Simplified100.0%
Taylor expanded in d4 around inf 29.0%
Final simplification40.6%
(FPCore (d1 d2 d3 d4) :precision binary64 (if (<= d2 -1.9e-30) (* d1 (+ d4 d2)) (* d1 (- d4 d1))))
double code(double d1, double d2, double d3, double d4) {
double tmp;
if (d2 <= -1.9e-30) {
tmp = d1 * (d4 + d2);
} 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.9d-30)) then
tmp = d1 * (d4 + d2)
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.9e-30) {
tmp = d1 * (d4 + d2);
} else {
tmp = d1 * (d4 - d1);
}
return tmp;
}
def code(d1, d2, d3, d4): tmp = 0 if d2 <= -1.9e-30: tmp = d1 * (d4 + d2) else: tmp = d1 * (d4 - d1) return tmp
function code(d1, d2, d3, d4) tmp = 0.0 if (d2 <= -1.9e-30) tmp = Float64(d1 * Float64(d4 + d2)); 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.9e-30) tmp = d1 * (d4 + d2); else tmp = d1 * (d4 - d1); end tmp_2 = tmp; end
code[d1_, d2_, d3_, d4_] := If[LessEqual[d2, -1.9e-30], N[(d1 * N[(d4 + d2), $MachinePrecision]), $MachinePrecision], N[(d1 * N[(d4 - d1), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;d2 \leq -1.9 \cdot 10^{-30}:\\
\;\;\;\;d1 \cdot \left(d4 + d2\right)\\
\mathbf{else}:\\
\;\;\;\;d1 \cdot \left(d4 - d1\right)\\
\end{array}
\end{array}
if d2 < -1.9000000000000002e-30Initial program 87.9%
associate--l+87.9%
+-commutative87.9%
distribute-rgt-out--87.9%
distribute-lft-out--93.0%
distribute-lft-out100.0%
Simplified100.0%
Taylor expanded in d3 around 0 86.3%
Taylor expanded in d1 around 0 79.8%
if -1.9000000000000002e-30 < d2 Initial program 88.3%
associate--l+88.3%
+-commutative88.3%
distribute-rgt-out--91.4%
distribute-lft-out--92.4%
distribute-lft-out100.0%
Simplified100.0%
Taylor expanded in d3 around 0 77.9%
Taylor expanded in d2 around 0 61.0%
Final simplification65.2%
(FPCore (d1 d2 d3 d4) :precision binary64 (if (<= d4 1.02e+64) (* d1 d2) (* d1 d4)))
double code(double d1, double d2, double d3, double d4) {
double tmp;
if (d4 <= 1.02e+64) {
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.02d+64) 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.02e+64) {
tmp = d1 * d2;
} else {
tmp = d1 * d4;
}
return tmp;
}
def code(d1, d2, d3, d4): tmp = 0 if d4 <= 1.02e+64: tmp = d1 * d2 else: tmp = d1 * d4 return tmp
function code(d1, d2, d3, d4) tmp = 0.0 if (d4 <= 1.02e+64) 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.02e+64) tmp = d1 * d2; else tmp = d1 * d4; end tmp_2 = tmp; end
code[d1_, d2_, d3_, d4_] := If[LessEqual[d4, 1.02e+64], N[(d1 * d2), $MachinePrecision], N[(d1 * d4), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;d4 \leq 1.02 \cdot 10^{+64}:\\
\;\;\;\;d1 \cdot d2\\
\mathbf{else}:\\
\;\;\;\;d1 \cdot d4\\
\end{array}
\end{array}
if d4 < 1.01999999999999996e64Initial program 88.3%
associate--l+88.3%
+-commutative88.3%
distribute-rgt-out--89.8%
distribute-lft-out--92.2%
distribute-lft-out100.0%
Simplified100.0%
Taylor expanded in d2 around inf 35.6%
if 1.01999999999999996e64 < d4 Initial program 88.0%
associate--l+88.0%
+-commutative88.0%
distribute-rgt-out--94.0%
distribute-lft-out--94.0%
distribute-lft-out100.0%
Simplified100.0%
Taylor expanded in d4 around inf 65.4%
Final simplification41.4%
(FPCore (d1 d2 d3 d4) :precision binary64 (* d1 d2))
double code(double d1, double d2, double d3, double d4) {
return d1 * d2;
}
real(8) function code(d1, d2, d3, d4)
real(8), intent (in) :: d1
real(8), intent (in) :: d2
real(8), intent (in) :: d3
real(8), intent (in) :: d4
code = d1 * d2
end function
public static double code(double d1, double d2, double d3, double d4) {
return d1 * d2;
}
def code(d1, d2, d3, d4): return d1 * d2
function code(d1, d2, d3, d4) return Float64(d1 * d2) end
function tmp = code(d1, d2, d3, d4) tmp = d1 * d2; end
code[d1_, d2_, d3_, d4_] := N[(d1 * d2), $MachinePrecision]
\begin{array}{l}
\\
d1 \cdot d2
\end{array}
Initial program 88.2%
associate--l+88.2%
+-commutative88.2%
distribute-rgt-out--90.6%
distribute-lft-out--92.5%
distribute-lft-out100.0%
Simplified100.0%
Taylor expanded in d2 around inf 32.2%
Final simplification32.2%
(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 2023333
(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)))