
(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.0%
associate--l+89.0%
distribute-lft-out--90.2%
distribute-rgt-out--94.1%
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))) (t_2 (* d1 (+ d2 d4))))
(if (<= d3 -1.55e+100)
t_1
(if (<= d3 -6.2e+23)
t_2
(if (<= d3 -5.4e-89)
t_0
(if (<= d3 -1.1e-214)
t_2
(if (<= d3 5.4e-34)
t_0
(if (<= d3 2500.0) t_2 (if (<= d3 1e+73) t_0 t_1)))))))))
double code(double d1, double d2, double d3, double d4) {
double t_0 = d1 * (d2 - d1);
double t_1 = d1 * (d2 - d3);
double t_2 = d1 * (d2 + d4);
double tmp;
if (d3 <= -1.55e+100) {
tmp = t_1;
} else if (d3 <= -6.2e+23) {
tmp = t_2;
} else if (d3 <= -5.4e-89) {
tmp = t_0;
} else if (d3 <= -1.1e-214) {
tmp = t_2;
} else if (d3 <= 5.4e-34) {
tmp = t_0;
} else if (d3 <= 2500.0) {
tmp = t_2;
} else if (d3 <= 1e+73) {
tmp = t_0;
} else {
tmp = t_1;
}
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) :: t_2
real(8) :: tmp
t_0 = d1 * (d2 - d1)
t_1 = d1 * (d2 - d3)
t_2 = d1 * (d2 + d4)
if (d3 <= (-1.55d+100)) then
tmp = t_1
else if (d3 <= (-6.2d+23)) then
tmp = t_2
else if (d3 <= (-5.4d-89)) then
tmp = t_0
else if (d3 <= (-1.1d-214)) then
tmp = t_2
else if (d3 <= 5.4d-34) then
tmp = t_0
else if (d3 <= 2500.0d0) then
tmp = t_2
else if (d3 <= 1d+73) then
tmp = t_0
else
tmp = t_1
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 t_2 = d1 * (d2 + d4);
double tmp;
if (d3 <= -1.55e+100) {
tmp = t_1;
} else if (d3 <= -6.2e+23) {
tmp = t_2;
} else if (d3 <= -5.4e-89) {
tmp = t_0;
} else if (d3 <= -1.1e-214) {
tmp = t_2;
} else if (d3 <= 5.4e-34) {
tmp = t_0;
} else if (d3 <= 2500.0) {
tmp = t_2;
} else if (d3 <= 1e+73) {
tmp = t_0;
} else {
tmp = t_1;
}
return tmp;
}
def code(d1, d2, d3, d4): t_0 = d1 * (d2 - d1) t_1 = d1 * (d2 - d3) t_2 = d1 * (d2 + d4) tmp = 0 if d3 <= -1.55e+100: tmp = t_1 elif d3 <= -6.2e+23: tmp = t_2 elif d3 <= -5.4e-89: tmp = t_0 elif d3 <= -1.1e-214: tmp = t_2 elif d3 <= 5.4e-34: tmp = t_0 elif d3 <= 2500.0: tmp = t_2 elif d3 <= 1e+73: tmp = t_0 else: tmp = t_1 return tmp
function code(d1, d2, d3, d4) t_0 = Float64(d1 * Float64(d2 - d1)) t_1 = Float64(d1 * Float64(d2 - d3)) t_2 = Float64(d1 * Float64(d2 + d4)) tmp = 0.0 if (d3 <= -1.55e+100) tmp = t_1; elseif (d3 <= -6.2e+23) tmp = t_2; elseif (d3 <= -5.4e-89) tmp = t_0; elseif (d3 <= -1.1e-214) tmp = t_2; elseif (d3 <= 5.4e-34) tmp = t_0; elseif (d3 <= 2500.0) tmp = t_2; elseif (d3 <= 1e+73) tmp = t_0; else tmp = t_1; end return tmp end
function tmp_2 = code(d1, d2, d3, d4) t_0 = d1 * (d2 - d1); t_1 = d1 * (d2 - d3); t_2 = d1 * (d2 + d4); tmp = 0.0; if (d3 <= -1.55e+100) tmp = t_1; elseif (d3 <= -6.2e+23) tmp = t_2; elseif (d3 <= -5.4e-89) tmp = t_0; elseif (d3 <= -1.1e-214) tmp = t_2; elseif (d3 <= 5.4e-34) tmp = t_0; elseif (d3 <= 2500.0) tmp = t_2; elseif (d3 <= 1e+73) tmp = t_0; else tmp = t_1; 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]}, Block[{t$95$2 = N[(d1 * N[(d2 + d4), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[d3, -1.55e+100], t$95$1, If[LessEqual[d3, -6.2e+23], t$95$2, If[LessEqual[d3, -5.4e-89], t$95$0, If[LessEqual[d3, -1.1e-214], t$95$2, If[LessEqual[d3, 5.4e-34], t$95$0, If[LessEqual[d3, 2500.0], t$95$2, If[LessEqual[d3, 1e+73], t$95$0, t$95$1]]]]]]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := d1 \cdot \left(d2 - d1\right)\\
t_1 := d1 \cdot \left(d2 - d3\right)\\
t_2 := d1 \cdot \left(d2 + d4\right)\\
\mathbf{if}\;d3 \leq -1.55 \cdot 10^{+100}:\\
\;\;\;\;t_1\\
\mathbf{elif}\;d3 \leq -6.2 \cdot 10^{+23}:\\
\;\;\;\;t_2\\
\mathbf{elif}\;d3 \leq -5.4 \cdot 10^{-89}:\\
\;\;\;\;t_0\\
\mathbf{elif}\;d3 \leq -1.1 \cdot 10^{-214}:\\
\;\;\;\;t_2\\
\mathbf{elif}\;d3 \leq 5.4 \cdot 10^{-34}:\\
\;\;\;\;t_0\\
\mathbf{elif}\;d3 \leq 2500:\\
\;\;\;\;t_2\\
\mathbf{elif}\;d3 \leq 10^{+73}:\\
\;\;\;\;t_0\\
\mathbf{else}:\\
\;\;\;\;t_1\\
\end{array}
\end{array}
if d3 < -1.55000000000000003e100 or 9.99999999999999983e72 < d3 Initial program 87.2%
associate--l+87.2%
distribute-lft-out--89.3%
distribute-rgt-out--92.5%
distribute-lft-out100.0%
Simplified100.0%
Taylor expanded in d4 around 0 86.6%
Taylor expanded in d1 around 0 81.4%
if -1.55000000000000003e100 < d3 < -6.19999999999999941e23 or -5.39999999999999975e-89 < d3 < -1.10000000000000001e-214 or 5.40000000000000034e-34 < d3 < 2500Initial program 87.5%
associate--l+87.5%
distribute-lft-out--89.3%
distribute-rgt-out--94.6%
distribute-lft-out100.0%
Simplified100.0%
Taylor expanded in d1 around 0 87.7%
Taylor expanded in d3 around 0 84.2%
if -6.19999999999999941e23 < d3 < -5.39999999999999975e-89 or -1.10000000000000001e-214 < d3 < 5.40000000000000034e-34 or 2500 < d3 < 9.99999999999999983e72Initial program 91.5%
associate--l+91.5%
distribute-lft-out--91.5%
distribute-rgt-out--95.3%
distribute-lft-out100.0%
Simplified100.0%
Taylor expanded in d4 around 0 76.7%
Taylor expanded in d3 around 0 73.5%
Final simplification78.7%
(FPCore (d1 d2 d3 d4)
:precision binary64
(if (<= d2 -1.3e+98)
(* d1 d2)
(if (<= d2 -2.4e+70)
(* d1 d4)
(if (<= d2 -1.14e+45)
(* d1 d2)
(if (<= d2 -2.4e-25)
(* d1 d4)
(if (<= d2 -4.2e-183)
(- (* d1 d1))
(if (<= d2 7e-83) (* d1 (- d3)) (* d1 d4))))))))
double code(double d1, double d2, double d3, double d4) {
double tmp;
if (d2 <= -1.3e+98) {
tmp = d1 * d2;
} else if (d2 <= -2.4e+70) {
tmp = d1 * d4;
} else if (d2 <= -1.14e+45) {
tmp = d1 * d2;
} else if (d2 <= -2.4e-25) {
tmp = d1 * d4;
} else if (d2 <= -4.2e-183) {
tmp = -(d1 * d1);
} else if (d2 <= 7e-83) {
tmp = d1 * -d3;
} else {
tmp = d1 * d4;
}
return tmp;
}
real(8) function code(d1, d2, d3, d4)
real(8), intent (in) :: d1
real(8), intent (in) :: d2
real(8), intent (in) :: d3
real(8), intent (in) :: d4
real(8) :: tmp
if (d2 <= (-1.3d+98)) then
tmp = d1 * d2
else if (d2 <= (-2.4d+70)) then
tmp = d1 * d4
else if (d2 <= (-1.14d+45)) then
tmp = d1 * d2
else if (d2 <= (-2.4d-25)) then
tmp = d1 * d4
else if (d2 <= (-4.2d-183)) then
tmp = -(d1 * d1)
else if (d2 <= 7d-83) then
tmp = d1 * -d3
else
tmp = d1 * d4
end if
code = tmp
end function
public static double code(double d1, double d2, double d3, double d4) {
double tmp;
if (d2 <= -1.3e+98) {
tmp = d1 * d2;
} else if (d2 <= -2.4e+70) {
tmp = d1 * d4;
} else if (d2 <= -1.14e+45) {
tmp = d1 * d2;
} else if (d2 <= -2.4e-25) {
tmp = d1 * d4;
} else if (d2 <= -4.2e-183) {
tmp = -(d1 * d1);
} else if (d2 <= 7e-83) {
tmp = d1 * -d3;
} else {
tmp = d1 * d4;
}
return tmp;
}
def code(d1, d2, d3, d4): tmp = 0 if d2 <= -1.3e+98: tmp = d1 * d2 elif d2 <= -2.4e+70: tmp = d1 * d4 elif d2 <= -1.14e+45: tmp = d1 * d2 elif d2 <= -2.4e-25: tmp = d1 * d4 elif d2 <= -4.2e-183: tmp = -(d1 * d1) elif d2 <= 7e-83: tmp = d1 * -d3 else: tmp = d1 * d4 return tmp
function code(d1, d2, d3, d4) tmp = 0.0 if (d2 <= -1.3e+98) tmp = Float64(d1 * d2); elseif (d2 <= -2.4e+70) tmp = Float64(d1 * d4); elseif (d2 <= -1.14e+45) tmp = Float64(d1 * d2); elseif (d2 <= -2.4e-25) tmp = Float64(d1 * d4); elseif (d2 <= -4.2e-183) tmp = Float64(-Float64(d1 * d1)); elseif (d2 <= 7e-83) tmp = Float64(d1 * Float64(-d3)); else tmp = Float64(d1 * d4); end return tmp end
function tmp_2 = code(d1, d2, d3, d4) tmp = 0.0; if (d2 <= -1.3e+98) tmp = d1 * d2; elseif (d2 <= -2.4e+70) tmp = d1 * d4; elseif (d2 <= -1.14e+45) tmp = d1 * d2; elseif (d2 <= -2.4e-25) tmp = d1 * d4; elseif (d2 <= -4.2e-183) tmp = -(d1 * d1); elseif (d2 <= 7e-83) tmp = d1 * -d3; else tmp = d1 * d4; end tmp_2 = tmp; end
code[d1_, d2_, d3_, d4_] := If[LessEqual[d2, -1.3e+98], N[(d1 * d2), $MachinePrecision], If[LessEqual[d2, -2.4e+70], N[(d1 * d4), $MachinePrecision], If[LessEqual[d2, -1.14e+45], N[(d1 * d2), $MachinePrecision], If[LessEqual[d2, -2.4e-25], N[(d1 * d4), $MachinePrecision], If[LessEqual[d2, -4.2e-183], (-N[(d1 * d1), $MachinePrecision]), If[LessEqual[d2, 7e-83], N[(d1 * (-d3)), $MachinePrecision], N[(d1 * d4), $MachinePrecision]]]]]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;d2 \leq -1.3 \cdot 10^{+98}:\\
\;\;\;\;d1 \cdot d2\\
\mathbf{elif}\;d2 \leq -2.4 \cdot 10^{+70}:\\
\;\;\;\;d1 \cdot d4\\
\mathbf{elif}\;d2 \leq -1.14 \cdot 10^{+45}:\\
\;\;\;\;d1 \cdot d2\\
\mathbf{elif}\;d2 \leq -2.4 \cdot 10^{-25}:\\
\;\;\;\;d1 \cdot d4\\
\mathbf{elif}\;d2 \leq -4.2 \cdot 10^{-183}:\\
\;\;\;\;-d1 \cdot d1\\
\mathbf{elif}\;d2 \leq 7 \cdot 10^{-83}:\\
\;\;\;\;d1 \cdot \left(-d3\right)\\
\mathbf{else}:\\
\;\;\;\;d1 \cdot d4\\
\end{array}
\end{array}
if d2 < -1.3e98 or -2.39999999999999987e70 < d2 < -1.1400000000000001e45Initial program 82.4%
associate--l+82.4%
distribute-lft-out--84.2%
distribute-rgt-out--87.7%
distribute-lft-out100.0%
Simplified100.0%
Taylor expanded in d2 around inf 71.9%
if -1.3e98 < d2 < -2.39999999999999987e70 or -1.1400000000000001e45 < d2 < -2.40000000000000009e-25 or 7.00000000000000061e-83 < d2 Initial program 89.3%
associate--l+89.3%
distribute-lft-out--91.5%
distribute-rgt-out--92.5%
distribute-lft-out100.0%
Simplified100.0%
Taylor expanded in d4 around inf 40.2%
if -2.40000000000000009e-25 < d2 < -4.2000000000000004e-183Initial program 93.1%
associate--l+93.1%
distribute-lft-out--93.1%
distribute-rgt-out--100.0%
distribute-lft-out100.0%
Simplified100.0%
Taylor expanded in d1 around inf 63.5%
unpow263.5%
mul-1-neg63.5%
distribute-rgt-neg-out63.5%
Simplified63.5%
if -4.2000000000000004e-183 < d2 < 7.00000000000000061e-83Initial program 92.1%
associate--l+92.1%
distribute-lft-out--92.1%
distribute-rgt-out--98.7%
distribute-lft-out100.0%
Simplified100.0%
Taylor expanded in d3 around inf 49.1%
associate-*r*49.1%
neg-mul-149.1%
*-commutative49.1%
Simplified49.1%
Final simplification52.5%
(FPCore (d1 d2 d3 d4)
:precision binary64
(if (<= d2 -1.3e+98)
(* d1 d2)
(if (<= d2 -1.25e+70)
(* d1 d4)
(if (<= d2 -2.7e+45)
(* d1 d2)
(if (<= d2 -2.5e-27)
(* d1 d4)
(if (<= d2 4.2e-51) (- (* d1 d1)) (* d1 d4)))))))
double code(double d1, double d2, double d3, double d4) {
double tmp;
if (d2 <= -1.3e+98) {
tmp = d1 * d2;
} else if (d2 <= -1.25e+70) {
tmp = d1 * d4;
} else if (d2 <= -2.7e+45) {
tmp = d1 * d2;
} else if (d2 <= -2.5e-27) {
tmp = d1 * d4;
} else if (d2 <= 4.2e-51) {
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 <= (-1.3d+98)) then
tmp = d1 * d2
else if (d2 <= (-1.25d+70)) then
tmp = d1 * d4
else if (d2 <= (-2.7d+45)) then
tmp = d1 * d2
else if (d2 <= (-2.5d-27)) then
tmp = d1 * d4
else if (d2 <= 4.2d-51) 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 <= -1.3e+98) {
tmp = d1 * d2;
} else if (d2 <= -1.25e+70) {
tmp = d1 * d4;
} else if (d2 <= -2.7e+45) {
tmp = d1 * d2;
} else if (d2 <= -2.5e-27) {
tmp = d1 * d4;
} else if (d2 <= 4.2e-51) {
tmp = -(d1 * d1);
} else {
tmp = d1 * d4;
}
return tmp;
}
def code(d1, d2, d3, d4): tmp = 0 if d2 <= -1.3e+98: tmp = d1 * d2 elif d2 <= -1.25e+70: tmp = d1 * d4 elif d2 <= -2.7e+45: tmp = d1 * d2 elif d2 <= -2.5e-27: tmp = d1 * d4 elif d2 <= 4.2e-51: tmp = -(d1 * d1) else: tmp = d1 * d4 return tmp
function code(d1, d2, d3, d4) tmp = 0.0 if (d2 <= -1.3e+98) tmp = Float64(d1 * d2); elseif (d2 <= -1.25e+70) tmp = Float64(d1 * d4); elseif (d2 <= -2.7e+45) tmp = Float64(d1 * d2); elseif (d2 <= -2.5e-27) tmp = Float64(d1 * d4); elseif (d2 <= 4.2e-51) 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 (d2 <= -1.3e+98) tmp = d1 * d2; elseif (d2 <= -1.25e+70) tmp = d1 * d4; elseif (d2 <= -2.7e+45) tmp = d1 * d2; elseif (d2 <= -2.5e-27) tmp = d1 * d4; elseif (d2 <= 4.2e-51) tmp = -(d1 * d1); else tmp = d1 * d4; end tmp_2 = tmp; end
code[d1_, d2_, d3_, d4_] := If[LessEqual[d2, -1.3e+98], N[(d1 * d2), $MachinePrecision], If[LessEqual[d2, -1.25e+70], N[(d1 * d4), $MachinePrecision], If[LessEqual[d2, -2.7e+45], N[(d1 * d2), $MachinePrecision], If[LessEqual[d2, -2.5e-27], N[(d1 * d4), $MachinePrecision], If[LessEqual[d2, 4.2e-51], (-N[(d1 * d1), $MachinePrecision]), N[(d1 * d4), $MachinePrecision]]]]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;d2 \leq -1.3 \cdot 10^{+98}:\\
\;\;\;\;d1 \cdot d2\\
\mathbf{elif}\;d2 \leq -1.25 \cdot 10^{+70}:\\
\;\;\;\;d1 \cdot d4\\
\mathbf{elif}\;d2 \leq -2.7 \cdot 10^{+45}:\\
\;\;\;\;d1 \cdot d2\\
\mathbf{elif}\;d2 \leq -2.5 \cdot 10^{-27}:\\
\;\;\;\;d1 \cdot d4\\
\mathbf{elif}\;d2 \leq 4.2 \cdot 10^{-51}:\\
\;\;\;\;-d1 \cdot d1\\
\mathbf{else}:\\
\;\;\;\;d1 \cdot d4\\
\end{array}
\end{array}
if d2 < -1.3e98 or -1.2500000000000001e70 < d2 < -2.69999999999999984e45Initial program 82.4%
associate--l+82.4%
distribute-lft-out--84.2%
distribute-rgt-out--87.7%
distribute-lft-out100.0%
Simplified100.0%
Taylor expanded in d2 around inf 71.9%
if -1.3e98 < d2 < -1.2500000000000001e70 or -2.69999999999999984e45 < d2 < -2.5000000000000001e-27 or 4.20000000000000003e-51 < d2 Initial program 89.7%
associate--l+89.7%
distribute-lft-out--92.0%
distribute-rgt-out--93.2%
distribute-lft-out100.0%
Simplified100.0%
Taylor expanded in d4 around inf 42.6%
if -2.5000000000000001e-27 < d2 < 4.20000000000000003e-51Initial program 91.9%
associate--l+91.9%
distribute-lft-out--91.9%
distribute-rgt-out--98.2%
distribute-lft-out100.0%
Simplified100.0%
Taylor expanded in d1 around inf 48.7%
unpow248.7%
mul-1-neg48.7%
distribute-rgt-neg-out48.7%
Simplified48.7%
Final simplification51.7%
(FPCore (d1 d2 d3 d4)
:precision binary64
(if (<= d2 -1.35e+98)
(* d1 (- d2 d3))
(if (<= d2 -5.1e-20)
(* d1 (+ d2 d4))
(if (<= d2 2.6e-151) (* d1 (- (+ d1 d3))) (* d1 (- d4 d3))))))
double code(double d1, double d2, double d3, double d4) {
double tmp;
if (d2 <= -1.35e+98) {
tmp = d1 * (d2 - d3);
} else if (d2 <= -5.1e-20) {
tmp = d1 * (d2 + d4);
} else if (d2 <= 2.6e-151) {
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.35d+98)) then
tmp = d1 * (d2 - d3)
else if (d2 <= (-5.1d-20)) then
tmp = d1 * (d2 + d4)
else if (d2 <= 2.6d-151) 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.35e+98) {
tmp = d1 * (d2 - d3);
} else if (d2 <= -5.1e-20) {
tmp = d1 * (d2 + d4);
} else if (d2 <= 2.6e-151) {
tmp = d1 * -(d1 + d3);
} else {
tmp = d1 * (d4 - d3);
}
return tmp;
}
def code(d1, d2, d3, d4): tmp = 0 if d2 <= -1.35e+98: tmp = d1 * (d2 - d3) elif d2 <= -5.1e-20: tmp = d1 * (d2 + d4) elif d2 <= 2.6e-151: tmp = d1 * -(d1 + d3) else: tmp = d1 * (d4 - d3) return tmp
function code(d1, d2, d3, d4) tmp = 0.0 if (d2 <= -1.35e+98) tmp = Float64(d1 * Float64(d2 - d3)); elseif (d2 <= -5.1e-20) tmp = Float64(d1 * Float64(d2 + d4)); elseif (d2 <= 2.6e-151) tmp = Float64(d1 * Float64(-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.35e+98) tmp = d1 * (d2 - d3); elseif (d2 <= -5.1e-20) tmp = d1 * (d2 + d4); elseif (d2 <= 2.6e-151) tmp = d1 * -(d1 + d3); else tmp = d1 * (d4 - d3); end tmp_2 = tmp; end
code[d1_, d2_, d3_, d4_] := If[LessEqual[d2, -1.35e+98], N[(d1 * N[(d2 - d3), $MachinePrecision]), $MachinePrecision], If[LessEqual[d2, -5.1e-20], N[(d1 * N[(d2 + d4), $MachinePrecision]), $MachinePrecision], If[LessEqual[d2, 2.6e-151], 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.35 \cdot 10^{+98}:\\
\;\;\;\;d1 \cdot \left(d2 - d3\right)\\
\mathbf{elif}\;d2 \leq -5.1 \cdot 10^{-20}:\\
\;\;\;\;d1 \cdot \left(d2 + d4\right)\\
\mathbf{elif}\;d2 \leq 2.6 \cdot 10^{-151}:\\
\;\;\;\;d1 \cdot \left(-\left(d1 + d3\right)\right)\\
\mathbf{else}:\\
\;\;\;\;d1 \cdot \left(d4 - d3\right)\\
\end{array}
\end{array}
if d2 < -1.35e98Initial program 81.2%
associate--l+81.2%
distribute-lft-out--83.3%
distribute-rgt-out--87.4%
distribute-lft-out100.0%
Simplified100.0%
Taylor expanded in d4 around 0 95.0%
Taylor expanded in d1 around 0 86.9%
if -1.35e98 < d2 < -5.10000000000000019e-20Initial program 87.5%
associate--l+87.5%
distribute-lft-out--90.6%
distribute-rgt-out--90.6%
distribute-lft-out100.0%
Simplified100.0%
Taylor expanded in d1 around 0 88.2%
Taylor expanded in d3 around 0 76.1%
if -5.10000000000000019e-20 < d2 < 2.6e-151Initial program 92.2%
associate--l+92.2%
distribute-lft-out--92.2%
distribute-rgt-out--98.9%
distribute-lft-out100.0%
Simplified100.0%
Taylor expanded in d4 around 0 78.0%
Taylor expanded in d2 around 0 78.0%
mul-1-neg78.0%
*-commutative78.0%
distribute-rgt-neg-out78.0%
neg-sub078.0%
+-commutative78.0%
associate--r+78.0%
neg-sub078.0%
Simplified78.0%
if 2.6e-151 < d2 Initial program 90.7%
associate--l+90.7%
distribute-lft-out--91.8%
distribute-rgt-out--94.2%
distribute-lft-out100.0%
Simplified100.0%
Taylor expanded in d1 around 0 84.0%
Taylor expanded in d2 around 0 59.2%
Final simplification73.1%
(FPCore (d1 d2 d3 d4)
:precision binary64
(if (<= d2 -1.5e+98)
(* d1 (- d2 d3))
(if (<= d2 -3.8e-27)
(* d1 (+ d2 d4))
(if (<= d2 -2.4e-181) (* d1 (- d2 d1)) (* d1 (- d4 d3))))))
double code(double d1, double d2, double d3, double d4) {
double tmp;
if (d2 <= -1.5e+98) {
tmp = d1 * (d2 - d3);
} else if (d2 <= -3.8e-27) {
tmp = d1 * (d2 + d4);
} else if (d2 <= -2.4e-181) {
tmp = d1 * (d2 - 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 (d2 <= (-1.5d+98)) then
tmp = d1 * (d2 - d3)
else if (d2 <= (-3.8d-27)) then
tmp = d1 * (d2 + d4)
else if (d2 <= (-2.4d-181)) then
tmp = d1 * (d2 - 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 (d2 <= -1.5e+98) {
tmp = d1 * (d2 - d3);
} else if (d2 <= -3.8e-27) {
tmp = d1 * (d2 + d4);
} else if (d2 <= -2.4e-181) {
tmp = d1 * (d2 - d1);
} else {
tmp = d1 * (d4 - d3);
}
return tmp;
}
def code(d1, d2, d3, d4): tmp = 0 if d2 <= -1.5e+98: tmp = d1 * (d2 - d3) elif d2 <= -3.8e-27: tmp = d1 * (d2 + d4) elif d2 <= -2.4e-181: tmp = d1 * (d2 - d1) else: tmp = d1 * (d4 - d3) return tmp
function code(d1, d2, d3, d4) tmp = 0.0 if (d2 <= -1.5e+98) tmp = Float64(d1 * Float64(d2 - d3)); elseif (d2 <= -3.8e-27) tmp = Float64(d1 * Float64(d2 + d4)); elseif (d2 <= -2.4e-181) tmp = Float64(d1 * Float64(d2 - d1)); 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.5e+98) tmp = d1 * (d2 - d3); elseif (d2 <= -3.8e-27) tmp = d1 * (d2 + d4); elseif (d2 <= -2.4e-181) tmp = d1 * (d2 - d1); else tmp = d1 * (d4 - d3); end tmp_2 = tmp; end
code[d1_, d2_, d3_, d4_] := If[LessEqual[d2, -1.5e+98], N[(d1 * N[(d2 - d3), $MachinePrecision]), $MachinePrecision], If[LessEqual[d2, -3.8e-27], N[(d1 * N[(d2 + d4), $MachinePrecision]), $MachinePrecision], If[LessEqual[d2, -2.4e-181], N[(d1 * N[(d2 - d1), $MachinePrecision]), $MachinePrecision], N[(d1 * N[(d4 - d3), $MachinePrecision]), $MachinePrecision]]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;d2 \leq -1.5 \cdot 10^{+98}:\\
\;\;\;\;d1 \cdot \left(d2 - d3\right)\\
\mathbf{elif}\;d2 \leq -3.8 \cdot 10^{-27}:\\
\;\;\;\;d1 \cdot \left(d2 + d4\right)\\
\mathbf{elif}\;d2 \leq -2.4 \cdot 10^{-181}:\\
\;\;\;\;d1 \cdot \left(d2 - d1\right)\\
\mathbf{else}:\\
\;\;\;\;d1 \cdot \left(d4 - d3\right)\\
\end{array}
\end{array}
if d2 < -1.5000000000000001e98Initial program 81.2%
associate--l+81.2%
distribute-lft-out--83.3%
distribute-rgt-out--87.4%
distribute-lft-out100.0%
Simplified100.0%
Taylor expanded in d4 around 0 95.0%
Taylor expanded in d1 around 0 86.9%
if -1.5000000000000001e98 < d2 < -3.8e-27Initial program 87.8%
associate--l+87.8%
distribute-lft-out--90.9%
distribute-rgt-out--90.9%
distribute-lft-out100.0%
Simplified100.0%
Taylor expanded in d1 around 0 88.5%
Taylor expanded in d3 around 0 76.9%
if -3.8e-27 < d2 < -2.4000000000000001e-181Initial program 93.1%
associate--l+93.1%
distribute-lft-out--93.1%
distribute-rgt-out--100.0%
distribute-lft-out100.0%
Simplified100.0%
Taylor expanded in d4 around 0 79.9%
Taylor expanded in d3 around 0 63.5%
if -2.4000000000000001e-181 < d2 Initial program 91.1%
associate--l+91.1%
distribute-lft-out--91.8%
distribute-rgt-out--95.9%
distribute-lft-out100.0%
Simplified100.0%
Taylor expanded in d1 around 0 76.0%
Taylor expanded in d2 around 0 61.4%
Final simplification68.4%
(FPCore (d1 d2 d3 d4) :precision binary64 (if (or (<= d1 -5.1e+123) (not (<= d1 8e+107))) (* d1 (- (+ d1 d3))) (* d1 (- (+ d2 d4) d3))))
double code(double d1, double d2, double d3, double d4) {
double tmp;
if ((d1 <= -5.1e+123) || !(d1 <= 8e+107)) {
tmp = d1 * -(d1 + d3);
} else {
tmp = d1 * ((d2 + 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 ((d1 <= (-5.1d+123)) .or. (.not. (d1 <= 8d+107))) then
tmp = d1 * -(d1 + d3)
else
tmp = d1 * ((d2 + d4) - d3)
end if
code = tmp
end function
public static double code(double d1, double d2, double d3, double d4) {
double tmp;
if ((d1 <= -5.1e+123) || !(d1 <= 8e+107)) {
tmp = d1 * -(d1 + d3);
} else {
tmp = d1 * ((d2 + d4) - d3);
}
return tmp;
}
def code(d1, d2, d3, d4): tmp = 0 if (d1 <= -5.1e+123) or not (d1 <= 8e+107): tmp = d1 * -(d1 + d3) else: tmp = d1 * ((d2 + d4) - d3) return tmp
function code(d1, d2, d3, d4) tmp = 0.0 if ((d1 <= -5.1e+123) || !(d1 <= 8e+107)) tmp = Float64(d1 * Float64(-Float64(d1 + d3))); else tmp = Float64(d1 * Float64(Float64(d2 + d4) - d3)); end return tmp end
function tmp_2 = code(d1, d2, d3, d4) tmp = 0.0; if ((d1 <= -5.1e+123) || ~((d1 <= 8e+107))) tmp = d1 * -(d1 + d3); else tmp = d1 * ((d2 + d4) - d3); end tmp_2 = tmp; end
code[d1_, d2_, d3_, d4_] := If[Or[LessEqual[d1, -5.1e+123], N[Not[LessEqual[d1, 8e+107]], $MachinePrecision]], N[(d1 * (-N[(d1 + d3), $MachinePrecision])), $MachinePrecision], N[(d1 * N[(N[(d2 + d4), $MachinePrecision] - d3), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;d1 \leq -5.1 \cdot 10^{+123} \lor \neg \left(d1 \leq 8 \cdot 10^{+107}\right):\\
\;\;\;\;d1 \cdot \left(-\left(d1 + d3\right)\right)\\
\mathbf{else}:\\
\;\;\;\;d1 \cdot \left(\left(d2 + d4\right) - d3\right)\\
\end{array}
\end{array}
if d1 < -5.09999999999999972e123 or 7.9999999999999998e107 < d1 Initial program 65.4%
associate--l+65.4%
distribute-lft-out--69.2%
distribute-rgt-out--82.1%
distribute-lft-out100.0%
Simplified100.0%
Taylor expanded in d4 around 0 97.2%
Taylor expanded in d2 around 0 94.6%
mul-1-neg94.6%
*-commutative94.6%
distribute-rgt-neg-out94.6%
neg-sub094.6%
+-commutative94.6%
associate--r+94.6%
neg-sub094.6%
Simplified94.6%
if -5.09999999999999972e123 < d1 < 7.9999999999999998e107Initial program 99.4%
associate--l+99.4%
distribute-lft-out--99.4%
distribute-rgt-out--99.4%
distribute-lft-out100.0%
Simplified100.0%
Taylor expanded in d1 around 0 92.6%
Final simplification93.2%
(FPCore (d1 d2 d3 d4) :precision binary64 (if (or (<= d1 -5.2e+98) (not (<= d1 7.5e+93))) (* d1 (- d2 (+ d1 d3))) (* d1 (- (+ d2 d4) d3))))
double code(double d1, double d2, double d3, double d4) {
double tmp;
if ((d1 <= -5.2e+98) || !(d1 <= 7.5e+93)) {
tmp = d1 * (d2 - (d1 + d3));
} else {
tmp = d1 * ((d2 + 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 ((d1 <= (-5.2d+98)) .or. (.not. (d1 <= 7.5d+93))) then
tmp = d1 * (d2 - (d1 + d3))
else
tmp = d1 * ((d2 + d4) - d3)
end if
code = tmp
end function
public static double code(double d1, double d2, double d3, double d4) {
double tmp;
if ((d1 <= -5.2e+98) || !(d1 <= 7.5e+93)) {
tmp = d1 * (d2 - (d1 + d3));
} else {
tmp = d1 * ((d2 + d4) - d3);
}
return tmp;
}
def code(d1, d2, d3, d4): tmp = 0 if (d1 <= -5.2e+98) or not (d1 <= 7.5e+93): tmp = d1 * (d2 - (d1 + d3)) else: tmp = d1 * ((d2 + d4) - d3) return tmp
function code(d1, d2, d3, d4) tmp = 0.0 if ((d1 <= -5.2e+98) || !(d1 <= 7.5e+93)) tmp = Float64(d1 * Float64(d2 - Float64(d1 + d3))); else tmp = Float64(d1 * Float64(Float64(d2 + d4) - d3)); end return tmp end
function tmp_2 = code(d1, d2, d3, d4) tmp = 0.0; if ((d1 <= -5.2e+98) || ~((d1 <= 7.5e+93))) tmp = d1 * (d2 - (d1 + d3)); else tmp = d1 * ((d2 + d4) - d3); end tmp_2 = tmp; end
code[d1_, d2_, d3_, d4_] := If[Or[LessEqual[d1, -5.2e+98], N[Not[LessEqual[d1, 7.5e+93]], $MachinePrecision]], N[(d1 * N[(d2 - N[(d1 + d3), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(d1 * N[(N[(d2 + d4), $MachinePrecision] - d3), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;d1 \leq -5.2 \cdot 10^{+98} \lor \neg \left(d1 \leq 7.5 \cdot 10^{+93}\right):\\
\;\;\;\;d1 \cdot \left(d2 - \left(d1 + d3\right)\right)\\
\mathbf{else}:\\
\;\;\;\;d1 \cdot \left(\left(d2 + d4\right) - d3\right)\\
\end{array}
\end{array}
if d1 < -5.1999999999999999e98 or 7.5000000000000002e93 < d1 Initial program 69.2%
associate--l+69.2%
distribute-lft-out--72.5%
distribute-rgt-out--83.5%
distribute-lft-out100.0%
Simplified100.0%
Taylor expanded in d4 around 0 95.4%
if -5.1999999999999999e98 < d1 < 7.5000000000000002e93Initial 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 d1 around 0 94.3%
Final simplification94.7%
(FPCore (d1 d2 d3 d4) :precision binary64 (if (or (<= d2 -1.2e+98) (and (not (<= d2 -9.5e+69)) (<= d2 -2.5e+45))) (* d1 d2) (* d1 d4)))
double code(double d1, double d2, double d3, double d4) {
double tmp;
if ((d2 <= -1.2e+98) || (!(d2 <= -9.5e+69) && (d2 <= -2.5e+45))) {
tmp = d1 * d2;
} else {
tmp = d1 * d4;
}
return tmp;
}
real(8) function code(d1, d2, d3, d4)
real(8), intent (in) :: d1
real(8), intent (in) :: d2
real(8), intent (in) :: d3
real(8), intent (in) :: d4
real(8) :: tmp
if ((d2 <= (-1.2d+98)) .or. (.not. (d2 <= (-9.5d+69))) .and. (d2 <= (-2.5d+45))) then
tmp = d1 * d2
else
tmp = d1 * d4
end if
code = tmp
end function
public static double code(double d1, double d2, double d3, double d4) {
double tmp;
if ((d2 <= -1.2e+98) || (!(d2 <= -9.5e+69) && (d2 <= -2.5e+45))) {
tmp = d1 * d2;
} else {
tmp = d1 * d4;
}
return tmp;
}
def code(d1, d2, d3, d4): tmp = 0 if (d2 <= -1.2e+98) or (not (d2 <= -9.5e+69) and (d2 <= -2.5e+45)): tmp = d1 * d2 else: tmp = d1 * d4 return tmp
function code(d1, d2, d3, d4) tmp = 0.0 if ((d2 <= -1.2e+98) || (!(d2 <= -9.5e+69) && (d2 <= -2.5e+45))) tmp = Float64(d1 * d2); else tmp = Float64(d1 * d4); end return tmp end
function tmp_2 = code(d1, d2, d3, d4) tmp = 0.0; if ((d2 <= -1.2e+98) || (~((d2 <= -9.5e+69)) && (d2 <= -2.5e+45))) tmp = d1 * d2; else tmp = d1 * d4; end tmp_2 = tmp; end
code[d1_, d2_, d3_, d4_] := If[Or[LessEqual[d2, -1.2e+98], And[N[Not[LessEqual[d2, -9.5e+69]], $MachinePrecision], LessEqual[d2, -2.5e+45]]], N[(d1 * d2), $MachinePrecision], N[(d1 * d4), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;d2 \leq -1.2 \cdot 10^{+98} \lor \neg \left(d2 \leq -9.5 \cdot 10^{+69}\right) \land d2 \leq -2.5 \cdot 10^{+45}:\\
\;\;\;\;d1 \cdot d2\\
\mathbf{else}:\\
\;\;\;\;d1 \cdot d4\\
\end{array}
\end{array}
if d2 < -1.1999999999999999e98 or -9.4999999999999995e69 < d2 < -2.5e45Initial program 82.4%
associate--l+82.4%
distribute-lft-out--84.2%
distribute-rgt-out--87.7%
distribute-lft-out100.0%
Simplified100.0%
Taylor expanded in d2 around inf 71.9%
if -1.1999999999999999e98 < d2 < -9.4999999999999995e69 or -2.5e45 < d2 Initial program 90.9%
associate--l+90.9%
distribute-lft-out--91.9%
distribute-rgt-out--96.0%
distribute-lft-out100.0%
Simplified100.0%
Taylor expanded in d4 around inf 35.5%
Final simplification43.6%
(FPCore (d1 d2 d3 d4) :precision binary64 (if (or (<= d1 -5e+144) (not (<= d1 7.8e+110))) (- (* d1 d1)) (* d1 (+ d2 d4))))
double code(double d1, double d2, double d3, double d4) {
double tmp;
if ((d1 <= -5e+144) || !(d1 <= 7.8e+110)) {
tmp = -(d1 * d1);
} 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) :: tmp
if ((d1 <= (-5d+144)) .or. (.not. (d1 <= 7.8d+110))) then
tmp = -(d1 * d1)
else
tmp = d1 * (d2 + d4)
end if
code = tmp
end function
public static double code(double d1, double d2, double d3, double d4) {
double tmp;
if ((d1 <= -5e+144) || !(d1 <= 7.8e+110)) {
tmp = -(d1 * d1);
} else {
tmp = d1 * (d2 + d4);
}
return tmp;
}
def code(d1, d2, d3, d4): tmp = 0 if (d1 <= -5e+144) or not (d1 <= 7.8e+110): tmp = -(d1 * d1) else: tmp = d1 * (d2 + d4) return tmp
function code(d1, d2, d3, d4) tmp = 0.0 if ((d1 <= -5e+144) || !(d1 <= 7.8e+110)) tmp = Float64(-Float64(d1 * d1)); else tmp = Float64(d1 * Float64(d2 + d4)); end return tmp end
function tmp_2 = code(d1, d2, d3, d4) tmp = 0.0; if ((d1 <= -5e+144) || ~((d1 <= 7.8e+110))) tmp = -(d1 * d1); else tmp = d1 * (d2 + d4); end tmp_2 = tmp; end
code[d1_, d2_, d3_, d4_] := If[Or[LessEqual[d1, -5e+144], N[Not[LessEqual[d1, 7.8e+110]], $MachinePrecision]], (-N[(d1 * d1), $MachinePrecision]), N[(d1 * N[(d2 + d4), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;d1 \leq -5 \cdot 10^{+144} \lor \neg \left(d1 \leq 7.8 \cdot 10^{+110}\right):\\
\;\;\;\;-d1 \cdot d1\\
\mathbf{else}:\\
\;\;\;\;d1 \cdot \left(d2 + d4\right)\\
\end{array}
\end{array}
if d1 < -4.9999999999999999e144 or 7.8000000000000007e110 < d1 Initial program 62.5%
associate--l+62.5%
distribute-lft-out--66.7%
distribute-rgt-out--80.6%
distribute-lft-out100.0%
Simplified100.0%
Taylor expanded in d1 around inf 87.5%
unpow287.5%
mul-1-neg87.5%
distribute-rgt-neg-out87.5%
Simplified87.5%
if -4.9999999999999999e144 < d1 < 7.8000000000000007e110Initial program 99.4%
associate--l+99.4%
distribute-lft-out--99.4%
distribute-rgt-out--99.4%
distribute-lft-out100.0%
Simplified100.0%
Taylor expanded in d1 around 0 91.7%
Taylor expanded in d3 around 0 63.2%
Final simplification70.0%
(FPCore (d1 d2 d3 d4) :precision binary64 (if (or (<= d1 -5e+98) (not (<= d1 6.5e+95))) (* d1 (- d2 d1)) (* d1 (+ d2 d4))))
double code(double d1, double d2, double d3, double d4) {
double tmp;
if ((d1 <= -5e+98) || !(d1 <= 6.5e+95)) {
tmp = d1 * (d2 - d1);
} 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) :: tmp
if ((d1 <= (-5d+98)) .or. (.not. (d1 <= 6.5d+95))) then
tmp = d1 * (d2 - d1)
else
tmp = d1 * (d2 + d4)
end if
code = tmp
end function
public static double code(double d1, double d2, double d3, double d4) {
double tmp;
if ((d1 <= -5e+98) || !(d1 <= 6.5e+95)) {
tmp = d1 * (d2 - d1);
} else {
tmp = d1 * (d2 + d4);
}
return tmp;
}
def code(d1, d2, d3, d4): tmp = 0 if (d1 <= -5e+98) or not (d1 <= 6.5e+95): tmp = d1 * (d2 - d1) else: tmp = d1 * (d2 + d4) return tmp
function code(d1, d2, d3, d4) tmp = 0.0 if ((d1 <= -5e+98) || !(d1 <= 6.5e+95)) tmp = Float64(d1 * Float64(d2 - d1)); else tmp = Float64(d1 * Float64(d2 + d4)); end return tmp end
function tmp_2 = code(d1, d2, d3, d4) tmp = 0.0; if ((d1 <= -5e+98) || ~((d1 <= 6.5e+95))) tmp = d1 * (d2 - d1); else tmp = d1 * (d2 + d4); end tmp_2 = tmp; end
code[d1_, d2_, d3_, d4_] := If[Or[LessEqual[d1, -5e+98], N[Not[LessEqual[d1, 6.5e+95]], $MachinePrecision]], N[(d1 * N[(d2 - d1), $MachinePrecision]), $MachinePrecision], N[(d1 * N[(d2 + d4), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;d1 \leq -5 \cdot 10^{+98} \lor \neg \left(d1 \leq 6.5 \cdot 10^{+95}\right):\\
\;\;\;\;d1 \cdot \left(d2 - d1\right)\\
\mathbf{else}:\\
\;\;\;\;d1 \cdot \left(d2 + d4\right)\\
\end{array}
\end{array}
if d1 < -4.9999999999999998e98 or 6.5e95 < d1 Initial program 69.2%
associate--l+69.2%
distribute-lft-out--72.5%
distribute-rgt-out--83.5%
distribute-lft-out100.0%
Simplified100.0%
Taylor expanded in d4 around 0 95.4%
Taylor expanded in d3 around 0 88.2%
if -4.9999999999999998e98 < d1 < 6.5e95Initial 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 d1 around 0 94.3%
Taylor expanded in d3 around 0 64.2%
Final simplification72.7%
(FPCore (d1 d2 d3 d4) :precision binary64 (* d1 d4))
double code(double d1, double d2, double d3, double d4) {
return d1 * d4;
}
real(8) function code(d1, d2, d3, d4)
real(8), intent (in) :: d1
real(8), intent (in) :: d2
real(8), intent (in) :: d3
real(8), intent (in) :: d4
code = d1 * d4
end function
public static double code(double d1, double d2, double d3, double d4) {
return d1 * d4;
}
def code(d1, d2, d3, d4): return d1 * d4
function code(d1, d2, d3, d4) return Float64(d1 * d4) end
function tmp = code(d1, d2, d3, d4) tmp = d1 * d4; end
code[d1_, d2_, d3_, d4_] := N[(d1 * d4), $MachinePrecision]
\begin{array}{l}
\\
d1 \cdot d4
\end{array}
Initial program 89.0%
associate--l+89.0%
distribute-lft-out--90.2%
distribute-rgt-out--94.1%
distribute-lft-out100.0%
Simplified100.0%
Taylor expanded in d4 around inf 30.6%
Final simplification30.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 2023189
(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)))