
(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 89.4%
associate--l+89.4%
+-commutative89.4%
distribute-rgt-out--91.7%
distribute-lft-out--93.3%
distribute-lft-out100.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.38e+188)
(- (* d1 d3))
(if (<= d3 1.3e+70)
t_1
(if (<= d3 6.2e+140)
t_0
(if (<= d3 2.6e+193)
t_1
(if (<= d3 1e+253) (* d1 (- (+ d1 d3))) t_0)))))))
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.38e+188) {
tmp = -(d1 * d3);
} else if (d3 <= 1.3e+70) {
tmp = t_1;
} else if (d3 <= 6.2e+140) {
tmp = t_0;
} else if (d3 <= 2.6e+193) {
tmp = t_1;
} else if (d3 <= 1e+253) {
tmp = d1 * -(d1 + d3);
} else {
tmp = t_0;
}
return tmp;
}
real(8) function code(d1, d2, d3, d4)
real(8), intent (in) :: d1
real(8), intent (in) :: d2
real(8), intent (in) :: d3
real(8), intent (in) :: d4
real(8) :: t_0
real(8) :: t_1
real(8) :: tmp
t_0 = d1 * (d2 - d3)
t_1 = d1 * ((d4 + d2) - d1)
if (d3 <= (-1.38d+188)) then
tmp = -(d1 * d3)
else if (d3 <= 1.3d+70) then
tmp = t_1
else if (d3 <= 6.2d+140) then
tmp = t_0
else if (d3 <= 2.6d+193) then
tmp = t_1
else if (d3 <= 1d+253) then
tmp = d1 * -(d1 + d3)
else
tmp = t_0
end if
code = tmp
end function
public static double code(double d1, double d2, double d3, double d4) {
double t_0 = d1 * (d2 - d3);
double t_1 = d1 * ((d4 + d2) - d1);
double tmp;
if (d3 <= -1.38e+188) {
tmp = -(d1 * d3);
} else if (d3 <= 1.3e+70) {
tmp = t_1;
} else if (d3 <= 6.2e+140) {
tmp = t_0;
} else if (d3 <= 2.6e+193) {
tmp = t_1;
} else if (d3 <= 1e+253) {
tmp = d1 * -(d1 + d3);
} else {
tmp = t_0;
}
return tmp;
}
def code(d1, d2, d3, d4): t_0 = d1 * (d2 - d3) t_1 = d1 * ((d4 + d2) - d1) tmp = 0 if d3 <= -1.38e+188: tmp = -(d1 * d3) elif d3 <= 1.3e+70: tmp = t_1 elif d3 <= 6.2e+140: tmp = t_0 elif d3 <= 2.6e+193: tmp = t_1 elif d3 <= 1e+253: tmp = d1 * -(d1 + d3) else: tmp = t_0 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.38e+188) tmp = Float64(-Float64(d1 * d3)); elseif (d3 <= 1.3e+70) tmp = t_1; elseif (d3 <= 6.2e+140) tmp = t_0; elseif (d3 <= 2.6e+193) tmp = t_1; elseif (d3 <= 1e+253) tmp = Float64(d1 * Float64(-Float64(d1 + d3))); 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) - d1); tmp = 0.0; if (d3 <= -1.38e+188) tmp = -(d1 * d3); elseif (d3 <= 1.3e+70) tmp = t_1; elseif (d3 <= 6.2e+140) tmp = t_0; elseif (d3 <= 2.6e+193) tmp = t_1; elseif (d3 <= 1e+253) tmp = d1 * -(d1 + d3); 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[(N[(d4 + d2), $MachinePrecision] - d1), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[d3, -1.38e+188], (-N[(d1 * d3), $MachinePrecision]), If[LessEqual[d3, 1.3e+70], t$95$1, If[LessEqual[d3, 6.2e+140], t$95$0, If[LessEqual[d3, 2.6e+193], t$95$1, If[LessEqual[d3, 1e+253], N[(d1 * (-N[(d1 + d3), $MachinePrecision])), $MachinePrecision], t$95$0]]]]]]]
\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.38 \cdot 10^{+188}:\\
\;\;\;\;-d1 \cdot d3\\
\mathbf{elif}\;d3 \leq 1.3 \cdot 10^{+70}:\\
\;\;\;\;t_1\\
\mathbf{elif}\;d3 \leq 6.2 \cdot 10^{+140}:\\
\;\;\;\;t_0\\
\mathbf{elif}\;d3 \leq 2.6 \cdot 10^{+193}:\\
\;\;\;\;t_1\\
\mathbf{elif}\;d3 \leq 10^{+253}:\\
\;\;\;\;d1 \cdot \left(-\left(d1 + d3\right)\right)\\
\mathbf{else}:\\
\;\;\;\;t_0\\
\end{array}
\end{array}
if d3 < -1.3799999999999999e188Initial program 87.0%
associate--l+87.0%
+-commutative87.0%
distribute-rgt-out--87.0%
distribute-lft-out--87.0%
distribute-lft-out100.0%
Simplified100.0%
Taylor expanded in d3 around inf 100.0%
mul-1-neg100.0%
distribute-rgt-neg-out100.0%
Simplified100.0%
if -1.3799999999999999e188 < d3 < 1.3e70 or 6.2000000000000001e140 < d3 < 2.60000000000000013e193Initial program 90.3%
associate--l+90.3%
+-commutative90.3%
distribute-rgt-out--93.3%
distribute-lft-out--94.3%
distribute-lft-out100.0%
Simplified100.0%
Taylor expanded in d3 around 0 91.6%
if 1.3e70 < d3 < 6.2000000000000001e140 or 9.9999999999999994e252 < d3 Initial program 92.5%
associate--l+92.5%
+-commutative92.5%
distribute-rgt-out--92.5%
distribute-lft-out--96.2%
distribute-lft-out99.9%
Simplified99.9%
Taylor expanded in d1 around 0 99.9%
Taylor expanded in d4 around 0 84.9%
if 2.60000000000000013e193 < d3 < 9.9999999999999994e252Initial program 69.8%
associate--l+69.8%
+-commutative69.8%
distribute-rgt-out--69.8%
distribute-lft-out--79.8%
distribute-lft-out99.8%
Simplified99.8%
Taylor expanded in d4 around 0 99.8%
+-commutative99.8%
associate--r+99.8%
Simplified99.8%
Taylor expanded in d2 around 0 90.6%
mul-1-neg90.6%
*-commutative90.6%
distribute-rgt-neg-in90.6%
Simplified90.6%
Final simplification91.6%
(FPCore (d1 d2 d3 d4)
:precision binary64
(let* ((t_0 (- (* d1 d3))))
(if (<= d4 -7.5e-258)
(* d1 d2)
(if (<= d4 7e-300)
t_0
(if (<= d4 2.2e-117)
(* d1 d2)
(if (<= d4 4.5e+29)
t_0
(if (or (<= d4 1.6e+65) (not (<= d4 1.35e+75)))
(* d1 d4)
(* d1 d2))))))))
double code(double d1, double d2, double d3, double d4) {
double t_0 = -(d1 * d3);
double tmp;
if (d4 <= -7.5e-258) {
tmp = d1 * d2;
} else if (d4 <= 7e-300) {
tmp = t_0;
} else if (d4 <= 2.2e-117) {
tmp = d1 * d2;
} else if (d4 <= 4.5e+29) {
tmp = t_0;
} else if ((d4 <= 1.6e+65) || !(d4 <= 1.35e+75)) {
tmp = d1 * d4;
} else {
tmp = d1 * 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 * d3)
if (d4 <= (-7.5d-258)) then
tmp = d1 * d2
else if (d4 <= 7d-300) then
tmp = t_0
else if (d4 <= 2.2d-117) then
tmp = d1 * d2
else if (d4 <= 4.5d+29) then
tmp = t_0
else if ((d4 <= 1.6d+65) .or. (.not. (d4 <= 1.35d+75))) then
tmp = d1 * d4
else
tmp = d1 * d2
end if
code = tmp
end function
public static double code(double d1, double d2, double d3, double d4) {
double t_0 = -(d1 * d3);
double tmp;
if (d4 <= -7.5e-258) {
tmp = d1 * d2;
} else if (d4 <= 7e-300) {
tmp = t_0;
} else if (d4 <= 2.2e-117) {
tmp = d1 * d2;
} else if (d4 <= 4.5e+29) {
tmp = t_0;
} else if ((d4 <= 1.6e+65) || !(d4 <= 1.35e+75)) {
tmp = d1 * d4;
} else {
tmp = d1 * d2;
}
return tmp;
}
def code(d1, d2, d3, d4): t_0 = -(d1 * d3) tmp = 0 if d4 <= -7.5e-258: tmp = d1 * d2 elif d4 <= 7e-300: tmp = t_0 elif d4 <= 2.2e-117: tmp = d1 * d2 elif d4 <= 4.5e+29: tmp = t_0 elif (d4 <= 1.6e+65) or not (d4 <= 1.35e+75): tmp = d1 * d4 else: tmp = d1 * d2 return tmp
function code(d1, d2, d3, d4) t_0 = Float64(-Float64(d1 * d3)) tmp = 0.0 if (d4 <= -7.5e-258) tmp = Float64(d1 * d2); elseif (d4 <= 7e-300) tmp = t_0; elseif (d4 <= 2.2e-117) tmp = Float64(d1 * d2); elseif (d4 <= 4.5e+29) tmp = t_0; elseif ((d4 <= 1.6e+65) || !(d4 <= 1.35e+75)) tmp = Float64(d1 * d4); else tmp = Float64(d1 * d2); end return tmp end
function tmp_2 = code(d1, d2, d3, d4) t_0 = -(d1 * d3); tmp = 0.0; if (d4 <= -7.5e-258) tmp = d1 * d2; elseif (d4 <= 7e-300) tmp = t_0; elseif (d4 <= 2.2e-117) tmp = d1 * d2; elseif (d4 <= 4.5e+29) tmp = t_0; elseif ((d4 <= 1.6e+65) || ~((d4 <= 1.35e+75))) tmp = d1 * d4; else tmp = d1 * d2; end tmp_2 = tmp; end
code[d1_, d2_, d3_, d4_] := Block[{t$95$0 = (-N[(d1 * d3), $MachinePrecision])}, If[LessEqual[d4, -7.5e-258], N[(d1 * d2), $MachinePrecision], If[LessEqual[d4, 7e-300], t$95$0, If[LessEqual[d4, 2.2e-117], N[(d1 * d2), $MachinePrecision], If[LessEqual[d4, 4.5e+29], t$95$0, If[Or[LessEqual[d4, 1.6e+65], N[Not[LessEqual[d4, 1.35e+75]], $MachinePrecision]], N[(d1 * d4), $MachinePrecision], N[(d1 * d2), $MachinePrecision]]]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := -d1 \cdot d3\\
\mathbf{if}\;d4 \leq -7.5 \cdot 10^{-258}:\\
\;\;\;\;d1 \cdot d2\\
\mathbf{elif}\;d4 \leq 7 \cdot 10^{-300}:\\
\;\;\;\;t_0\\
\mathbf{elif}\;d4 \leq 2.2 \cdot 10^{-117}:\\
\;\;\;\;d1 \cdot d2\\
\mathbf{elif}\;d4 \leq 4.5 \cdot 10^{+29}:\\
\;\;\;\;t_0\\
\mathbf{elif}\;d4 \leq 1.6 \cdot 10^{+65} \lor \neg \left(d4 \leq 1.35 \cdot 10^{+75}\right):\\
\;\;\;\;d1 \cdot d4\\
\mathbf{else}:\\
\;\;\;\;d1 \cdot d2\\
\end{array}
\end{array}
if d4 < -7.4999999999999998e-258 or 7.0000000000000003e-300 < d4 < 2.2000000000000001e-117 or 1.60000000000000003e65 < d4 < 1.34999999999999999e75Initial program 89.8%
associate--l+89.8%
+-commutative89.8%
distribute-rgt-out--91.7%
distribute-lft-out--93.0%
distribute-lft-out100.0%
Simplified100.0%
Taylor expanded in d2 around inf 45.6%
if -7.4999999999999998e-258 < d4 < 7.0000000000000003e-300 or 2.2000000000000001e-117 < d4 < 4.5000000000000002e29Initial program 99.9%
associate--l+99.9%
+-commutative99.9%
distribute-rgt-out--99.9%
distribute-lft-out--99.9%
distribute-lft-out99.9%
Simplified99.9%
Taylor expanded in d3 around inf 42.0%
mul-1-neg42.0%
distribute-rgt-neg-out42.0%
Simplified42.0%
if 4.5000000000000002e29 < d4 < 1.60000000000000003e65 or 1.34999999999999999e75 < d4 Initial program 81.3%
associate--l+81.3%
+-commutative81.3%
distribute-rgt-out--86.4%
distribute-lft-out--89.8%
distribute-lft-out99.9%
Simplified99.9%
Taylor expanded in d4 around inf 62.9%
Final simplification49.0%
(FPCore (d1 d2 d3 d4)
:precision binary64
(let* ((t_0 (- (* d1 d3))) (t_1 (* d1 (+ d4 d2))))
(if (<= d3 -1.02e+188)
t_0
(if (<= d3 -6.2e-232)
t_1
(if (<= d3 -1.3e-276) (- (* d1 d1)) (if (<= d3 2.3e+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 <= -1.02e+188) {
tmp = t_0;
} else if (d3 <= -6.2e-232) {
tmp = t_1;
} else if (d3 <= -1.3e-276) {
tmp = -(d1 * d1);
} else if (d3 <= 2.3e+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 <= (-1.02d+188)) then
tmp = t_0
else if (d3 <= (-6.2d-232)) then
tmp = t_1
else if (d3 <= (-1.3d-276)) then
tmp = -(d1 * d1)
else if (d3 <= 2.3d+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 <= -1.02e+188) {
tmp = t_0;
} else if (d3 <= -6.2e-232) {
tmp = t_1;
} else if (d3 <= -1.3e-276) {
tmp = -(d1 * d1);
} else if (d3 <= 2.3e+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 <= -1.02e+188: tmp = t_0 elif d3 <= -6.2e-232: tmp = t_1 elif d3 <= -1.3e-276: tmp = -(d1 * d1) elif d3 <= 2.3e+193: tmp = t_1 else: tmp = t_0 return tmp
function code(d1, d2, d3, d4) t_0 = Float64(-Float64(d1 * d3)) t_1 = Float64(d1 * Float64(d4 + d2)) tmp = 0.0 if (d3 <= -1.02e+188) tmp = t_0; elseif (d3 <= -6.2e-232) tmp = t_1; elseif (d3 <= -1.3e-276) tmp = Float64(-Float64(d1 * d1)); elseif (d3 <= 2.3e+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 <= -1.02e+188) tmp = t_0; elseif (d3 <= -6.2e-232) tmp = t_1; elseif (d3 <= -1.3e-276) tmp = -(d1 * d1); elseif (d3 <= 2.3e+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, -1.02e+188], t$95$0, If[LessEqual[d3, -6.2e-232], t$95$1, If[LessEqual[d3, -1.3e-276], (-N[(d1 * d1), $MachinePrecision]), If[LessEqual[d3, 2.3e+193], t$95$1, t$95$0]]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := -d1 \cdot d3\\
t_1 := d1 \cdot \left(d4 + d2\right)\\
\mathbf{if}\;d3 \leq -1.02 \cdot 10^{+188}:\\
\;\;\;\;t_0\\
\mathbf{elif}\;d3 \leq -6.2 \cdot 10^{-232}:\\
\;\;\;\;t_1\\
\mathbf{elif}\;d3 \leq -1.3 \cdot 10^{-276}:\\
\;\;\;\;-d1 \cdot d1\\
\mathbf{elif}\;d3 \leq 2.3 \cdot 10^{+193}:\\
\;\;\;\;t_1\\
\mathbf{else}:\\
\;\;\;\;t_0\\
\end{array}
\end{array}
if d3 < -1.02e188 or 2.30000000000000013e193 < d3 Initial program 85.0%
associate--l+85.0%
+-commutative85.0%
distribute-rgt-out--85.0%
distribute-lft-out--87.5%
distribute-lft-out100.0%
Simplified100.0%
Taylor expanded in d3 around inf 90.4%
mul-1-neg90.4%
distribute-rgt-neg-out90.4%
Simplified90.4%
if -1.02e188 < d3 < -6.1999999999999998e-232 or -1.29999999999999992e-276 < d3 < 2.30000000000000013e193Initial program 89.9%
associate--l+89.9%
+-commutative89.9%
distribute-rgt-out--92.7%
distribute-lft-out--94.2%
distribute-lft-out100.0%
Simplified100.0%
Taylor expanded in d1 around 0 82.8%
Taylor expanded in d3 around 0 70.4%
+-commutative70.4%
Simplified70.4%
if -6.1999999999999998e-232 < d3 < -1.29999999999999992e-276Initial program 99.8%
associate--l+99.8%
+-commutative99.8%
distribute-rgt-out--99.8%
distribute-lft-out--99.8%
distribute-lft-out100.0%
Simplified100.0%
Taylor expanded in d3 around 0 100.0%
Taylor expanded in d1 around inf 85.6%
neg-mul-185.6%
Simplified85.6%
Final simplification74.0%
(FPCore (d1 d2 d3 d4)
:precision binary64
(let* ((t_0 (* d1 (- d2 d3))))
(if (<= d4 1.9e-283)
t_0
(if (<= d4 1.85e-122)
(* d1 (- d2 d1))
(if (<= d4 2.5e+29)
t_0
(if (<= d4 7.5e+88) (* d1 (+ d4 d2)) (* d1 (- d4 d3))))))))
double code(double d1, double d2, double d3, double d4) {
double t_0 = d1 * (d2 - d3);
double tmp;
if (d4 <= 1.9e-283) {
tmp = t_0;
} else if (d4 <= 1.85e-122) {
tmp = d1 * (d2 - d1);
} else if (d4 <= 2.5e+29) {
tmp = t_0;
} else if (d4 <= 7.5e+88) {
tmp = d1 * (d4 + d2);
} 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 (d4 <= 1.9d-283) then
tmp = t_0
else if (d4 <= 1.85d-122) then
tmp = d1 * (d2 - d1)
else if (d4 <= 2.5d+29) then
tmp = t_0
else if (d4 <= 7.5d+88) then
tmp = d1 * (d4 + d2)
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 (d4 <= 1.9e-283) {
tmp = t_0;
} else if (d4 <= 1.85e-122) {
tmp = d1 * (d2 - d1);
} else if (d4 <= 2.5e+29) {
tmp = t_0;
} else if (d4 <= 7.5e+88) {
tmp = d1 * (d4 + d2);
} else {
tmp = d1 * (d4 - d3);
}
return tmp;
}
def code(d1, d2, d3, d4): t_0 = d1 * (d2 - d3) tmp = 0 if d4 <= 1.9e-283: tmp = t_0 elif d4 <= 1.85e-122: tmp = d1 * (d2 - d1) elif d4 <= 2.5e+29: tmp = t_0 elif d4 <= 7.5e+88: tmp = d1 * (d4 + d2) else: tmp = d1 * (d4 - d3) return tmp
function code(d1, d2, d3, d4) t_0 = Float64(d1 * Float64(d2 - d3)) tmp = 0.0 if (d4 <= 1.9e-283) tmp = t_0; elseif (d4 <= 1.85e-122) tmp = Float64(d1 * Float64(d2 - d1)); elseif (d4 <= 2.5e+29) tmp = t_0; elseif (d4 <= 7.5e+88) tmp = Float64(d1 * Float64(d4 + d2)); 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 (d4 <= 1.9e-283) tmp = t_0; elseif (d4 <= 1.85e-122) tmp = d1 * (d2 - d1); elseif (d4 <= 2.5e+29) tmp = t_0; elseif (d4 <= 7.5e+88) tmp = d1 * (d4 + d2); 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[d4, 1.9e-283], t$95$0, If[LessEqual[d4, 1.85e-122], N[(d1 * N[(d2 - d1), $MachinePrecision]), $MachinePrecision], If[LessEqual[d4, 2.5e+29], t$95$0, If[LessEqual[d4, 7.5e+88], N[(d1 * N[(d4 + d2), $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}\;d4 \leq 1.9 \cdot 10^{-283}:\\
\;\;\;\;t_0\\
\mathbf{elif}\;d4 \leq 1.85 \cdot 10^{-122}:\\
\;\;\;\;d1 \cdot \left(d2 - d1\right)\\
\mathbf{elif}\;d4 \leq 2.5 \cdot 10^{+29}:\\
\;\;\;\;t_0\\
\mathbf{elif}\;d4 \leq 7.5 \cdot 10^{+88}:\\
\;\;\;\;d1 \cdot \left(d4 + d2\right)\\
\mathbf{else}:\\
\;\;\;\;d1 \cdot \left(d4 - d3\right)\\
\end{array}
\end{array}
if d4 < 1.9000000000000001e-283 or 1.8499999999999999e-122 < d4 < 2.5e29Initial program 91.9%
associate--l+91.9%
+-commutative91.9%
distribute-rgt-out--93.8%
distribute-lft-out--95.0%
distribute-lft-out100.0%
Simplified100.0%
Taylor expanded in d1 around 0 85.3%
Taylor expanded in d4 around 0 66.2%
if 1.9000000000000001e-283 < d4 < 1.8499999999999999e-122Initial program 90.0%
associate--l+90.0%
+-commutative90.0%
distribute-rgt-out--90.0%
distribute-lft-out--90.0%
distribute-lft-out100.0%
Simplified100.0%
Taylor expanded in d3 around 0 82.0%
Taylor expanded in d4 around 0 82.0%
if 2.5e29 < d4 < 7.50000000000000031e88Initial program 88.2%
associate--l+88.2%
+-commutative88.2%
distribute-rgt-out--94.1%
distribute-lft-out--94.1%
distribute-lft-out100.0%
Simplified100.0%
Taylor expanded in d1 around 0 82.7%
Taylor expanded in d3 around 0 77.8%
+-commutative77.8%
Simplified77.8%
if 7.50000000000000031e88 < d4 Initial program 80.8%
associate--l+80.8%
+-commutative80.8%
distribute-rgt-out--85.0%
distribute-lft-out--89.3%
distribute-lft-out99.9%
Simplified99.9%
Taylor expanded in d1 around 0 89.3%
Taylor expanded in d2 around 0 83.8%
Final simplification72.1%
(FPCore (d1 d2 d3 d4)
:precision binary64
(if (<= d4 2.5e-283)
(* d1 (- d2 d3))
(if (<= d4 3.8e-121)
(* d1 (- d2 d1))
(if (<= d4 1.15e+32)
(* d1 (- (+ d1 d3)))
(if (<= d4 2.1e+88) (* d1 (+ d4 d2)) (* d1 (- d4 d3)))))))
double code(double d1, double d2, double d3, double d4) {
double tmp;
if (d4 <= 2.5e-283) {
tmp = d1 * (d2 - d3);
} else if (d4 <= 3.8e-121) {
tmp = d1 * (d2 - d1);
} else if (d4 <= 1.15e+32) {
tmp = d1 * -(d1 + d3);
} else if (d4 <= 2.1e+88) {
tmp = d1 * (d4 + d2);
} 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 (d4 <= 2.5d-283) then
tmp = d1 * (d2 - d3)
else if (d4 <= 3.8d-121) then
tmp = d1 * (d2 - d1)
else if (d4 <= 1.15d+32) then
tmp = d1 * -(d1 + d3)
else if (d4 <= 2.1d+88) then
tmp = d1 * (d4 + d2)
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 (d4 <= 2.5e-283) {
tmp = d1 * (d2 - d3);
} else if (d4 <= 3.8e-121) {
tmp = d1 * (d2 - d1);
} else if (d4 <= 1.15e+32) {
tmp = d1 * -(d1 + d3);
} else if (d4 <= 2.1e+88) {
tmp = d1 * (d4 + d2);
} else {
tmp = d1 * (d4 - d3);
}
return tmp;
}
def code(d1, d2, d3, d4): tmp = 0 if d4 <= 2.5e-283: tmp = d1 * (d2 - d3) elif d4 <= 3.8e-121: tmp = d1 * (d2 - d1) elif d4 <= 1.15e+32: tmp = d1 * -(d1 + d3) elif d4 <= 2.1e+88: tmp = d1 * (d4 + d2) else: tmp = d1 * (d4 - d3) return tmp
function code(d1, d2, d3, d4) tmp = 0.0 if (d4 <= 2.5e-283) tmp = Float64(d1 * Float64(d2 - d3)); elseif (d4 <= 3.8e-121) tmp = Float64(d1 * Float64(d2 - d1)); elseif (d4 <= 1.15e+32) tmp = Float64(d1 * Float64(-Float64(d1 + d3))); elseif (d4 <= 2.1e+88) tmp = Float64(d1 * Float64(d4 + d2)); else tmp = Float64(d1 * Float64(d4 - d3)); end return tmp end
function tmp_2 = code(d1, d2, d3, d4) tmp = 0.0; if (d4 <= 2.5e-283) tmp = d1 * (d2 - d3); elseif (d4 <= 3.8e-121) tmp = d1 * (d2 - d1); elseif (d4 <= 1.15e+32) tmp = d1 * -(d1 + d3); elseif (d4 <= 2.1e+88) tmp = d1 * (d4 + d2); else tmp = d1 * (d4 - d3); end tmp_2 = tmp; end
code[d1_, d2_, d3_, d4_] := If[LessEqual[d4, 2.5e-283], N[(d1 * N[(d2 - d3), $MachinePrecision]), $MachinePrecision], If[LessEqual[d4, 3.8e-121], N[(d1 * N[(d2 - d1), $MachinePrecision]), $MachinePrecision], If[LessEqual[d4, 1.15e+32], N[(d1 * (-N[(d1 + d3), $MachinePrecision])), $MachinePrecision], If[LessEqual[d4, 2.1e+88], N[(d1 * N[(d4 + d2), $MachinePrecision]), $MachinePrecision], N[(d1 * N[(d4 - d3), $MachinePrecision]), $MachinePrecision]]]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;d4 \leq 2.5 \cdot 10^{-283}:\\
\;\;\;\;d1 \cdot \left(d2 - d3\right)\\
\mathbf{elif}\;d4 \leq 3.8 \cdot 10^{-121}:\\
\;\;\;\;d1 \cdot \left(d2 - d1\right)\\
\mathbf{elif}\;d4 \leq 1.15 \cdot 10^{+32}:\\
\;\;\;\;d1 \cdot \left(-\left(d1 + d3\right)\right)\\
\mathbf{elif}\;d4 \leq 2.1 \cdot 10^{+88}:\\
\;\;\;\;d1 \cdot \left(d4 + d2\right)\\
\mathbf{else}:\\
\;\;\;\;d1 \cdot \left(d4 - d3\right)\\
\end{array}
\end{array}
if d4 < 2.5e-283Initial program 90.4%
associate--l+90.4%
+-commutative90.4%
distribute-rgt-out--92.6%
distribute-lft-out--94.1%
distribute-lft-out100.0%
Simplified100.0%
Taylor expanded in d1 around 0 85.8%
Taylor expanded in d4 around 0 64.5%
if 2.5e-283 < d4 < 3.8000000000000001e-121Initial program 90.6%
associate--l+90.6%
+-commutative90.6%
distribute-rgt-out--90.6%
distribute-lft-out--90.6%
distribute-lft-out100.0%
Simplified100.0%
Taylor expanded in d3 around 0 80.1%
Taylor expanded in d4 around 0 80.1%
if 3.8000000000000001e-121 < d4 < 1.15e32Initial program 99.9%
associate--l+99.9%
+-commutative99.9%
distribute-rgt-out--99.9%
distribute-lft-out--99.9%
distribute-lft-out99.9%
Simplified99.9%
Taylor expanded in d4 around 0 88.4%
+-commutative88.4%
associate--r+88.4%
Simplified88.4%
Taylor expanded in d2 around 0 65.3%
mul-1-neg65.3%
*-commutative65.3%
distribute-rgt-neg-in65.3%
Simplified65.3%
if 1.15e32 < d4 < 2.1e88Initial program 87.5%
associate--l+87.5%
+-commutative87.5%
distribute-rgt-out--93.8%
distribute-lft-out--93.8%
distribute-lft-out100.0%
Simplified100.0%
Taylor expanded in d1 around 0 81.7%
Taylor expanded in d3 around 0 76.4%
+-commutative76.4%
Simplified76.4%
if 2.1e88 < d4 Initial program 80.8%
associate--l+80.8%
+-commutative80.8%
distribute-rgt-out--85.0%
distribute-lft-out--89.3%
distribute-lft-out99.9%
Simplified99.9%
Taylor expanded in d1 around 0 89.3%
Taylor expanded in d2 around 0 83.8%
Final simplification70.8%
(FPCore (d1 d2 d3 d4)
:precision binary64
(if (<= d4 5.8e-150)
(* d1 d2)
(if (<= d4 1.85e+31)
(- (* d1 d1))
(if (or (<= d4 1.3e+65) (not (<= d4 8.8e+73))) (* d1 d4) (* d1 d2)))))
double code(double d1, double d2, double d3, double d4) {
double tmp;
if (d4 <= 5.8e-150) {
tmp = d1 * d2;
} else if (d4 <= 1.85e+31) {
tmp = -(d1 * d1);
} else if ((d4 <= 1.3e+65) || !(d4 <= 8.8e+73)) {
tmp = d1 * d4;
} else {
tmp = d1 * 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 (d4 <= 5.8d-150) then
tmp = d1 * d2
else if (d4 <= 1.85d+31) then
tmp = -(d1 * d1)
else if ((d4 <= 1.3d+65) .or. (.not. (d4 <= 8.8d+73))) then
tmp = d1 * d4
else
tmp = d1 * d2
end if
code = tmp
end function
public static double code(double d1, double d2, double d3, double d4) {
double tmp;
if (d4 <= 5.8e-150) {
tmp = d1 * d2;
} else if (d4 <= 1.85e+31) {
tmp = -(d1 * d1);
} else if ((d4 <= 1.3e+65) || !(d4 <= 8.8e+73)) {
tmp = d1 * d4;
} else {
tmp = d1 * d2;
}
return tmp;
}
def code(d1, d2, d3, d4): tmp = 0 if d4 <= 5.8e-150: tmp = d1 * d2 elif d4 <= 1.85e+31: tmp = -(d1 * d1) elif (d4 <= 1.3e+65) or not (d4 <= 8.8e+73): tmp = d1 * d4 else: tmp = d1 * d2 return tmp
function code(d1, d2, d3, d4) tmp = 0.0 if (d4 <= 5.8e-150) tmp = Float64(d1 * d2); elseif (d4 <= 1.85e+31) tmp = Float64(-Float64(d1 * d1)); elseif ((d4 <= 1.3e+65) || !(d4 <= 8.8e+73)) tmp = Float64(d1 * d4); else tmp = Float64(d1 * d2); end return tmp end
function tmp_2 = code(d1, d2, d3, d4) tmp = 0.0; if (d4 <= 5.8e-150) tmp = d1 * d2; elseif (d4 <= 1.85e+31) tmp = -(d1 * d1); elseif ((d4 <= 1.3e+65) || ~((d4 <= 8.8e+73))) tmp = d1 * d4; else tmp = d1 * d2; end tmp_2 = tmp; end
code[d1_, d2_, d3_, d4_] := If[LessEqual[d4, 5.8e-150], N[(d1 * d2), $MachinePrecision], If[LessEqual[d4, 1.85e+31], (-N[(d1 * d1), $MachinePrecision]), If[Or[LessEqual[d4, 1.3e+65], N[Not[LessEqual[d4, 8.8e+73]], $MachinePrecision]], N[(d1 * d4), $MachinePrecision], N[(d1 * d2), $MachinePrecision]]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;d4 \leq 5.8 \cdot 10^{-150}:\\
\;\;\;\;d1 \cdot d2\\
\mathbf{elif}\;d4 \leq 1.85 \cdot 10^{+31}:\\
\;\;\;\;-d1 \cdot d1\\
\mathbf{elif}\;d4 \leq 1.3 \cdot 10^{+65} \lor \neg \left(d4 \leq 8.8 \cdot 10^{+73}\right):\\
\;\;\;\;d1 \cdot d4\\
\mathbf{else}:\\
\;\;\;\;d1 \cdot d2\\
\end{array}
\end{array}
if d4 < 5.7999999999999996e-150 or 1.30000000000000001e65 < d4 < 8.8e73Initial program 91.0%
associate--l+91.0%
+-commutative91.0%
distribute-rgt-out--92.8%
distribute-lft-out--94.0%
distribute-lft-out100.0%
Simplified100.0%
Taylor expanded in d2 around inf 44.3%
if 5.7999999999999996e-150 < d4 < 1.8499999999999999e31Initial program 96.6%
associate--l+96.6%
+-commutative96.6%
distribute-rgt-out--96.6%
distribute-lft-out--96.6%
distribute-lft-out99.9%
Simplified99.9%
Taylor expanded in d3 around 0 59.8%
Taylor expanded in d1 around inf 26.4%
neg-mul-126.4%
Simplified26.4%
if 1.8499999999999999e31 < d4 < 1.30000000000000001e65 or 8.8e73 < d4 Initial program 81.3%
associate--l+81.3%
+-commutative81.3%
distribute-rgt-out--86.4%
distribute-lft-out--89.8%
distribute-lft-out99.9%
Simplified99.9%
Taylor expanded in d4 around inf 62.9%
Final simplification46.5%
(FPCore (d1 d2 d3 d4)
:precision binary64
(let* ((t_0 (* d1 (- d2 d3))))
(if (<= d4 3.1e-283)
t_0
(if (<= d4 1.8e-122)
(* d1 (- d2 d1))
(if (<= d4 7.8e+29) 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 <= 3.1e-283) {
tmp = t_0;
} else if (d4 <= 1.8e-122) {
tmp = d1 * (d2 - d1);
} else if (d4 <= 7.8e+29) {
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 <= 3.1d-283) then
tmp = t_0
else if (d4 <= 1.8d-122) then
tmp = d1 * (d2 - d1)
else if (d4 <= 7.8d+29) 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 <= 3.1e-283) {
tmp = t_0;
} else if (d4 <= 1.8e-122) {
tmp = d1 * (d2 - d1);
} else if (d4 <= 7.8e+29) {
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 <= 3.1e-283: tmp = t_0 elif d4 <= 1.8e-122: tmp = d1 * (d2 - d1) elif d4 <= 7.8e+29: 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 <= 3.1e-283) tmp = t_0; elseif (d4 <= 1.8e-122) tmp = Float64(d1 * Float64(d2 - d1)); elseif (d4 <= 7.8e+29) 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 <= 3.1e-283) tmp = t_0; elseif (d4 <= 1.8e-122) tmp = d1 * (d2 - d1); elseif (d4 <= 7.8e+29) 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, 3.1e-283], t$95$0, If[LessEqual[d4, 1.8e-122], N[(d1 * N[(d2 - d1), $MachinePrecision]), $MachinePrecision], If[LessEqual[d4, 7.8e+29], 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 3.1 \cdot 10^{-283}:\\
\;\;\;\;t_0\\
\mathbf{elif}\;d4 \leq 1.8 \cdot 10^{-122}:\\
\;\;\;\;d1 \cdot \left(d2 - d1\right)\\
\mathbf{elif}\;d4 \leq 7.8 \cdot 10^{+29}:\\
\;\;\;\;t_0\\
\mathbf{else}:\\
\;\;\;\;d1 \cdot \left(d4 + d2\right)\\
\end{array}
\end{array}
if d4 < 3.10000000000000004e-283 or 1.79999999999999997e-122 < d4 < 7.79999999999999937e29Initial program 91.9%
associate--l+91.9%
+-commutative91.9%
distribute-rgt-out--93.8%
distribute-lft-out--95.0%
distribute-lft-out100.0%
Simplified100.0%
Taylor expanded in d1 around 0 85.3%
Taylor expanded in d4 around 0 66.2%
if 3.10000000000000004e-283 < d4 < 1.79999999999999997e-122Initial program 90.0%
associate--l+90.0%
+-commutative90.0%
distribute-rgt-out--90.0%
distribute-lft-out--90.0%
distribute-lft-out100.0%
Simplified100.0%
Taylor expanded in d3 around 0 82.0%
Taylor expanded in d4 around 0 82.0%
if 7.79999999999999937e29 < d4 Initial program 82.8%
associate--l+82.8%
+-commutative82.8%
distribute-rgt-out--87.5%
distribute-lft-out--90.6%
distribute-lft-out100.0%
Simplified100.0%
Taylor expanded in d1 around 0 87.6%
Taylor expanded in d3 around 0 68.3%
+-commutative68.3%
Simplified68.3%
Final simplification68.6%
(FPCore (d1 d2 d3 d4)
:precision binary64
(let* ((t_0 (* d1 (- d2 d3))))
(if (<= d4 4.8e-284)
t_0
(if (<= d4 1.85e-122)
(* d1 (- d2 d1))
(if (<= d4 3.3e+20) t_0 (* d1 (- d4 d1)))))))
double code(double d1, double d2, double d3, double d4) {
double t_0 = d1 * (d2 - d3);
double tmp;
if (d4 <= 4.8e-284) {
tmp = t_0;
} else if (d4 <= 1.85e-122) {
tmp = d1 * (d2 - d1);
} else if (d4 <= 3.3e+20) {
tmp = t_0;
} else {
tmp = d1 * (d4 - d1);
}
return tmp;
}
real(8) function code(d1, d2, d3, d4)
real(8), intent (in) :: d1
real(8), intent (in) :: d2
real(8), intent (in) :: d3
real(8), intent (in) :: d4
real(8) :: t_0
real(8) :: tmp
t_0 = d1 * (d2 - d3)
if (d4 <= 4.8d-284) then
tmp = t_0
else if (d4 <= 1.85d-122) then
tmp = d1 * (d2 - d1)
else if (d4 <= 3.3d+20) then
tmp = t_0
else
tmp = d1 * (d4 - d1)
end if
code = tmp
end function
public static double code(double d1, double d2, double d3, double d4) {
double t_0 = d1 * (d2 - d3);
double tmp;
if (d4 <= 4.8e-284) {
tmp = t_0;
} else if (d4 <= 1.85e-122) {
tmp = d1 * (d2 - d1);
} else if (d4 <= 3.3e+20) {
tmp = t_0;
} else {
tmp = d1 * (d4 - d1);
}
return tmp;
}
def code(d1, d2, d3, d4): t_0 = d1 * (d2 - d3) tmp = 0 if d4 <= 4.8e-284: tmp = t_0 elif d4 <= 1.85e-122: tmp = d1 * (d2 - d1) elif d4 <= 3.3e+20: tmp = t_0 else: tmp = d1 * (d4 - d1) return tmp
function code(d1, d2, d3, d4) t_0 = Float64(d1 * Float64(d2 - d3)) tmp = 0.0 if (d4 <= 4.8e-284) tmp = t_0; elseif (d4 <= 1.85e-122) tmp = Float64(d1 * Float64(d2 - d1)); elseif (d4 <= 3.3e+20) tmp = t_0; else tmp = Float64(d1 * Float64(d4 - d1)); end return tmp end
function tmp_2 = code(d1, d2, d3, d4) t_0 = d1 * (d2 - d3); tmp = 0.0; if (d4 <= 4.8e-284) tmp = t_0; elseif (d4 <= 1.85e-122) tmp = d1 * (d2 - d1); elseif (d4 <= 3.3e+20) tmp = t_0; else tmp = d1 * (d4 - d1); end tmp_2 = tmp; end
code[d1_, d2_, d3_, d4_] := Block[{t$95$0 = N[(d1 * N[(d2 - d3), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[d4, 4.8e-284], t$95$0, If[LessEqual[d4, 1.85e-122], N[(d1 * N[(d2 - d1), $MachinePrecision]), $MachinePrecision], If[LessEqual[d4, 3.3e+20], t$95$0, N[(d1 * N[(d4 - d1), $MachinePrecision]), $MachinePrecision]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := d1 \cdot \left(d2 - d3\right)\\
\mathbf{if}\;d4 \leq 4.8 \cdot 10^{-284}:\\
\;\;\;\;t_0\\
\mathbf{elif}\;d4 \leq 1.85 \cdot 10^{-122}:\\
\;\;\;\;d1 \cdot \left(d2 - d1\right)\\
\mathbf{elif}\;d4 \leq 3.3 \cdot 10^{+20}:\\
\;\;\;\;t_0\\
\mathbf{else}:\\
\;\;\;\;d1 \cdot \left(d4 - d1\right)\\
\end{array}
\end{array}
if d4 < 4.80000000000000006e-284 or 1.8499999999999999e-122 < d4 < 3.3e20Initial program 91.8%
associate--l+91.8%
+-commutative91.8%
distribute-rgt-out--93.7%
distribute-lft-out--94.9%
distribute-lft-out100.0%
Simplified100.0%
Taylor expanded in d1 around 0 85.6%
Taylor expanded in d4 around 0 66.4%
if 4.80000000000000006e-284 < d4 < 1.8499999999999999e-122Initial program 90.0%
associate--l+90.0%
+-commutative90.0%
distribute-rgt-out--90.0%
distribute-lft-out--90.0%
distribute-lft-out100.0%
Simplified100.0%
Taylor expanded in d3 around 0 82.0%
Taylor expanded in d4 around 0 82.0%
if 3.3e20 < d4 Initial program 83.3%
associate--l+83.3%
+-commutative83.3%
distribute-rgt-out--87.8%
distribute-lft-out--90.9%
distribute-lft-out100.0%
Simplified100.0%
Taylor expanded in d3 around 0 76.7%
Taylor expanded in d2 around 0 68.4%
Final simplification68.7%
(FPCore (d1 d2 d3 d4) :precision binary64 (if (or (<= d1 -1.26e+33) (not (<= d1 8.6e+48))) (* d1 (- (+ d4 d2) d1)) (* d1 (- (+ d4 d2) d3))))
double code(double d1, double d2, double d3, double d4) {
double tmp;
if ((d1 <= -1.26e+33) || !(d1 <= 8.6e+48)) {
tmp = d1 * ((d4 + d2) - 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 ((d1 <= (-1.26d+33)) .or. (.not. (d1 <= 8.6d+48))) then
tmp = d1 * ((d4 + d2) - 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 ((d1 <= -1.26e+33) || !(d1 <= 8.6e+48)) {
tmp = d1 * ((d4 + d2) - d1);
} else {
tmp = d1 * ((d4 + d2) - d3);
}
return tmp;
}
def code(d1, d2, d3, d4): tmp = 0 if (d1 <= -1.26e+33) or not (d1 <= 8.6e+48): tmp = d1 * ((d4 + d2) - d1) else: tmp = d1 * ((d4 + d2) - d3) return tmp
function code(d1, d2, d3, d4) tmp = 0.0 if ((d1 <= -1.26e+33) || !(d1 <= 8.6e+48)) tmp = Float64(d1 * Float64(Float64(d4 + d2) - 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 ((d1 <= -1.26e+33) || ~((d1 <= 8.6e+48))) tmp = d1 * ((d4 + d2) - d1); else tmp = d1 * ((d4 + d2) - d3); end tmp_2 = tmp; end
code[d1_, d2_, d3_, d4_] := If[Or[LessEqual[d1, -1.26e+33], N[Not[LessEqual[d1, 8.6e+48]], $MachinePrecision]], N[(d1 * N[(N[(d4 + d2), $MachinePrecision] - d1), $MachinePrecision]), $MachinePrecision], N[(d1 * N[(N[(d4 + d2), $MachinePrecision] - d3), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;d1 \leq -1.26 \cdot 10^{+33} \lor \neg \left(d1 \leq 8.6 \cdot 10^{+48}\right):\\
\;\;\;\;d1 \cdot \left(\left(d4 + d2\right) - d1\right)\\
\mathbf{else}:\\
\;\;\;\;d1 \cdot \left(\left(d4 + d2\right) - d3\right)\\
\end{array}
\end{array}
if d1 < -1.26e33 or 8.59999999999999957e48 < d1 Initial program 70.9%
associate--l+70.9%
+-commutative70.9%
distribute-rgt-out--77.4%
distribute-lft-out--81.7%
distribute-lft-out100.0%
Simplified100.0%
Taylor expanded in d3 around 0 95.0%
if -1.26e33 < d1 < 8.59999999999999957e48Initial program 100.0%
associate--l+100.0%
+-commutative100.0%
distribute-rgt-out--100.0%
distribute-lft-out--100.0%
distribute-lft-out100.0%
Simplified100.0%
Taylor expanded in d1 around 0 96.5%
Final simplification95.9%
(FPCore (d1 d2 d3 d4) :precision binary64 (if (<= d1 -6.5e+33) (* d1 (- (+ d4 d2) d1)) (if (<= d1 3.1e+86) (* d1 (- (+ d4 d2) d3)) (* d1 (- (- d2 d3) d1)))))
double code(double d1, double d2, double d3, double d4) {
double tmp;
if (d1 <= -6.5e+33) {
tmp = d1 * ((d4 + d2) - d1);
} else if (d1 <= 3.1e+86) {
tmp = d1 * ((d4 + d2) - d3);
} else {
tmp = d1 * ((d2 - 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) :: tmp
if (d1 <= (-6.5d+33)) then
tmp = d1 * ((d4 + d2) - d1)
else if (d1 <= 3.1d+86) then
tmp = d1 * ((d4 + d2) - d3)
else
tmp = d1 * ((d2 - d3) - d1)
end if
code = tmp
end function
public static double code(double d1, double d2, double d3, double d4) {
double tmp;
if (d1 <= -6.5e+33) {
tmp = d1 * ((d4 + d2) - d1);
} else if (d1 <= 3.1e+86) {
tmp = d1 * ((d4 + d2) - d3);
} else {
tmp = d1 * ((d2 - d3) - d1);
}
return tmp;
}
def code(d1, d2, d3, d4): tmp = 0 if d1 <= -6.5e+33: tmp = d1 * ((d4 + d2) - d1) elif d1 <= 3.1e+86: tmp = d1 * ((d4 + d2) - d3) else: tmp = d1 * ((d2 - d3) - d1) return tmp
function code(d1, d2, d3, d4) tmp = 0.0 if (d1 <= -6.5e+33) tmp = Float64(d1 * Float64(Float64(d4 + d2) - d1)); elseif (d1 <= 3.1e+86) tmp = Float64(d1 * Float64(Float64(d4 + d2) - d3)); else tmp = Float64(d1 * Float64(Float64(d2 - d3) - d1)); end return tmp end
function tmp_2 = code(d1, d2, d3, d4) tmp = 0.0; if (d1 <= -6.5e+33) tmp = d1 * ((d4 + d2) - d1); elseif (d1 <= 3.1e+86) tmp = d1 * ((d4 + d2) - d3); else tmp = d1 * ((d2 - d3) - d1); end tmp_2 = tmp; end
code[d1_, d2_, d3_, d4_] := If[LessEqual[d1, -6.5e+33], N[(d1 * N[(N[(d4 + d2), $MachinePrecision] - d1), $MachinePrecision]), $MachinePrecision], If[LessEqual[d1, 3.1e+86], N[(d1 * N[(N[(d4 + d2), $MachinePrecision] - d3), $MachinePrecision]), $MachinePrecision], N[(d1 * N[(N[(d2 - d3), $MachinePrecision] - d1), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;d1 \leq -6.5 \cdot 10^{+33}:\\
\;\;\;\;d1 \cdot \left(\left(d4 + d2\right) - d1\right)\\
\mathbf{elif}\;d1 \leq 3.1 \cdot 10^{+86}:\\
\;\;\;\;d1 \cdot \left(\left(d4 + d2\right) - d3\right)\\
\mathbf{else}:\\
\;\;\;\;d1 \cdot \left(\left(d2 - d3\right) - d1\right)\\
\end{array}
\end{array}
if d1 < -6.49999999999999993e33Initial program 63.5%
associate--l+63.5%
+-commutative63.5%
distribute-rgt-out--70.3%
distribute-lft-out--74.9%
distribute-lft-out100.0%
Simplified100.0%
Taylor expanded in d3 around 0 95.4%
if -6.49999999999999993e33 < d1 < 3.1000000000000002e86Initial program 99.4%
associate--l+99.4%
+-commutative99.4%
distribute-rgt-out--99.4%
distribute-lft-out--99.4%
distribute-lft-out100.0%
Simplified100.0%
Taylor expanded in d1 around 0 96.7%
if 3.1000000000000002e86 < d1 Initial program 74.3%
associate--l+74.3%
+-commutative74.3%
distribute-rgt-out--82.0%
distribute-lft-out--87.1%
distribute-lft-out100.0%
Simplified100.0%
Taylor expanded in d4 around 0 95.2%
+-commutative95.2%
associate--r+95.2%
Simplified95.2%
Final simplification96.3%
(FPCore (d1 d2 d3 d4) :precision binary64 (if (or (<= d4 3.6e+20) (and (not (<= d4 6.8e+65)) (<= d4 1.05e+75))) (* d1 d2) (* d1 d4)))
double code(double d1, double d2, double d3, double d4) {
double tmp;
if ((d4 <= 3.6e+20) || (!(d4 <= 6.8e+65) && (d4 <= 1.05e+75))) {
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 <= 3.6d+20) .or. (.not. (d4 <= 6.8d+65)) .and. (d4 <= 1.05d+75)) 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 <= 3.6e+20) || (!(d4 <= 6.8e+65) && (d4 <= 1.05e+75))) {
tmp = d1 * d2;
} else {
tmp = d1 * d4;
}
return tmp;
}
def code(d1, d2, d3, d4): tmp = 0 if (d4 <= 3.6e+20) or (not (d4 <= 6.8e+65) and (d4 <= 1.05e+75)): tmp = d1 * d2 else: tmp = d1 * d4 return tmp
function code(d1, d2, d3, d4) tmp = 0.0 if ((d4 <= 3.6e+20) || (!(d4 <= 6.8e+65) && (d4 <= 1.05e+75))) 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 <= 3.6e+20) || (~((d4 <= 6.8e+65)) && (d4 <= 1.05e+75))) tmp = d1 * d2; else tmp = d1 * d4; end tmp_2 = tmp; end
code[d1_, d2_, d3_, d4_] := If[Or[LessEqual[d4, 3.6e+20], And[N[Not[LessEqual[d4, 6.8e+65]], $MachinePrecision], LessEqual[d4, 1.05e+75]]], N[(d1 * d2), $MachinePrecision], N[(d1 * d4), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;d4 \leq 3.6 \cdot 10^{+20} \lor \neg \left(d4 \leq 6.8 \cdot 10^{+65}\right) \land d4 \leq 1.05 \cdot 10^{+75}:\\
\;\;\;\;d1 \cdot d2\\
\mathbf{else}:\\
\;\;\;\;d1 \cdot d4\\
\end{array}
\end{array}
if d4 < 3.6e20 or 6.7999999999999999e65 < d4 < 1.04999999999999999e75Initial program 91.7%
associate--l+91.7%
+-commutative91.7%
distribute-rgt-out--93.3%
distribute-lft-out--94.3%
distribute-lft-out100.0%
Simplified100.0%
Taylor expanded in d2 around inf 43.1%
if 3.6e20 < d4 < 6.7999999999999999e65 or 1.04999999999999999e75 < d4 Initial program 81.9%
associate--l+81.9%
+-commutative81.9%
distribute-rgt-out--86.8%
distribute-lft-out--90.1%
distribute-lft-out99.9%
Simplified99.9%
Taylor expanded in d4 around inf 61.0%
Final simplification47.4%
(FPCore (d1 d2 d3 d4) :precision binary64 (if (<= d4 2.6e+30) (* d1 (- d2 d1)) (* d1 (+ d4 d2))))
double code(double d1, double d2, double d3, double d4) {
double tmp;
if (d4 <= 2.6e+30) {
tmp = d1 * (d2 - 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 (d4 <= 2.6d+30) then
tmp = d1 * (d2 - 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 (d4 <= 2.6e+30) {
tmp = d1 * (d2 - d1);
} else {
tmp = d1 * (d4 + d2);
}
return tmp;
}
def code(d1, d2, d3, d4): tmp = 0 if d4 <= 2.6e+30: tmp = d1 * (d2 - d1) else: tmp = d1 * (d4 + d2) return tmp
function code(d1, d2, d3, d4) tmp = 0.0 if (d4 <= 2.6e+30) tmp = Float64(d1 * Float64(d2 - d1)); else tmp = Float64(d1 * Float64(d4 + d2)); end return tmp end
function tmp_2 = code(d1, d2, d3, d4) tmp = 0.0; if (d4 <= 2.6e+30) tmp = d1 * (d2 - d1); else tmp = d1 * (d4 + d2); end tmp_2 = tmp; end
code[d1_, d2_, d3_, d4_] := If[LessEqual[d4, 2.6e+30], N[(d1 * N[(d2 - d1), $MachinePrecision]), $MachinePrecision], N[(d1 * N[(d4 + d2), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;d4 \leq 2.6 \cdot 10^{+30}:\\
\;\;\;\;d1 \cdot \left(d2 - d1\right)\\
\mathbf{else}:\\
\;\;\;\;d1 \cdot \left(d4 + d2\right)\\
\end{array}
\end{array}
if d4 < 2.59999999999999988e30Initial program 91.6%
associate--l+91.6%
+-commutative91.6%
distribute-rgt-out--93.2%
distribute-lft-out--94.2%
distribute-lft-out100.0%
Simplified100.0%
Taylor expanded in d3 around 0 77.3%
Taylor expanded in d4 around 0 62.9%
if 2.59999999999999988e30 < d4 Initial program 82.8%
associate--l+82.8%
+-commutative82.8%
distribute-rgt-out--87.5%
distribute-lft-out--90.6%
distribute-lft-out100.0%
Simplified100.0%
Taylor expanded in d1 around 0 87.6%
Taylor expanded in d3 around 0 68.3%
+-commutative68.3%
Simplified68.3%
Final simplification64.2%
(FPCore (d1 d2 d3 d4) :precision binary64 (* d1 d2))
double code(double d1, double d2, double d3, double d4) {
return d1 * d2;
}
real(8) function code(d1, d2, d3, d4)
real(8), intent (in) :: d1
real(8), intent (in) :: d2
real(8), intent (in) :: d3
real(8), intent (in) :: d4
code = d1 * d2
end function
public static double code(double d1, double d2, double d3, double d4) {
return d1 * d2;
}
def code(d1, d2, d3, d4): return d1 * d2
function code(d1, d2, d3, d4) return Float64(d1 * d2) end
function tmp = code(d1, d2, d3, d4) tmp = d1 * d2; end
code[d1_, d2_, d3_, d4_] := N[(d1 * d2), $MachinePrecision]
\begin{array}{l}
\\
d1 \cdot d2
\end{array}
Initial program 89.4%
associate--l+89.4%
+-commutative89.4%
distribute-rgt-out--91.7%
distribute-lft-out--93.3%
distribute-lft-out100.0%
Simplified100.0%
Taylor expanded in d2 around inf 35.6%
Final simplification35.6%
(FPCore (d1 d2 d3 d4) :precision binary64 (* d1 (- (+ (- d2 d3) d4) d1)))
double code(double d1, double d2, double d3, double d4) {
return d1 * (((d2 - d3) + d4) - d1);
}
real(8) function code(d1, d2, d3, d4)
real(8), intent (in) :: d1
real(8), intent (in) :: d2
real(8), intent (in) :: d3
real(8), intent (in) :: d4
code = d1 * (((d2 - d3) + d4) - d1)
end function
public static double code(double d1, double d2, double d3, double d4) {
return d1 * (((d2 - d3) + d4) - d1);
}
def code(d1, d2, d3, d4): return d1 * (((d2 - d3) + d4) - d1)
function code(d1, d2, d3, d4) return Float64(d1 * Float64(Float64(Float64(d2 - d3) + d4) - d1)) end
function tmp = code(d1, d2, d3, d4) tmp = d1 * (((d2 - d3) + d4) - d1); end
code[d1_, d2_, d3_, d4_] := N[(d1 * N[(N[(N[(d2 - d3), $MachinePrecision] + d4), $MachinePrecision] - d1), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
d1 \cdot \left(\left(\left(d2 - d3\right) + d4\right) - d1\right)
\end{array}
herbie shell --seed 2024013
(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)))