
(FPCore (d1 d2 d3 d4) :precision binary64 (- (+ (- (* d1 d2) (* d1 d3)) (* d4 d1)) (* d1 d1)))
double code(double d1, double d2, double d3, double d4) {
return (((d1 * d2) - (d1 * d3)) + (d4 * d1)) - (d1 * d1);
}
real(8) function code(d1, d2, d3, d4)
real(8), intent (in) :: d1
real(8), intent (in) :: d2
real(8), intent (in) :: d3
real(8), intent (in) :: d4
code = (((d1 * d2) - (d1 * d3)) + (d4 * d1)) - (d1 * d1)
end function
public static double code(double d1, double d2, double d3, double d4) {
return (((d1 * d2) - (d1 * d3)) + (d4 * d1)) - (d1 * d1);
}
def code(d1, d2, d3, d4): return (((d1 * d2) - (d1 * d3)) + (d4 * d1)) - (d1 * d1)
function code(d1, d2, d3, d4) return Float64(Float64(Float64(Float64(d1 * d2) - Float64(d1 * d3)) + Float64(d4 * d1)) - Float64(d1 * d1)) end
function tmp = code(d1, d2, d3, d4) tmp = (((d1 * d2) - (d1 * d3)) + (d4 * d1)) - (d1 * d1); end
code[d1_, d2_, d3_, d4_] := N[(N[(N[(N[(d1 * d2), $MachinePrecision] - N[(d1 * d3), $MachinePrecision]), $MachinePrecision] + N[(d4 * d1), $MachinePrecision]), $MachinePrecision] - N[(d1 * d1), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
\left(\left(d1 \cdot d2 - d1 \cdot d3\right) + d4 \cdot d1\right) - d1 \cdot d1
\end{array}
Sampling outcomes in binary64 precision:
Herbie found 12 alternatives:
| Alternative | Accuracy | Speedup |
|---|
(FPCore (d1 d2 d3 d4) :precision binary64 (- (+ (- (* d1 d2) (* d1 d3)) (* d4 d1)) (* d1 d1)))
double code(double d1, double d2, double d3, double d4) {
return (((d1 * d2) - (d1 * d3)) + (d4 * d1)) - (d1 * d1);
}
real(8) function code(d1, d2, d3, d4)
real(8), intent (in) :: d1
real(8), intent (in) :: d2
real(8), intent (in) :: d3
real(8), intent (in) :: d4
code = (((d1 * d2) - (d1 * d3)) + (d4 * d1)) - (d1 * d1)
end function
public static double code(double d1, double d2, double d3, double d4) {
return (((d1 * d2) - (d1 * d3)) + (d4 * d1)) - (d1 * d1);
}
def code(d1, d2, d3, d4): return (((d1 * d2) - (d1 * d3)) + (d4 * d1)) - (d1 * d1)
function code(d1, d2, d3, d4) return Float64(Float64(Float64(Float64(d1 * d2) - Float64(d1 * d3)) + Float64(d4 * d1)) - Float64(d1 * d1)) end
function tmp = code(d1, d2, d3, d4) tmp = (((d1 * d2) - (d1 * d3)) + (d4 * d1)) - (d1 * d1); end
code[d1_, d2_, d3_, d4_] := N[(N[(N[(N[(d1 * d2), $MachinePrecision] - N[(d1 * d3), $MachinePrecision]), $MachinePrecision] + N[(d4 * d1), $MachinePrecision]), $MachinePrecision] - N[(d1 * d1), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
\left(\left(d1 \cdot d2 - d1 \cdot d3\right) + d4 \cdot d1\right) - d1 \cdot d1
\end{array}
(FPCore (d1 d2 d3 d4) :precision binary64 (* d1 (+ (- d2 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(d2 - d3) + Float64(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[(d2 - d3), $MachinePrecision] + N[(d4 - d1), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
d1 \cdot \left(\left(d2 - d3\right) + \left(d4 - d1\right)\right)
\end{array}
Initial program 89.4%
associate--l+89.4%
distribute-lft-out--90.2%
distribute-rgt-out--92.2%
distribute-lft-out100.0%
Simplified100.0%
Final simplification100.0%
(FPCore (d1 d2 d3 d4)
:precision binary64
(let* ((t_0 (* d1 (- d2 d1))) (t_1 (* d1 (- d2 d3))))
(if (<= d4 -1.5e-265)
t_0
(if (<= d4 5.8e-289)
(* d1 (- d3))
(if (<= d4 7.8e-246)
(- (* d1 d1))
(if (<= d4 2.9e-19)
t_1
(if (<= d4 6.7e+27)
t_0
(if (<= d4 1.4e+98) t_1 (* d1 (+ d2 d4))))))))))
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 <= -1.5e-265) {
tmp = t_0;
} else if (d4 <= 5.8e-289) {
tmp = d1 * -d3;
} else if (d4 <= 7.8e-246) {
tmp = -(d1 * d1);
} else if (d4 <= 2.9e-19) {
tmp = t_1;
} else if (d4 <= 6.7e+27) {
tmp = t_0;
} else if (d4 <= 1.4e+98) {
tmp = t_1;
} else {
tmp = d1 * (d2 + d4);
}
return tmp;
}
real(8) function code(d1, d2, d3, d4)
real(8), intent (in) :: d1
real(8), intent (in) :: d2
real(8), intent (in) :: d3
real(8), intent (in) :: d4
real(8) :: t_0
real(8) :: t_1
real(8) :: tmp
t_0 = d1 * (d2 - d1)
t_1 = d1 * (d2 - d3)
if (d4 <= (-1.5d-265)) then
tmp = t_0
else if (d4 <= 5.8d-289) then
tmp = d1 * -d3
else if (d4 <= 7.8d-246) then
tmp = -(d1 * d1)
else if (d4 <= 2.9d-19) then
tmp = t_1
else if (d4 <= 6.7d+27) then
tmp = t_0
else if (d4 <= 1.4d+98) then
tmp = t_1
else
tmp = d1 * (d2 + d4)
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 <= -1.5e-265) {
tmp = t_0;
} else if (d4 <= 5.8e-289) {
tmp = d1 * -d3;
} else if (d4 <= 7.8e-246) {
tmp = -(d1 * d1);
} else if (d4 <= 2.9e-19) {
tmp = t_1;
} else if (d4 <= 6.7e+27) {
tmp = t_0;
} else if (d4 <= 1.4e+98) {
tmp = t_1;
} else {
tmp = d1 * (d2 + d4);
}
return tmp;
}
def code(d1, d2, d3, d4): t_0 = d1 * (d2 - d1) t_1 = d1 * (d2 - d3) tmp = 0 if d4 <= -1.5e-265: tmp = t_0 elif d4 <= 5.8e-289: tmp = d1 * -d3 elif d4 <= 7.8e-246: tmp = -(d1 * d1) elif d4 <= 2.9e-19: tmp = t_1 elif d4 <= 6.7e+27: tmp = t_0 elif d4 <= 1.4e+98: tmp = t_1 else: tmp = d1 * (d2 + d4) 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 <= -1.5e-265) tmp = t_0; elseif (d4 <= 5.8e-289) tmp = Float64(d1 * Float64(-d3)); elseif (d4 <= 7.8e-246) tmp = Float64(-Float64(d1 * d1)); elseif (d4 <= 2.9e-19) tmp = t_1; elseif (d4 <= 6.7e+27) tmp = t_0; elseif (d4 <= 1.4e+98) tmp = t_1; else tmp = Float64(d1 * Float64(d2 + d4)); 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 <= -1.5e-265) tmp = t_0; elseif (d4 <= 5.8e-289) tmp = d1 * -d3; elseif (d4 <= 7.8e-246) tmp = -(d1 * d1); elseif (d4 <= 2.9e-19) tmp = t_1; elseif (d4 <= 6.7e+27) tmp = t_0; elseif (d4 <= 1.4e+98) tmp = t_1; else tmp = d1 * (d2 + d4); 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, -1.5e-265], t$95$0, If[LessEqual[d4, 5.8e-289], N[(d1 * (-d3)), $MachinePrecision], If[LessEqual[d4, 7.8e-246], (-N[(d1 * d1), $MachinePrecision]), If[LessEqual[d4, 2.9e-19], t$95$1, If[LessEqual[d4, 6.7e+27], t$95$0, If[LessEqual[d4, 1.4e+98], t$95$1, N[(d1 * N[(d2 + d4), $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 -1.5 \cdot 10^{-265}:\\
\;\;\;\;t\_0\\
\mathbf{elif}\;d4 \leq 5.8 \cdot 10^{-289}:\\
\;\;\;\;d1 \cdot \left(-d3\right)\\
\mathbf{elif}\;d4 \leq 7.8 \cdot 10^{-246}:\\
\;\;\;\;-d1 \cdot d1\\
\mathbf{elif}\;d4 \leq 2.9 \cdot 10^{-19}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;d4 \leq 6.7 \cdot 10^{+27}:\\
\;\;\;\;t\_0\\
\mathbf{elif}\;d4 \leq 1.4 \cdot 10^{+98}:\\
\;\;\;\;t\_1\\
\mathbf{else}:\\
\;\;\;\;d1 \cdot \left(d2 + d4\right)\\
\end{array}
\end{array}
if d4 < -1.4999999999999999e-265 or 2.9e-19 < d4 < 6.69999999999999979e27Initial program 90.5%
associate--l+90.5%
distribute-lft-out--91.2%
distribute-rgt-out--92.7%
distribute-lft-out100.0%
Simplified100.0%
Taylor expanded in d3 around 0 78.1%
Taylor expanded in d4 around 0 60.8%
if -1.4999999999999999e-265 < d4 < 5.80000000000000012e-289Initial program 100.0%
associate--l+100.0%
distribute-lft-out--100.0%
distribute-rgt-out--100.0%
distribute-lft-out100.0%
Simplified100.0%
Taylor expanded in d3 around inf 38.7%
mul-1-neg38.7%
distribute-rgt-neg-out38.7%
Simplified38.7%
if 5.80000000000000012e-289 < d4 < 7.79999999999999958e-246Initial program 87.5%
associate--l+87.5%
distribute-lft-out--87.5%
distribute-rgt-out--87.5%
distribute-lft-out100.0%
Simplified100.0%
Taylor expanded in d1 around inf 51.5%
neg-mul-151.5%
Simplified51.5%
if 7.79999999999999958e-246 < d4 < 2.9e-19 or 6.69999999999999979e27 < d4 < 1.4e98Initial program 96.3%
associate--l+96.3%
distribute-lft-out--96.3%
distribute-rgt-out--96.3%
distribute-lft-out100.0%
Simplified100.0%
Taylor expanded in d1 around 0 91.3%
Taylor expanded in d4 around 0 83.9%
if 1.4e98 < d4 Initial program 77.5%
associate--l+77.5%
distribute-lft-out--79.5%
distribute-rgt-out--85.7%
distribute-lft-out100.0%
Simplified100.0%
Taylor expanded in d3 around 0 97.5%
Taylor expanded in d1 around 0 91.4%
Final simplification70.5%
(FPCore (d1 d2 d3 d4)
:precision binary64
(let* ((t_0 (* d1 (- d2 d3))))
(if (<= d4 -1.65e-265)
(* d1 (- d2 d1))
(if (<= d4 6.5e-290)
(* d1 (- d3))
(if (<= d4 7e-246)
(- (* d1 d1))
(if (<= d4 5.6e-36)
t_0
(if (<= d4 7.3e+25)
(* d1 (- d4 d1))
(if (<= d4 1.95e+98) t_0 (* d1 (+ d2 d4))))))))))
double code(double d1, double d2, double d3, double d4) {
double t_0 = d1 * (d2 - d3);
double tmp;
if (d4 <= -1.65e-265) {
tmp = d1 * (d2 - d1);
} else if (d4 <= 6.5e-290) {
tmp = d1 * -d3;
} else if (d4 <= 7e-246) {
tmp = -(d1 * d1);
} else if (d4 <= 5.6e-36) {
tmp = t_0;
} else if (d4 <= 7.3e+25) {
tmp = d1 * (d4 - d1);
} else if (d4 <= 1.95e+98) {
tmp = t_0;
} else {
tmp = d1 * (d2 + d4);
}
return tmp;
}
real(8) function code(d1, d2, d3, d4)
real(8), intent (in) :: d1
real(8), intent (in) :: d2
real(8), intent (in) :: d3
real(8), intent (in) :: d4
real(8) :: t_0
real(8) :: tmp
t_0 = d1 * (d2 - d3)
if (d4 <= (-1.65d-265)) then
tmp = d1 * (d2 - d1)
else if (d4 <= 6.5d-290) then
tmp = d1 * -d3
else if (d4 <= 7d-246) then
tmp = -(d1 * d1)
else if (d4 <= 5.6d-36) then
tmp = t_0
else if (d4 <= 7.3d+25) then
tmp = d1 * (d4 - d1)
else if (d4 <= 1.95d+98) then
tmp = t_0
else
tmp = d1 * (d2 + d4)
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.65e-265) {
tmp = d1 * (d2 - d1);
} else if (d4 <= 6.5e-290) {
tmp = d1 * -d3;
} else if (d4 <= 7e-246) {
tmp = -(d1 * d1);
} else if (d4 <= 5.6e-36) {
tmp = t_0;
} else if (d4 <= 7.3e+25) {
tmp = d1 * (d4 - d1);
} else if (d4 <= 1.95e+98) {
tmp = t_0;
} else {
tmp = d1 * (d2 + d4);
}
return tmp;
}
def code(d1, d2, d3, d4): t_0 = d1 * (d2 - d3) tmp = 0 if d4 <= -1.65e-265: tmp = d1 * (d2 - d1) elif d4 <= 6.5e-290: tmp = d1 * -d3 elif d4 <= 7e-246: tmp = -(d1 * d1) elif d4 <= 5.6e-36: tmp = t_0 elif d4 <= 7.3e+25: tmp = d1 * (d4 - d1) elif d4 <= 1.95e+98: tmp = t_0 else: tmp = d1 * (d2 + d4) return tmp
function code(d1, d2, d3, d4) t_0 = Float64(d1 * Float64(d2 - d3)) tmp = 0.0 if (d4 <= -1.65e-265) tmp = Float64(d1 * Float64(d2 - d1)); elseif (d4 <= 6.5e-290) tmp = Float64(d1 * Float64(-d3)); elseif (d4 <= 7e-246) tmp = Float64(-Float64(d1 * d1)); elseif (d4 <= 5.6e-36) tmp = t_0; elseif (d4 <= 7.3e+25) tmp = Float64(d1 * Float64(d4 - d1)); elseif (d4 <= 1.95e+98) tmp = t_0; else tmp = Float64(d1 * Float64(d2 + d4)); end return tmp end
function tmp_2 = code(d1, d2, d3, d4) t_0 = d1 * (d2 - d3); tmp = 0.0; if (d4 <= -1.65e-265) tmp = d1 * (d2 - d1); elseif (d4 <= 6.5e-290) tmp = d1 * -d3; elseif (d4 <= 7e-246) tmp = -(d1 * d1); elseif (d4 <= 5.6e-36) tmp = t_0; elseif (d4 <= 7.3e+25) tmp = d1 * (d4 - d1); elseif (d4 <= 1.95e+98) tmp = t_0; else tmp = d1 * (d2 + d4); 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.65e-265], N[(d1 * N[(d2 - d1), $MachinePrecision]), $MachinePrecision], If[LessEqual[d4, 6.5e-290], N[(d1 * (-d3)), $MachinePrecision], If[LessEqual[d4, 7e-246], (-N[(d1 * d1), $MachinePrecision]), If[LessEqual[d4, 5.6e-36], t$95$0, If[LessEqual[d4, 7.3e+25], N[(d1 * N[(d4 - d1), $MachinePrecision]), $MachinePrecision], If[LessEqual[d4, 1.95e+98], t$95$0, N[(d1 * N[(d2 + d4), $MachinePrecision]), $MachinePrecision]]]]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := d1 \cdot \left(d2 - d3\right)\\
\mathbf{if}\;d4 \leq -1.65 \cdot 10^{-265}:\\
\;\;\;\;d1 \cdot \left(d2 - d1\right)\\
\mathbf{elif}\;d4 \leq 6.5 \cdot 10^{-290}:\\
\;\;\;\;d1 \cdot \left(-d3\right)\\
\mathbf{elif}\;d4 \leq 7 \cdot 10^{-246}:\\
\;\;\;\;-d1 \cdot d1\\
\mathbf{elif}\;d4 \leq 5.6 \cdot 10^{-36}:\\
\;\;\;\;t\_0\\
\mathbf{elif}\;d4 \leq 7.3 \cdot 10^{+25}:\\
\;\;\;\;d1 \cdot \left(d4 - d1\right)\\
\mathbf{elif}\;d4 \leq 1.95 \cdot 10^{+98}:\\
\;\;\;\;t\_0\\
\mathbf{else}:\\
\;\;\;\;d1 \cdot \left(d2 + d4\right)\\
\end{array}
\end{array}
if d4 < -1.65000000000000001e-265Initial program 91.3%
associate--l+91.3%
distribute-lft-out--91.3%
distribute-rgt-out--92.9%
distribute-lft-out100.0%
Simplified100.0%
Taylor expanded in d3 around 0 77.1%
Taylor expanded in d4 around 0 59.3%
if -1.65000000000000001e-265 < d4 < 6.4999999999999997e-290Initial program 100.0%
associate--l+100.0%
distribute-lft-out--100.0%
distribute-rgt-out--100.0%
distribute-lft-out100.0%
Simplified100.0%
Taylor expanded in d3 around inf 38.7%
mul-1-neg38.7%
distribute-rgt-neg-out38.7%
Simplified38.7%
if 6.4999999999999997e-290 < d4 < 7.0000000000000003e-246Initial program 87.5%
associate--l+87.5%
distribute-lft-out--87.5%
distribute-rgt-out--87.5%
distribute-lft-out100.0%
Simplified100.0%
Taylor expanded in d1 around inf 51.5%
neg-mul-151.5%
Simplified51.5%
if 7.0000000000000003e-246 < d4 < 5.6000000000000002e-36 or 7.29999999999999961e25 < d4 < 1.95e98Initial program 96.1%
associate--l+96.1%
distribute-lft-out--96.2%
distribute-rgt-out--96.2%
distribute-lft-out100.0%
Simplified100.0%
Taylor expanded in d1 around 0 92.8%
Taylor expanded in d4 around 0 85.1%
if 5.6000000000000002e-36 < d4 < 7.29999999999999961e25Initial program 83.3%
associate--l+83.3%
distribute-lft-out--91.7%
distribute-rgt-out--91.7%
distribute-lft-out100.0%
Simplified100.0%
Taylor expanded in d3 around 0 91.7%
Taylor expanded in d2 around 0 75.4%
if 1.95e98 < d4 Initial program 77.5%
associate--l+77.5%
distribute-lft-out--79.5%
distribute-rgt-out--85.7%
distribute-lft-out100.0%
Simplified100.0%
Taylor expanded in d3 around 0 97.5%
Taylor expanded in d1 around 0 91.4%
Final simplification70.5%
(FPCore (d1 d2 d3 d4)
:precision binary64
(if (<= d4 -1.25e-264)
(* d1 (- d2 d1))
(if (<= d4 2e-282)
(* d1 (- d3))
(if (<= d4 7e-246)
(- (* d1 d1))
(if (<= d4 6.2e-36)
(* d1 (- d2 d3))
(if (<= d4 8.5e+24) (* d1 (- d4 d1)) (* d1 (- d4 d3))))))))
double code(double d1, double d2, double d3, double d4) {
double tmp;
if (d4 <= -1.25e-264) {
tmp = d1 * (d2 - d1);
} else if (d4 <= 2e-282) {
tmp = d1 * -d3;
} else if (d4 <= 7e-246) {
tmp = -(d1 * d1);
} else if (d4 <= 6.2e-36) {
tmp = d1 * (d2 - d3);
} else if (d4 <= 8.5e+24) {
tmp = d1 * (d4 - d1);
} else {
tmp = d1 * (d4 - d3);
}
return tmp;
}
real(8) function code(d1, d2, d3, d4)
real(8), intent (in) :: d1
real(8), intent (in) :: d2
real(8), intent (in) :: d3
real(8), intent (in) :: d4
real(8) :: tmp
if (d4 <= (-1.25d-264)) then
tmp = d1 * (d2 - d1)
else if (d4 <= 2d-282) then
tmp = d1 * -d3
else if (d4 <= 7d-246) then
tmp = -(d1 * d1)
else if (d4 <= 6.2d-36) then
tmp = d1 * (d2 - d3)
else if (d4 <= 8.5d+24) then
tmp = d1 * (d4 - d1)
else
tmp = d1 * (d4 - d3)
end if
code = tmp
end function
public static double code(double d1, double d2, double d3, double d4) {
double tmp;
if (d4 <= -1.25e-264) {
tmp = d1 * (d2 - d1);
} else if (d4 <= 2e-282) {
tmp = d1 * -d3;
} else if (d4 <= 7e-246) {
tmp = -(d1 * d1);
} else if (d4 <= 6.2e-36) {
tmp = d1 * (d2 - d3);
} else if (d4 <= 8.5e+24) {
tmp = d1 * (d4 - d1);
} else {
tmp = d1 * (d4 - d3);
}
return tmp;
}
def code(d1, d2, d3, d4): tmp = 0 if d4 <= -1.25e-264: tmp = d1 * (d2 - d1) elif d4 <= 2e-282: tmp = d1 * -d3 elif d4 <= 7e-246: tmp = -(d1 * d1) elif d4 <= 6.2e-36: tmp = d1 * (d2 - d3) elif d4 <= 8.5e+24: tmp = d1 * (d4 - d1) else: tmp = d1 * (d4 - d3) return tmp
function code(d1, d2, d3, d4) tmp = 0.0 if (d4 <= -1.25e-264) tmp = Float64(d1 * Float64(d2 - d1)); elseif (d4 <= 2e-282) tmp = Float64(d1 * Float64(-d3)); elseif (d4 <= 7e-246) tmp = Float64(-Float64(d1 * d1)); elseif (d4 <= 6.2e-36) tmp = Float64(d1 * Float64(d2 - d3)); elseif (d4 <= 8.5e+24) tmp = Float64(d1 * Float64(d4 - d1)); else tmp = Float64(d1 * Float64(d4 - d3)); end return tmp end
function tmp_2 = code(d1, d2, d3, d4) tmp = 0.0; if (d4 <= -1.25e-264) tmp = d1 * (d2 - d1); elseif (d4 <= 2e-282) tmp = d1 * -d3; elseif (d4 <= 7e-246) tmp = -(d1 * d1); elseif (d4 <= 6.2e-36) tmp = d1 * (d2 - d3); elseif (d4 <= 8.5e+24) tmp = d1 * (d4 - d1); else tmp = d1 * (d4 - d3); end tmp_2 = tmp; end
code[d1_, d2_, d3_, d4_] := If[LessEqual[d4, -1.25e-264], N[(d1 * N[(d2 - d1), $MachinePrecision]), $MachinePrecision], If[LessEqual[d4, 2e-282], N[(d1 * (-d3)), $MachinePrecision], If[LessEqual[d4, 7e-246], (-N[(d1 * d1), $MachinePrecision]), If[LessEqual[d4, 6.2e-36], N[(d1 * N[(d2 - d3), $MachinePrecision]), $MachinePrecision], If[LessEqual[d4, 8.5e+24], N[(d1 * N[(d4 - d1), $MachinePrecision]), $MachinePrecision], N[(d1 * N[(d4 - d3), $MachinePrecision]), $MachinePrecision]]]]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;d4 \leq -1.25 \cdot 10^{-264}:\\
\;\;\;\;d1 \cdot \left(d2 - d1\right)\\
\mathbf{elif}\;d4 \leq 2 \cdot 10^{-282}:\\
\;\;\;\;d1 \cdot \left(-d3\right)\\
\mathbf{elif}\;d4 \leq 7 \cdot 10^{-246}:\\
\;\;\;\;-d1 \cdot d1\\
\mathbf{elif}\;d4 \leq 6.2 \cdot 10^{-36}:\\
\;\;\;\;d1 \cdot \left(d2 - d3\right)\\
\mathbf{elif}\;d4 \leq 8.5 \cdot 10^{+24}:\\
\;\;\;\;d1 \cdot \left(d4 - d1\right)\\
\mathbf{else}:\\
\;\;\;\;d1 \cdot \left(d4 - d3\right)\\
\end{array}
\end{array}
if d4 < -1.25e-264Initial program 91.2%
associate--l+91.2%
distribute-lft-out--91.2%
distribute-rgt-out--92.8%
distribute-lft-out100.0%
Simplified100.0%
Taylor expanded in d3 around 0 77.5%
Taylor expanded in d4 around 0 59.4%
if -1.25e-264 < d4 < 2e-282Initial program 100.0%
associate--l+100.0%
distribute-lft-out--100.0%
distribute-rgt-out--100.0%
distribute-lft-out100.0%
Simplified100.0%
Taylor expanded in d3 around inf 41.2%
mul-1-neg41.2%
distribute-rgt-neg-out41.2%
Simplified41.2%
if 2e-282 < d4 < 7.0000000000000003e-246Initial program 87.5%
associate--l+87.5%
distribute-lft-out--87.5%
distribute-rgt-out--87.5%
distribute-lft-out100.0%
Simplified100.0%
Taylor expanded in d1 around inf 51.5%
neg-mul-151.5%
Simplified51.5%
if 7.0000000000000003e-246 < d4 < 6.1999999999999997e-36Initial program 93.9%
associate--l+93.9%
distribute-lft-out--93.9%
distribute-rgt-out--93.9%
distribute-lft-out100.0%
Simplified100.0%
Taylor expanded in d1 around 0 91.2%
Taylor expanded in d4 around 0 88.4%
if 6.1999999999999997e-36 < d4 < 8.49999999999999959e24Initial program 83.3%
associate--l+83.3%
distribute-lft-out--91.7%
distribute-rgt-out--91.7%
distribute-lft-out100.0%
Simplified100.0%
Taylor expanded in d3 around 0 91.7%
Taylor expanded in d2 around 0 75.4%
if 8.49999999999999959e24 < d4 Initial program 83.8%
associate--l+83.8%
distribute-lft-out--85.2%
distribute-rgt-out--89.7%
distribute-lft-out100.0%
Simplified100.0%
Taylor expanded in d1 around 0 95.8%
Taylor expanded in d2 around 0 76.5%
Final simplification67.5%
(FPCore (d1 d2 d3 d4)
:precision binary64
(let* ((t_0 (- (* d1 d1))) (t_1 (* d1 (+ d2 d4))))
(if (<= d1 -5.5e+169)
t_0
(if (<= d1 -4.9e+72)
t_1
(if (<= d1 -3.3e-12) (* d1 (- d3)) (if (<= d1 9e+100) t_1 t_0))))))
double code(double d1, double d2, double d3, double d4) {
double t_0 = -(d1 * d1);
double t_1 = d1 * (d2 + d4);
double tmp;
if (d1 <= -5.5e+169) {
tmp = t_0;
} else if (d1 <= -4.9e+72) {
tmp = t_1;
} else if (d1 <= -3.3e-12) {
tmp = d1 * -d3;
} else if (d1 <= 9e+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 * d1)
t_1 = d1 * (d2 + d4)
if (d1 <= (-5.5d+169)) then
tmp = t_0
else if (d1 <= (-4.9d+72)) then
tmp = t_1
else if (d1 <= (-3.3d-12)) then
tmp = d1 * -d3
else if (d1 <= 9d+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 * d1);
double t_1 = d1 * (d2 + d4);
double tmp;
if (d1 <= -5.5e+169) {
tmp = t_0;
} else if (d1 <= -4.9e+72) {
tmp = t_1;
} else if (d1 <= -3.3e-12) {
tmp = d1 * -d3;
} else if (d1 <= 9e+100) {
tmp = t_1;
} else {
tmp = t_0;
}
return tmp;
}
def code(d1, d2, d3, d4): t_0 = -(d1 * d1) t_1 = d1 * (d2 + d4) tmp = 0 if d1 <= -5.5e+169: tmp = t_0 elif d1 <= -4.9e+72: tmp = t_1 elif d1 <= -3.3e-12: tmp = d1 * -d3 elif d1 <= 9e+100: tmp = t_1 else: tmp = t_0 return tmp
function code(d1, d2, d3, d4) t_0 = Float64(-Float64(d1 * d1)) t_1 = Float64(d1 * Float64(d2 + d4)) tmp = 0.0 if (d1 <= -5.5e+169) tmp = t_0; elseif (d1 <= -4.9e+72) tmp = t_1; elseif (d1 <= -3.3e-12) tmp = Float64(d1 * Float64(-d3)); elseif (d1 <= 9e+100) tmp = t_1; else tmp = t_0; end return tmp end
function tmp_2 = code(d1, d2, d3, d4) t_0 = -(d1 * d1); t_1 = d1 * (d2 + d4); tmp = 0.0; if (d1 <= -5.5e+169) tmp = t_0; elseif (d1 <= -4.9e+72) tmp = t_1; elseif (d1 <= -3.3e-12) tmp = d1 * -d3; elseif (d1 <= 9e+100) tmp = t_1; else tmp = t_0; end tmp_2 = tmp; end
code[d1_, d2_, d3_, d4_] := Block[{t$95$0 = (-N[(d1 * d1), $MachinePrecision])}, Block[{t$95$1 = N[(d1 * N[(d2 + d4), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[d1, -5.5e+169], t$95$0, If[LessEqual[d1, -4.9e+72], t$95$1, If[LessEqual[d1, -3.3e-12], N[(d1 * (-d3)), $MachinePrecision], If[LessEqual[d1, 9e+100], t$95$1, t$95$0]]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := -d1 \cdot d1\\
t_1 := d1 \cdot \left(d2 + d4\right)\\
\mathbf{if}\;d1 \leq -5.5 \cdot 10^{+169}:\\
\;\;\;\;t\_0\\
\mathbf{elif}\;d1 \leq -4.9 \cdot 10^{+72}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;d1 \leq -3.3 \cdot 10^{-12}:\\
\;\;\;\;d1 \cdot \left(-d3\right)\\
\mathbf{elif}\;d1 \leq 9 \cdot 10^{+100}:\\
\;\;\;\;t\_1\\
\mathbf{else}:\\
\;\;\;\;t\_0\\
\end{array}
\end{array}
if d1 < -5.49999999999999972e169 or 9.00000000000000073e100 < d1 Initial program 62.9%
associate--l+62.9%
distribute-lft-out--66.1%
distribute-rgt-out--74.2%
distribute-lft-out100.0%
Simplified100.0%
Taylor expanded in d1 around inf 88.9%
neg-mul-188.9%
Simplified88.9%
if -5.49999999999999972e169 < d1 < -4.90000000000000006e72 or -3.3000000000000001e-12 < d1 < 9.00000000000000073e100Initial program 97.6%
associate--l+97.6%
distribute-lft-out--97.6%
distribute-rgt-out--97.6%
distribute-lft-out100.0%
Simplified100.0%
Taylor expanded in d3 around 0 74.6%
Taylor expanded in d1 around 0 68.5%
if -4.90000000000000006e72 < d1 < -3.3000000000000001e-12Initial program 99.9%
associate--l+99.9%
distribute-lft-out--100.0%
distribute-rgt-out--100.0%
distribute-lft-out100.0%
Simplified100.0%
Taylor expanded in d3 around inf 52.7%
mul-1-neg52.7%
distribute-rgt-neg-out52.7%
Simplified52.7%
Final simplification71.9%
(FPCore (d1 d2 d3 d4)
:precision binary64
(let* ((t_0 (* d1 (- d3))))
(if (<= d4 -1.65e-260)
(* d1 d2)
(if (<= d4 1.42e-18)
t_0
(if (<= d4 1.26e+26)
(- (* d1 d1))
(if (<= d4 1.9e+98) t_0 (* d1 d4)))))))
double code(double d1, double d2, double d3, double d4) {
double t_0 = d1 * -d3;
double tmp;
if (d4 <= -1.65e-260) {
tmp = d1 * d2;
} else if (d4 <= 1.42e-18) {
tmp = t_0;
} else if (d4 <= 1.26e+26) {
tmp = -(d1 * d1);
} else if (d4 <= 1.9e+98) {
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) :: tmp
t_0 = d1 * -d3
if (d4 <= (-1.65d-260)) then
tmp = d1 * d2
else if (d4 <= 1.42d-18) then
tmp = t_0
else if (d4 <= 1.26d+26) then
tmp = -(d1 * d1)
else if (d4 <= 1.9d+98) 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 * -d3;
double tmp;
if (d4 <= -1.65e-260) {
tmp = d1 * d2;
} else if (d4 <= 1.42e-18) {
tmp = t_0;
} else if (d4 <= 1.26e+26) {
tmp = -(d1 * d1);
} else if (d4 <= 1.9e+98) {
tmp = t_0;
} else {
tmp = d1 * d4;
}
return tmp;
}
def code(d1, d2, d3, d4): t_0 = d1 * -d3 tmp = 0 if d4 <= -1.65e-260: tmp = d1 * d2 elif d4 <= 1.42e-18: tmp = t_0 elif d4 <= 1.26e+26: tmp = -(d1 * d1) elif d4 <= 1.9e+98: tmp = t_0 else: tmp = d1 * d4 return tmp
function code(d1, d2, d3, d4) t_0 = Float64(d1 * Float64(-d3)) tmp = 0.0 if (d4 <= -1.65e-260) tmp = Float64(d1 * d2); elseif (d4 <= 1.42e-18) tmp = t_0; elseif (d4 <= 1.26e+26) tmp = Float64(-Float64(d1 * d1)); elseif (d4 <= 1.9e+98) tmp = t_0; else tmp = Float64(d1 * d4); end return tmp end
function tmp_2 = code(d1, d2, d3, d4) t_0 = d1 * -d3; tmp = 0.0; if (d4 <= -1.65e-260) tmp = d1 * d2; elseif (d4 <= 1.42e-18) tmp = t_0; elseif (d4 <= 1.26e+26) tmp = -(d1 * d1); elseif (d4 <= 1.9e+98) tmp = t_0; else tmp = d1 * d4; end tmp_2 = tmp; end
code[d1_, d2_, d3_, d4_] := Block[{t$95$0 = N[(d1 * (-d3)), $MachinePrecision]}, If[LessEqual[d4, -1.65e-260], N[(d1 * d2), $MachinePrecision], If[LessEqual[d4, 1.42e-18], t$95$0, If[LessEqual[d4, 1.26e+26], (-N[(d1 * d1), $MachinePrecision]), If[LessEqual[d4, 1.9e+98], t$95$0, N[(d1 * d4), $MachinePrecision]]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := d1 \cdot \left(-d3\right)\\
\mathbf{if}\;d4 \leq -1.65 \cdot 10^{-260}:\\
\;\;\;\;d1 \cdot d2\\
\mathbf{elif}\;d4 \leq 1.42 \cdot 10^{-18}:\\
\;\;\;\;t\_0\\
\mathbf{elif}\;d4 \leq 1.26 \cdot 10^{+26}:\\
\;\;\;\;-d1 \cdot d1\\
\mathbf{elif}\;d4 \leq 1.9 \cdot 10^{+98}:\\
\;\;\;\;t\_0\\
\mathbf{else}:\\
\;\;\;\;d1 \cdot d4\\
\end{array}
\end{array}
if d4 < -1.6499999999999999e-260Initial program 91.2%
associate--l+91.2%
distribute-lft-out--91.2%
distribute-rgt-out--92.8%
distribute-lft-out100.0%
Simplified100.0%
Taylor expanded in d2 around inf 37.5%
if -1.6499999999999999e-260 < d4 < 1.41999999999999996e-18 or 1.25999999999999995e26 < d4 < 1.89999999999999995e98Initial program 95.8%
associate--l+95.8%
distribute-lft-out--95.8%
distribute-rgt-out--95.8%
distribute-lft-out100.0%
Simplified100.0%
Taylor expanded in d3 around inf 50.3%
mul-1-neg50.3%
distribute-rgt-neg-out50.3%
Simplified50.3%
if 1.41999999999999996e-18 < d4 < 1.25999999999999995e26Initial program 80.0%
associate--l+80.0%
distribute-lft-out--90.0%
distribute-rgt-out--90.0%
distribute-lft-out100.0%
Simplified100.0%
Taylor expanded in d1 around inf 60.9%
neg-mul-160.9%
Simplified60.9%
if 1.89999999999999995e98 < d4 Initial program 77.5%
associate--l+77.5%
distribute-lft-out--79.5%
distribute-rgt-out--85.7%
distribute-lft-out100.0%
Simplified100.0%
Taylor expanded in d4 around inf 76.1%
Final simplification49.4%
(FPCore (d1 d2 d3 d4)
:precision binary64
(let* ((t_0 (* d1 (- d2 d1))))
(if (<= d1 -9.2e+45)
t_0
(if (<= d1 -3.6e-12)
(* d1 (- d3))
(if (<= d1 5.6e+100) (* d1 (+ d2 d4)) t_0)))))
double code(double d1, double d2, double d3, double d4) {
double t_0 = d1 * (d2 - d1);
double tmp;
if (d1 <= -9.2e+45) {
tmp = t_0;
} else if (d1 <= -3.6e-12) {
tmp = d1 * -d3;
} else if (d1 <= 5.6e+100) {
tmp = d1 * (d2 + d4);
} else {
tmp = t_0;
}
return tmp;
}
real(8) function code(d1, d2, d3, d4)
real(8), intent (in) :: d1
real(8), intent (in) :: d2
real(8), intent (in) :: d3
real(8), intent (in) :: d4
real(8) :: t_0
real(8) :: tmp
t_0 = d1 * (d2 - d1)
if (d1 <= (-9.2d+45)) then
tmp = t_0
else if (d1 <= (-3.6d-12)) then
tmp = d1 * -d3
else if (d1 <= 5.6d+100) then
tmp = d1 * (d2 + d4)
else
tmp = t_0
end if
code = tmp
end function
public static double code(double d1, double d2, double d3, double d4) {
double t_0 = d1 * (d2 - d1);
double tmp;
if (d1 <= -9.2e+45) {
tmp = t_0;
} else if (d1 <= -3.6e-12) {
tmp = d1 * -d3;
} else if (d1 <= 5.6e+100) {
tmp = d1 * (d2 + d4);
} else {
tmp = t_0;
}
return tmp;
}
def code(d1, d2, d3, d4): t_0 = d1 * (d2 - d1) tmp = 0 if d1 <= -9.2e+45: tmp = t_0 elif d1 <= -3.6e-12: tmp = d1 * -d3 elif d1 <= 5.6e+100: tmp = d1 * (d2 + d4) else: tmp = t_0 return tmp
function code(d1, d2, d3, d4) t_0 = Float64(d1 * Float64(d2 - d1)) tmp = 0.0 if (d1 <= -9.2e+45) tmp = t_0; elseif (d1 <= -3.6e-12) tmp = Float64(d1 * Float64(-d3)); elseif (d1 <= 5.6e+100) tmp = Float64(d1 * Float64(d2 + d4)); else tmp = t_0; end return tmp end
function tmp_2 = code(d1, d2, d3, d4) t_0 = d1 * (d2 - d1); tmp = 0.0; if (d1 <= -9.2e+45) tmp = t_0; elseif (d1 <= -3.6e-12) tmp = d1 * -d3; elseif (d1 <= 5.6e+100) tmp = d1 * (d2 + d4); else tmp = t_0; end tmp_2 = tmp; end
code[d1_, d2_, d3_, d4_] := Block[{t$95$0 = N[(d1 * N[(d2 - d1), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[d1, -9.2e+45], t$95$0, If[LessEqual[d1, -3.6e-12], N[(d1 * (-d3)), $MachinePrecision], If[LessEqual[d1, 5.6e+100], N[(d1 * N[(d2 + d4), $MachinePrecision]), $MachinePrecision], t$95$0]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := d1 \cdot \left(d2 - d1\right)\\
\mathbf{if}\;d1 \leq -9.2 \cdot 10^{+45}:\\
\;\;\;\;t\_0\\
\mathbf{elif}\;d1 \leq -3.6 \cdot 10^{-12}:\\
\;\;\;\;d1 \cdot \left(-d3\right)\\
\mathbf{elif}\;d1 \leq 5.6 \cdot 10^{+100}:\\
\;\;\;\;d1 \cdot \left(d2 + d4\right)\\
\mathbf{else}:\\
\;\;\;\;t\_0\\
\end{array}
\end{array}
if d1 < -9.20000000000000049e45 or 5.5999999999999996e100 < d1 Initial program 67.9%
associate--l+67.9%
distribute-lft-out--70.2%
distribute-rgt-out--76.2%
distribute-lft-out100.0%
Simplified100.0%
Taylor expanded in d3 around 0 92.9%
Taylor expanded in d4 around 0 87.8%
if -9.20000000000000049e45 < d1 < -3.6e-12Initial program 99.9%
associate--l+99.9%
distribute-lft-out--100.0%
distribute-rgt-out--100.0%
distribute-lft-out100.0%
Simplified100.0%
Taylor expanded in d3 around inf 55.2%
mul-1-neg55.2%
distribute-rgt-neg-out55.2%
Simplified55.2%
if -3.6e-12 < d1 < 5.5999999999999996e100Initial program 100.0%
associate--l+100.0%
distribute-lft-out--100.0%
distribute-rgt-out--100.0%
distribute-lft-out100.0%
Simplified100.0%
Taylor expanded in d3 around 0 73.3%
Taylor expanded in d1 around 0 69.8%
Final simplification74.4%
(FPCore (d1 d2 d3 d4) :precision binary64 (if (or (<= d3 -1.45e+88) (not (<= d3 8.6e+129))) (* d1 (- d4 d3)) (* d1 (- (+ d2 d4) d1))))
double code(double d1, double d2, double d3, double d4) {
double tmp;
if ((d3 <= -1.45e+88) || !(d3 <= 8.6e+129)) {
tmp = d1 * (d4 - d3);
} else {
tmp = d1 * ((d2 + d4) - d1);
}
return tmp;
}
real(8) function code(d1, d2, d3, d4)
real(8), intent (in) :: d1
real(8), intent (in) :: d2
real(8), intent (in) :: d3
real(8), intent (in) :: d4
real(8) :: tmp
if ((d3 <= (-1.45d+88)) .or. (.not. (d3 <= 8.6d+129))) then
tmp = d1 * (d4 - d3)
else
tmp = d1 * ((d2 + d4) - d1)
end if
code = tmp
end function
public static double code(double d1, double d2, double d3, double d4) {
double tmp;
if ((d3 <= -1.45e+88) || !(d3 <= 8.6e+129)) {
tmp = d1 * (d4 - d3);
} else {
tmp = d1 * ((d2 + d4) - d1);
}
return tmp;
}
def code(d1, d2, d3, d4): tmp = 0 if (d3 <= -1.45e+88) or not (d3 <= 8.6e+129): tmp = d1 * (d4 - d3) else: tmp = d1 * ((d2 + d4) - d1) return tmp
function code(d1, d2, d3, d4) tmp = 0.0 if ((d3 <= -1.45e+88) || !(d3 <= 8.6e+129)) tmp = Float64(d1 * Float64(d4 - d3)); else tmp = Float64(d1 * Float64(Float64(d2 + d4) - d1)); end return tmp end
function tmp_2 = code(d1, d2, d3, d4) tmp = 0.0; if ((d3 <= -1.45e+88) || ~((d3 <= 8.6e+129))) tmp = d1 * (d4 - d3); else tmp = d1 * ((d2 + d4) - d1); end tmp_2 = tmp; end
code[d1_, d2_, d3_, d4_] := If[Or[LessEqual[d3, -1.45e+88], N[Not[LessEqual[d3, 8.6e+129]], $MachinePrecision]], N[(d1 * N[(d4 - d3), $MachinePrecision]), $MachinePrecision], N[(d1 * N[(N[(d2 + d4), $MachinePrecision] - d1), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;d3 \leq -1.45 \cdot 10^{+88} \lor \neg \left(d3 \leq 8.6 \cdot 10^{+129}\right):\\
\;\;\;\;d1 \cdot \left(d4 - d3\right)\\
\mathbf{else}:\\
\;\;\;\;d1 \cdot \left(\left(d2 + d4\right) - d1\right)\\
\end{array}
\end{array}
if d3 < -1.45e88 or 8.60000000000000042e129 < d3 Initial program 85.1%
associate--l+85.1%
distribute-lft-out--87.4%
distribute-rgt-out--89.7%
distribute-lft-out100.0%
Simplified100.0%
Taylor expanded in d1 around 0 97.7%
Taylor expanded in d2 around 0 83.1%
if -1.45e88 < d3 < 8.60000000000000042e129Initial program 91.7%
associate--l+91.7%
distribute-lft-out--91.7%
distribute-rgt-out--93.5%
distribute-lft-out100.0%
Simplified100.0%
Taylor expanded in d3 around 0 92.2%
Final simplification89.1%
(FPCore (d1 d2 d3 d4) :precision binary64 (if (or (<= d3 -8.5e+40) (not (<= d3 4.8e+47))) (* d1 (- (+ d2 d4) d3)) (* d1 (- (+ d2 d4) d1))))
double code(double d1, double d2, double d3, double d4) {
double tmp;
if ((d3 <= -8.5e+40) || !(d3 <= 4.8e+47)) {
tmp = d1 * ((d2 + d4) - d3);
} else {
tmp = d1 * ((d2 + d4) - d1);
}
return tmp;
}
real(8) function code(d1, d2, d3, d4)
real(8), intent (in) :: d1
real(8), intent (in) :: d2
real(8), intent (in) :: d3
real(8), intent (in) :: d4
real(8) :: tmp
if ((d3 <= (-8.5d+40)) .or. (.not. (d3 <= 4.8d+47))) then
tmp = d1 * ((d2 + d4) - d3)
else
tmp = d1 * ((d2 + d4) - d1)
end if
code = tmp
end function
public static double code(double d1, double d2, double d3, double d4) {
double tmp;
if ((d3 <= -8.5e+40) || !(d3 <= 4.8e+47)) {
tmp = d1 * ((d2 + d4) - d3);
} else {
tmp = d1 * ((d2 + d4) - d1);
}
return tmp;
}
def code(d1, d2, d3, d4): tmp = 0 if (d3 <= -8.5e+40) or not (d3 <= 4.8e+47): tmp = d1 * ((d2 + d4) - d3) else: tmp = d1 * ((d2 + d4) - d1) return tmp
function code(d1, d2, d3, d4) tmp = 0.0 if ((d3 <= -8.5e+40) || !(d3 <= 4.8e+47)) tmp = Float64(d1 * Float64(Float64(d2 + d4) - d3)); else tmp = Float64(d1 * Float64(Float64(d2 + d4) - d1)); end return tmp end
function tmp_2 = code(d1, d2, d3, d4) tmp = 0.0; if ((d3 <= -8.5e+40) || ~((d3 <= 4.8e+47))) tmp = d1 * ((d2 + d4) - d3); else tmp = d1 * ((d2 + d4) - d1); end tmp_2 = tmp; end
code[d1_, d2_, d3_, d4_] := If[Or[LessEqual[d3, -8.5e+40], N[Not[LessEqual[d3, 4.8e+47]], $MachinePrecision]], N[(d1 * N[(N[(d2 + d4), $MachinePrecision] - d3), $MachinePrecision]), $MachinePrecision], N[(d1 * N[(N[(d2 + d4), $MachinePrecision] - d1), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;d3 \leq -8.5 \cdot 10^{+40} \lor \neg \left(d3 \leq 4.8 \cdot 10^{+47}\right):\\
\;\;\;\;d1 \cdot \left(\left(d2 + d4\right) - d3\right)\\
\mathbf{else}:\\
\;\;\;\;d1 \cdot \left(\left(d2 + d4\right) - d1\right)\\
\end{array}
\end{array}
if d3 < -8.49999999999999996e40 or 4.80000000000000037e47 < d3 Initial program 85.1%
associate--l+85.1%
distribute-lft-out--86.8%
distribute-rgt-out--89.2%
distribute-lft-out100.0%
Simplified100.0%
Taylor expanded in d1 around 0 95.1%
if -8.49999999999999996e40 < d3 < 4.80000000000000037e47Initial program 93.3%
associate--l+93.3%
distribute-lft-out--93.3%
distribute-rgt-out--94.8%
distribute-lft-out100.0%
Simplified100.0%
Taylor expanded in d3 around 0 97.3%
Final simplification96.3%
(FPCore (d1 d2 d3 d4) :precision binary64 (if (<= d4 -3.9e-233) (* d1 d2) (if (<= d4 2.8e+111) (- (* d1 d1)) (* d1 d4))))
double code(double d1, double d2, double d3, double d4) {
double tmp;
if (d4 <= -3.9e-233) {
tmp = d1 * d2;
} else if (d4 <= 2.8e+111) {
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 (d4 <= (-3.9d-233)) then
tmp = d1 * d2
else if (d4 <= 2.8d+111) 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 (d4 <= -3.9e-233) {
tmp = d1 * d2;
} else if (d4 <= 2.8e+111) {
tmp = -(d1 * d1);
} else {
tmp = d1 * d4;
}
return tmp;
}
def code(d1, d2, d3, d4): tmp = 0 if d4 <= -3.9e-233: tmp = d1 * d2 elif d4 <= 2.8e+111: tmp = -(d1 * d1) else: tmp = d1 * d4 return tmp
function code(d1, d2, d3, d4) tmp = 0.0 if (d4 <= -3.9e-233) tmp = Float64(d1 * d2); elseif (d4 <= 2.8e+111) tmp = Float64(-Float64(d1 * d1)); else tmp = Float64(d1 * d4); end return tmp end
function tmp_2 = code(d1, d2, d3, d4) tmp = 0.0; if (d4 <= -3.9e-233) tmp = d1 * d2; elseif (d4 <= 2.8e+111) tmp = -(d1 * d1); else tmp = d1 * d4; end tmp_2 = tmp; end
code[d1_, d2_, d3_, d4_] := If[LessEqual[d4, -3.9e-233], N[(d1 * d2), $MachinePrecision], If[LessEqual[d4, 2.8e+111], (-N[(d1 * d1), $MachinePrecision]), N[(d1 * d4), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;d4 \leq -3.9 \cdot 10^{-233}:\\
\;\;\;\;d1 \cdot d2\\
\mathbf{elif}\;d4 \leq 2.8 \cdot 10^{+111}:\\
\;\;\;\;-d1 \cdot d1\\
\mathbf{else}:\\
\;\;\;\;d1 \cdot d4\\
\end{array}
\end{array}
if d4 < -3.9000000000000001e-233Initial program 92.2%
associate--l+92.2%
distribute-lft-out--92.2%
distribute-rgt-out--94.0%
distribute-lft-out100.0%
Simplified100.0%
Taylor expanded in d2 around inf 37.7%
if -3.9000000000000001e-233 < d4 < 2.7999999999999999e111Initial program 92.5%
associate--l+92.5%
distribute-lft-out--93.5%
distribute-rgt-out--93.5%
distribute-lft-out100.0%
Simplified100.0%
Taylor expanded in d1 around inf 35.6%
neg-mul-135.6%
Simplified35.6%
if 2.7999999999999999e111 < d4 Initial program 76.5%
associate--l+76.5%
distribute-lft-out--78.7%
distribute-rgt-out--85.0%
distribute-lft-out100.0%
Simplified100.0%
Taylor expanded in d4 around inf 77.2%
Final simplification44.2%
(FPCore (d1 d2 d3 d4) :precision binary64 (if (<= d2 -1.9e+97) (* d1 d2) (* d1 d4)))
double code(double d1, double d2, double d3, double d4) {
double tmp;
if (d2 <= -1.9e+97) {
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 <= (-1.9d+97)) 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 <= -1.9e+97) {
tmp = d1 * d2;
} else {
tmp = d1 * d4;
}
return tmp;
}
def code(d1, d2, d3, d4): tmp = 0 if d2 <= -1.9e+97: tmp = d1 * d2 else: tmp = d1 * d4 return tmp
function code(d1, d2, d3, d4) tmp = 0.0 if (d2 <= -1.9e+97) 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 <= -1.9e+97) tmp = d1 * d2; else tmp = d1 * d4; end tmp_2 = tmp; end
code[d1_, d2_, d3_, d4_] := If[LessEqual[d2, -1.9e+97], N[(d1 * d2), $MachinePrecision], N[(d1 * d4), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;d2 \leq -1.9 \cdot 10^{+97}:\\
\;\;\;\;d1 \cdot d2\\
\mathbf{else}:\\
\;\;\;\;d1 \cdot d4\\
\end{array}
\end{array}
if d2 < -1.90000000000000018e97Initial program 81.8%
associate--l+81.8%
distribute-lft-out--81.8%
distribute-rgt-out--81.8%
distribute-lft-out100.0%
Simplified100.0%
Taylor expanded in d2 around inf 66.6%
if -1.90000000000000018e97 < d2 Initial program 91.0%
associate--l+91.0%
distribute-lft-out--92.0%
distribute-rgt-out--94.3%
distribute-lft-out100.0%
Simplified100.0%
Taylor expanded in d4 around inf 33.4%
Final simplification39.1%
(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%
distribute-lft-out--90.2%
distribute-rgt-out--92.2%
distribute-lft-out100.0%
Simplified100.0%
Taylor expanded in d2 around inf 33.2%
Final simplification33.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 2024046
(FPCore (d1 d2 d3 d4)
:name "FastMath dist4"
:precision binary64
:alt
(* d1 (- (+ (- d2 d3) d4) d1))
(- (+ (- (* d1 d2) (* d1 d3)) (* d4 d1)) (* d1 d1)))