
(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 (+ (- 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.8%
associate--l+89.8%
distribute-lft-out--90.6%
distribute-rgt-out--93.0%
distribute-lft-out100.0%
Simplified100.0%
Final simplification100.0%
(FPCore (d1 d2 d3 d4)
:precision binary64
(let* ((t_0 (* d1 (- d3))))
(if (<= d2 -4.6e+66)
(* d1 d2)
(if (<= d2 -2.7e+37)
t_0
(if (<= d2 -6.6e+36)
(* d1 d2)
(if (<= d2 -7.5e-139)
(* d1 (- d1))
(if (or (<= d2 -6.9e-168) (not (<= d2 8.5e-225)))
(* d1 d4)
t_0)))))))
double code(double d1, double d2, double d3, double d4) {
double t_0 = d1 * -d3;
double tmp;
if (d2 <= -4.6e+66) {
tmp = d1 * d2;
} else if (d2 <= -2.7e+37) {
tmp = t_0;
} else if (d2 <= -6.6e+36) {
tmp = d1 * d2;
} else if (d2 <= -7.5e-139) {
tmp = d1 * -d1;
} else if ((d2 <= -6.9e-168) || !(d2 <= 8.5e-225)) {
tmp = d1 * 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 * -d3
if (d2 <= (-4.6d+66)) then
tmp = d1 * d2
else if (d2 <= (-2.7d+37)) then
tmp = t_0
else if (d2 <= (-6.6d+36)) then
tmp = d1 * d2
else if (d2 <= (-7.5d-139)) then
tmp = d1 * -d1
else if ((d2 <= (-6.9d-168)) .or. (.not. (d2 <= 8.5d-225))) then
tmp = d1 * 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 * -d3;
double tmp;
if (d2 <= -4.6e+66) {
tmp = d1 * d2;
} else if (d2 <= -2.7e+37) {
tmp = t_0;
} else if (d2 <= -6.6e+36) {
tmp = d1 * d2;
} else if (d2 <= -7.5e-139) {
tmp = d1 * -d1;
} else if ((d2 <= -6.9e-168) || !(d2 <= 8.5e-225)) {
tmp = d1 * d4;
} else {
tmp = t_0;
}
return tmp;
}
def code(d1, d2, d3, d4): t_0 = d1 * -d3 tmp = 0 if d2 <= -4.6e+66: tmp = d1 * d2 elif d2 <= -2.7e+37: tmp = t_0 elif d2 <= -6.6e+36: tmp = d1 * d2 elif d2 <= -7.5e-139: tmp = d1 * -d1 elif (d2 <= -6.9e-168) or not (d2 <= 8.5e-225): tmp = d1 * d4 else: tmp = t_0 return tmp
function code(d1, d2, d3, d4) t_0 = Float64(d1 * Float64(-d3)) tmp = 0.0 if (d2 <= -4.6e+66) tmp = Float64(d1 * d2); elseif (d2 <= -2.7e+37) tmp = t_0; elseif (d2 <= -6.6e+36) tmp = Float64(d1 * d2); elseif (d2 <= -7.5e-139) tmp = Float64(d1 * Float64(-d1)); elseif ((d2 <= -6.9e-168) || !(d2 <= 8.5e-225)) tmp = Float64(d1 * d4); else tmp = t_0; end return tmp end
function tmp_2 = code(d1, d2, d3, d4) t_0 = d1 * -d3; tmp = 0.0; if (d2 <= -4.6e+66) tmp = d1 * d2; elseif (d2 <= -2.7e+37) tmp = t_0; elseif (d2 <= -6.6e+36) tmp = d1 * d2; elseif (d2 <= -7.5e-139) tmp = d1 * -d1; elseif ((d2 <= -6.9e-168) || ~((d2 <= 8.5e-225))) tmp = d1 * d4; else tmp = t_0; end tmp_2 = tmp; end
code[d1_, d2_, d3_, d4_] := Block[{t$95$0 = N[(d1 * (-d3)), $MachinePrecision]}, If[LessEqual[d2, -4.6e+66], N[(d1 * d2), $MachinePrecision], If[LessEqual[d2, -2.7e+37], t$95$0, If[LessEqual[d2, -6.6e+36], N[(d1 * d2), $MachinePrecision], If[LessEqual[d2, -7.5e-139], N[(d1 * (-d1)), $MachinePrecision], If[Or[LessEqual[d2, -6.9e-168], N[Not[LessEqual[d2, 8.5e-225]], $MachinePrecision]], N[(d1 * d4), $MachinePrecision], t$95$0]]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := d1 \cdot \left(-d3\right)\\
\mathbf{if}\;d2 \leq -4.6 \cdot 10^{+66}:\\
\;\;\;\;d1 \cdot d2\\
\mathbf{elif}\;d2 \leq -2.7 \cdot 10^{+37}:\\
\;\;\;\;t\_0\\
\mathbf{elif}\;d2 \leq -6.6 \cdot 10^{+36}:\\
\;\;\;\;d1 \cdot d2\\
\mathbf{elif}\;d2 \leq -7.5 \cdot 10^{-139}:\\
\;\;\;\;d1 \cdot \left(-d1\right)\\
\mathbf{elif}\;d2 \leq -6.9 \cdot 10^{-168} \lor \neg \left(d2 \leq 8.5 \cdot 10^{-225}\right):\\
\;\;\;\;d1 \cdot d4\\
\mathbf{else}:\\
\;\;\;\;t\_0\\
\end{array}
\end{array}
if d2 < -4.6e66 or -2.69999999999999986e37 < d2 < -6.5999999999999997e36Initial program 86.2%
associate--l+86.2%
distribute-lft-out--88.2%
distribute-rgt-out--88.2%
distribute-lft-out100.0%
Simplified100.0%
Taylor expanded in d2 around inf 80.7%
if -4.6e66 < d2 < -2.69999999999999986e37 or -6.9e-168 < d2 < 8.4999999999999998e-225Initial program 92.4%
associate--l+92.4%
distribute-lft-out--92.4%
distribute-rgt-out--93.9%
distribute-lft-out100.0%
Simplified100.0%
Taylor expanded in d3 around inf 59.3%
associate-*r*59.3%
neg-mul-159.3%
Simplified59.3%
if -6.5999999999999997e36 < d2 < -7.5000000000000001e-139Initial 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 inf 45.1%
neg-mul-145.1%
Simplified45.1%
if -7.5000000000000001e-139 < d2 < -6.9e-168 or 8.4999999999999998e-225 < d2 Initial program 87.5%
associate--l+87.5%
distribute-lft-out--88.4%
distribute-rgt-out--92.8%
distribute-lft-out100.0%
Simplified100.0%
Taylor expanded in d4 around inf 31.7%
Final simplification50.0%
(FPCore (d1 d2 d3 d4)
:precision binary64
(if (<= d2 -1.8e+52)
(* d1 (- d2 d3))
(if (<= d2 -3.7e-150)
(* d1 (- (- d3) d1))
(if (or (<= d2 -1.12e-278) (and (not (<= d2 3.25e-170)) (<= d2 9.6e-88)))
(* d1 (- d4 d1))
(* d1 (- d4 d3))))))
double code(double d1, double d2, double d3, double d4) {
double tmp;
if (d2 <= -1.8e+52) {
tmp = d1 * (d2 - d3);
} else if (d2 <= -3.7e-150) {
tmp = d1 * (-d3 - d1);
} else if ((d2 <= -1.12e-278) || (!(d2 <= 3.25e-170) && (d2 <= 9.6e-88))) {
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 (d2 <= (-1.8d+52)) then
tmp = d1 * (d2 - d3)
else if (d2 <= (-3.7d-150)) then
tmp = d1 * (-d3 - d1)
else if ((d2 <= (-1.12d-278)) .or. (.not. (d2 <= 3.25d-170)) .and. (d2 <= 9.6d-88)) 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 (d2 <= -1.8e+52) {
tmp = d1 * (d2 - d3);
} else if (d2 <= -3.7e-150) {
tmp = d1 * (-d3 - d1);
} else if ((d2 <= -1.12e-278) || (!(d2 <= 3.25e-170) && (d2 <= 9.6e-88))) {
tmp = d1 * (d4 - d1);
} else {
tmp = d1 * (d4 - d3);
}
return tmp;
}
def code(d1, d2, d3, d4): tmp = 0 if d2 <= -1.8e+52: tmp = d1 * (d2 - d3) elif d2 <= -3.7e-150: tmp = d1 * (-d3 - d1) elif (d2 <= -1.12e-278) or (not (d2 <= 3.25e-170) and (d2 <= 9.6e-88)): tmp = d1 * (d4 - d1) else: tmp = d1 * (d4 - d3) return tmp
function code(d1, d2, d3, d4) tmp = 0.0 if (d2 <= -1.8e+52) tmp = Float64(d1 * Float64(d2 - d3)); elseif (d2 <= -3.7e-150) tmp = Float64(d1 * Float64(Float64(-d3) - d1)); elseif ((d2 <= -1.12e-278) || (!(d2 <= 3.25e-170) && (d2 <= 9.6e-88))) 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 (d2 <= -1.8e+52) tmp = d1 * (d2 - d3); elseif (d2 <= -3.7e-150) tmp = d1 * (-d3 - d1); elseif ((d2 <= -1.12e-278) || (~((d2 <= 3.25e-170)) && (d2 <= 9.6e-88))) tmp = d1 * (d4 - d1); else tmp = d1 * (d4 - d3); end tmp_2 = tmp; end
code[d1_, d2_, d3_, d4_] := If[LessEqual[d2, -1.8e+52], N[(d1 * N[(d2 - d3), $MachinePrecision]), $MachinePrecision], If[LessEqual[d2, -3.7e-150], N[(d1 * N[((-d3) - d1), $MachinePrecision]), $MachinePrecision], If[Or[LessEqual[d2, -1.12e-278], And[N[Not[LessEqual[d2, 3.25e-170]], $MachinePrecision], LessEqual[d2, 9.6e-88]]], N[(d1 * N[(d4 - d1), $MachinePrecision]), $MachinePrecision], N[(d1 * N[(d4 - d3), $MachinePrecision]), $MachinePrecision]]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;d2 \leq -1.8 \cdot 10^{+52}:\\
\;\;\;\;d1 \cdot \left(d2 - d3\right)\\
\mathbf{elif}\;d2 \leq -3.7 \cdot 10^{-150}:\\
\;\;\;\;d1 \cdot \left(\left(-d3\right) - d1\right)\\
\mathbf{elif}\;d2 \leq -1.12 \cdot 10^{-278} \lor \neg \left(d2 \leq 3.25 \cdot 10^{-170}\right) \land d2 \leq 9.6 \cdot 10^{-88}:\\
\;\;\;\;d1 \cdot \left(d4 - d1\right)\\
\mathbf{else}:\\
\;\;\;\;d1 \cdot \left(d4 - d3\right)\\
\end{array}
\end{array}
if d2 < -1.8e52Initial program 87.0%
associate--l+87.0%
distribute-lft-out--88.9%
distribute-rgt-out--88.9%
distribute-lft-out100.0%
Simplified100.0%
Taylor expanded in d1 around 0 94.4%
Taylor expanded in d4 around 0 83.5%
if -1.8e52 < d2 < -3.70000000000000001e-150Initial 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 d2 around 0 92.1%
Taylor expanded in d4 around 0 76.0%
associate-*r*76.0%
neg-mul-176.0%
Simplified76.0%
if -3.70000000000000001e-150 < d2 < -1.12e-278 or 3.25000000000000018e-170 < d2 < 9.5999999999999998e-88Initial program 93.5%
associate--l+93.5%
distribute-lft-out--93.5%
distribute-rgt-out--96.7%
distribute-lft-out100.0%
Simplified100.0%
Taylor expanded in d3 around 0 75.8%
Taylor expanded in d2 around 0 75.8%
if -1.12e-278 < d2 < 3.25000000000000018e-170 or 9.5999999999999998e-88 < d2 Initial program 87.5%
associate--l+87.5%
distribute-lft-out--88.2%
distribute-rgt-out--91.9%
distribute-lft-out100.0%
Simplified100.0%
Taylor expanded in d2 around 0 77.1%
Taylor expanded in d1 around 0 63.4%
Final simplification70.8%
(FPCore (d1 d2 d3 d4)
:precision binary64
(let* ((t_0 (* d1 (- d2 d1))) (t_1 (* d1 (- d3))))
(if (<= d4 2.8e-140)
t_0
(if (<= d4 1.55e-122)
t_1
(if (<= d4 1.55e-46)
t_0
(if (<= d4 5.5e-40)
t_1
(if (<= d4 34000000000000.0) t_0 (* d1 (+ d2 d4)))))))))
double code(double d1, double d2, double d3, double d4) {
double t_0 = d1 * (d2 - d1);
double t_1 = d1 * -d3;
double tmp;
if (d4 <= 2.8e-140) {
tmp = t_0;
} else if (d4 <= 1.55e-122) {
tmp = t_1;
} else if (d4 <= 1.55e-46) {
tmp = t_0;
} else if (d4 <= 5.5e-40) {
tmp = t_1;
} else if (d4 <= 34000000000000.0) {
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) :: t_1
real(8) :: tmp
t_0 = d1 * (d2 - d1)
t_1 = d1 * -d3
if (d4 <= 2.8d-140) then
tmp = t_0
else if (d4 <= 1.55d-122) then
tmp = t_1
else if (d4 <= 1.55d-46) then
tmp = t_0
else if (d4 <= 5.5d-40) then
tmp = t_1
else if (d4 <= 34000000000000.0d0) 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 - d1);
double t_1 = d1 * -d3;
double tmp;
if (d4 <= 2.8e-140) {
tmp = t_0;
} else if (d4 <= 1.55e-122) {
tmp = t_1;
} else if (d4 <= 1.55e-46) {
tmp = t_0;
} else if (d4 <= 5.5e-40) {
tmp = t_1;
} else if (d4 <= 34000000000000.0) {
tmp = t_0;
} else {
tmp = d1 * (d2 + d4);
}
return tmp;
}
def code(d1, d2, d3, d4): t_0 = d1 * (d2 - d1) t_1 = d1 * -d3 tmp = 0 if d4 <= 2.8e-140: tmp = t_0 elif d4 <= 1.55e-122: tmp = t_1 elif d4 <= 1.55e-46: tmp = t_0 elif d4 <= 5.5e-40: tmp = t_1 elif d4 <= 34000000000000.0: tmp = t_0 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(-d3)) tmp = 0.0 if (d4 <= 2.8e-140) tmp = t_0; elseif (d4 <= 1.55e-122) tmp = t_1; elseif (d4 <= 1.55e-46) tmp = t_0; elseif (d4 <= 5.5e-40) tmp = t_1; elseif (d4 <= 34000000000000.0) 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 - d1); t_1 = d1 * -d3; tmp = 0.0; if (d4 <= 2.8e-140) tmp = t_0; elseif (d4 <= 1.55e-122) tmp = t_1; elseif (d4 <= 1.55e-46) tmp = t_0; elseif (d4 <= 5.5e-40) tmp = t_1; elseif (d4 <= 34000000000000.0) 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 - d1), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$1 = N[(d1 * (-d3)), $MachinePrecision]}, If[LessEqual[d4, 2.8e-140], t$95$0, If[LessEqual[d4, 1.55e-122], t$95$1, If[LessEqual[d4, 1.55e-46], t$95$0, If[LessEqual[d4, 5.5e-40], t$95$1, If[LessEqual[d4, 34000000000000.0], t$95$0, 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(-d3\right)\\
\mathbf{if}\;d4 \leq 2.8 \cdot 10^{-140}:\\
\;\;\;\;t\_0\\
\mathbf{elif}\;d4 \leq 1.55 \cdot 10^{-122}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;d4 \leq 1.55 \cdot 10^{-46}:\\
\;\;\;\;t\_0\\
\mathbf{elif}\;d4 \leq 5.5 \cdot 10^{-40}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;d4 \leq 34000000000000:\\
\;\;\;\;t\_0\\
\mathbf{else}:\\
\;\;\;\;d1 \cdot \left(d2 + d4\right)\\
\end{array}
\end{array}
if d4 < 2.8000000000000002e-140 or 1.5499999999999999e-122 < d4 < 1.55e-46 or 5.50000000000000002e-40 < d4 < 3.4e13Initial program 88.7%
associate--l+88.7%
distribute-lft-out--89.2%
distribute-rgt-out--91.8%
distribute-lft-out100.0%
Simplified100.0%
Taylor expanded in d3 around 0 76.6%
Taylor expanded in d4 around 0 65.5%
if 2.8000000000000002e-140 < d4 < 1.5499999999999999e-122 or 1.55e-46 < d4 < 5.50000000000000002e-40Initial 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 93.7%
associate-*r*93.7%
neg-mul-193.7%
Simplified93.7%
if 3.4e13 < d4 Initial program 92.3%
associate--l+92.3%
distribute-lft-out--94.2%
distribute-rgt-out--96.1%
distribute-lft-out100.0%
Simplified100.0%
Taylor expanded in d1 around 0 98.0%
Taylor expanded in d3 around 0 79.4%
Final simplification69.3%
(FPCore (d1 d2 d3 d4)
:precision binary64
(let* ((t_0 (* d1 (+ d2 d4))) (t_1 (* d1 (- d2 d3))))
(if (<= d3 -1.6e+73)
t_1
(if (<= d3 -5.4e-122)
(* d1 (- d4 d1))
(if (<= d3 -1.16e-256)
t_0
(if (<= d3 6.5e-244)
(* d1 (- d2 d1))
(if (<= d3 7.5e+102) t_0 t_1)))))))
double code(double d1, double d2, double d3, double d4) {
double t_0 = d1 * (d2 + d4);
double t_1 = d1 * (d2 - d3);
double tmp;
if (d3 <= -1.6e+73) {
tmp = t_1;
} else if (d3 <= -5.4e-122) {
tmp = d1 * (d4 - d1);
} else if (d3 <= -1.16e-256) {
tmp = t_0;
} else if (d3 <= 6.5e-244) {
tmp = d1 * (d2 - d1);
} else if (d3 <= 7.5e+102) {
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) :: tmp
t_0 = d1 * (d2 + d4)
t_1 = d1 * (d2 - d3)
if (d3 <= (-1.6d+73)) then
tmp = t_1
else if (d3 <= (-5.4d-122)) then
tmp = d1 * (d4 - d1)
else if (d3 <= (-1.16d-256)) then
tmp = t_0
else if (d3 <= 6.5d-244) then
tmp = d1 * (d2 - d1)
else if (d3 <= 7.5d+102) 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 + d4);
double t_1 = d1 * (d2 - d3);
double tmp;
if (d3 <= -1.6e+73) {
tmp = t_1;
} else if (d3 <= -5.4e-122) {
tmp = d1 * (d4 - d1);
} else if (d3 <= -1.16e-256) {
tmp = t_0;
} else if (d3 <= 6.5e-244) {
tmp = d1 * (d2 - d1);
} else if (d3 <= 7.5e+102) {
tmp = t_0;
} else {
tmp = t_1;
}
return tmp;
}
def code(d1, d2, d3, d4): t_0 = d1 * (d2 + d4) t_1 = d1 * (d2 - d3) tmp = 0 if d3 <= -1.6e+73: tmp = t_1 elif d3 <= -5.4e-122: tmp = d1 * (d4 - d1) elif d3 <= -1.16e-256: tmp = t_0 elif d3 <= 6.5e-244: tmp = d1 * (d2 - d1) elif d3 <= 7.5e+102: tmp = t_0 else: tmp = t_1 return tmp
function code(d1, d2, d3, d4) t_0 = Float64(d1 * Float64(d2 + d4)) t_1 = Float64(d1 * Float64(d2 - d3)) tmp = 0.0 if (d3 <= -1.6e+73) tmp = t_1; elseif (d3 <= -5.4e-122) tmp = Float64(d1 * Float64(d4 - d1)); elseif (d3 <= -1.16e-256) tmp = t_0; elseif (d3 <= 6.5e-244) tmp = Float64(d1 * Float64(d2 - d1)); elseif (d3 <= 7.5e+102) tmp = t_0; else tmp = t_1; end return tmp end
function tmp_2 = code(d1, d2, d3, d4) t_0 = d1 * (d2 + d4); t_1 = d1 * (d2 - d3); tmp = 0.0; if (d3 <= -1.6e+73) tmp = t_1; elseif (d3 <= -5.4e-122) tmp = d1 * (d4 - d1); elseif (d3 <= -1.16e-256) tmp = t_0; elseif (d3 <= 6.5e-244) tmp = d1 * (d2 - d1); elseif (d3 <= 7.5e+102) 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 + d4), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$1 = N[(d1 * N[(d2 - d3), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[d3, -1.6e+73], t$95$1, If[LessEqual[d3, -5.4e-122], N[(d1 * N[(d4 - d1), $MachinePrecision]), $MachinePrecision], If[LessEqual[d3, -1.16e-256], t$95$0, If[LessEqual[d3, 6.5e-244], N[(d1 * N[(d2 - d1), $MachinePrecision]), $MachinePrecision], If[LessEqual[d3, 7.5e+102], t$95$0, t$95$1]]]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := d1 \cdot \left(d2 + d4\right)\\
t_1 := d1 \cdot \left(d2 - d3\right)\\
\mathbf{if}\;d3 \leq -1.6 \cdot 10^{+73}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;d3 \leq -5.4 \cdot 10^{-122}:\\
\;\;\;\;d1 \cdot \left(d4 - d1\right)\\
\mathbf{elif}\;d3 \leq -1.16 \cdot 10^{-256}:\\
\;\;\;\;t\_0\\
\mathbf{elif}\;d3 \leq 6.5 \cdot 10^{-244}:\\
\;\;\;\;d1 \cdot \left(d2 - d1\right)\\
\mathbf{elif}\;d3 \leq 7.5 \cdot 10^{+102}:\\
\;\;\;\;t\_0\\
\mathbf{else}:\\
\;\;\;\;t\_1\\
\end{array}
\end{array}
if d3 < -1.59999999999999991e73 or 7.5e102 < d3 Initial program 85.8%
associate--l+85.8%
distribute-lft-out--87.8%
distribute-rgt-out--89.9%
distribute-lft-out100.0%
Simplified100.0%
Taylor expanded in d1 around 0 95.1%
Taylor expanded in d4 around 0 86.2%
if -1.59999999999999991e73 < d3 < -5.40000000000000019e-122Initial program 87.8%
associate--l+87.8%
distribute-lft-out--87.8%
distribute-rgt-out--87.8%
distribute-lft-out100.0%
Simplified100.0%
Taylor expanded in d3 around 0 88.2%
Taylor expanded in d2 around 0 60.5%
if -5.40000000000000019e-122 < d3 < -1.1600000000000001e-256 or 6.4999999999999994e-244 < d3 < 7.5e102Initial program 93.4%
associate--l+93.4%
distribute-lft-out--93.4%
distribute-rgt-out--96.7%
distribute-lft-out100.0%
Simplified100.0%
Taylor expanded in d1 around 0 79.7%
Taylor expanded in d3 around 0 75.1%
if -1.1600000000000001e-256 < d3 < 6.4999999999999994e-244Initial program 96.0%
associate--l+96.0%
distribute-lft-out--96.0%
distribute-rgt-out--100.0%
distribute-lft-out100.0%
Simplified100.0%
Taylor expanded in d3 around 0 100.0%
Taylor expanded in d4 around 0 80.9%
Final simplification77.6%
(FPCore (d1 d2 d3 d4)
:precision binary64
(if (<= d2 -5.6e+36)
(* d1 (- d2 d3))
(if (or (<= d2 -3.5e-24) (and (not (<= d2 -6.8e-224)) (<= d2 -8.6e-280)))
(* d1 (- d4 d1))
(* d1 (- d4 d3)))))
double code(double d1, double d2, double d3, double d4) {
double tmp;
if (d2 <= -5.6e+36) {
tmp = d1 * (d2 - d3);
} else if ((d2 <= -3.5e-24) || (!(d2 <= -6.8e-224) && (d2 <= -8.6e-280))) {
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 (d2 <= (-5.6d+36)) then
tmp = d1 * (d2 - d3)
else if ((d2 <= (-3.5d-24)) .or. (.not. (d2 <= (-6.8d-224))) .and. (d2 <= (-8.6d-280))) 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 (d2 <= -5.6e+36) {
tmp = d1 * (d2 - d3);
} else if ((d2 <= -3.5e-24) || (!(d2 <= -6.8e-224) && (d2 <= -8.6e-280))) {
tmp = d1 * (d4 - d1);
} else {
tmp = d1 * (d4 - d3);
}
return tmp;
}
def code(d1, d2, d3, d4): tmp = 0 if d2 <= -5.6e+36: tmp = d1 * (d2 - d3) elif (d2 <= -3.5e-24) or (not (d2 <= -6.8e-224) and (d2 <= -8.6e-280)): tmp = d1 * (d4 - d1) else: tmp = d1 * (d4 - d3) return tmp
function code(d1, d2, d3, d4) tmp = 0.0 if (d2 <= -5.6e+36) tmp = Float64(d1 * Float64(d2 - d3)); elseif ((d2 <= -3.5e-24) || (!(d2 <= -6.8e-224) && (d2 <= -8.6e-280))) 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 (d2 <= -5.6e+36) tmp = d1 * (d2 - d3); elseif ((d2 <= -3.5e-24) || (~((d2 <= -6.8e-224)) && (d2 <= -8.6e-280))) tmp = d1 * (d4 - d1); else tmp = d1 * (d4 - d3); end tmp_2 = tmp; end
code[d1_, d2_, d3_, d4_] := If[LessEqual[d2, -5.6e+36], N[(d1 * N[(d2 - d3), $MachinePrecision]), $MachinePrecision], If[Or[LessEqual[d2, -3.5e-24], And[N[Not[LessEqual[d2, -6.8e-224]], $MachinePrecision], LessEqual[d2, -8.6e-280]]], N[(d1 * N[(d4 - d1), $MachinePrecision]), $MachinePrecision], N[(d1 * N[(d4 - d3), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;d2 \leq -5.6 \cdot 10^{+36}:\\
\;\;\;\;d1 \cdot \left(d2 - d3\right)\\
\mathbf{elif}\;d2 \leq -3.5 \cdot 10^{-24} \lor \neg \left(d2 \leq -6.8 \cdot 10^{-224}\right) \land d2 \leq -8.6 \cdot 10^{-280}:\\
\;\;\;\;d1 \cdot \left(d4 - d1\right)\\
\mathbf{else}:\\
\;\;\;\;d1 \cdot \left(d4 - d3\right)\\
\end{array}
\end{array}
if d2 < -5.6000000000000001e36Initial program 88.3%
associate--l+88.3%
distribute-lft-out--90.0%
distribute-rgt-out--90.0%
distribute-lft-out100.0%
Simplified100.0%
Taylor expanded in d1 around 0 93.5%
Taylor expanded in d4 around 0 83.6%
if -5.6000000000000001e36 < d2 < -3.4999999999999996e-24 or -6.79999999999999984e-224 < d2 < -8.5999999999999997e-280Initial program 94.7%
associate--l+94.7%
distribute-lft-out--94.7%
distribute-rgt-out--94.7%
distribute-lft-out100.0%
Simplified100.0%
Taylor expanded in d3 around 0 79.8%
Taylor expanded in d2 around 0 74.7%
if -3.4999999999999996e-24 < d2 < -6.79999999999999984e-224 or -8.5999999999999997e-280 < d2 Initial program 89.8%
associate--l+89.8%
distribute-lft-out--90.4%
distribute-rgt-out--93.8%
distribute-lft-out100.0%
Simplified100.0%
Taylor expanded in d2 around 0 81.9%
Taylor expanded in d1 around 0 64.4%
Final simplification69.7%
(FPCore (d1 d2 d3 d4)
:precision binary64
(let* ((t_0 (* d1 (- d2 d3))))
(if (<= d4 6e-121)
t_0
(if (<= d4 1.25e-62)
(* d1 (- d2 d1))
(if (<= d4 4.8e+88) 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 <= 6e-121) {
tmp = t_0;
} else if (d4 <= 1.25e-62) {
tmp = d1 * (d2 - d1);
} else if (d4 <= 4.8e+88) {
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 <= 6d-121) then
tmp = t_0
else if (d4 <= 1.25d-62) then
tmp = d1 * (d2 - d1)
else if (d4 <= 4.8d+88) 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 <= 6e-121) {
tmp = t_0;
} else if (d4 <= 1.25e-62) {
tmp = d1 * (d2 - d1);
} else if (d4 <= 4.8e+88) {
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 <= 6e-121: tmp = t_0 elif d4 <= 1.25e-62: tmp = d1 * (d2 - d1) elif d4 <= 4.8e+88: 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 <= 6e-121) tmp = t_0; elseif (d4 <= 1.25e-62) tmp = Float64(d1 * Float64(d2 - d1)); elseif (d4 <= 4.8e+88) 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 <= 6e-121) tmp = t_0; elseif (d4 <= 1.25e-62) tmp = d1 * (d2 - d1); elseif (d4 <= 4.8e+88) 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, 6e-121], t$95$0, If[LessEqual[d4, 1.25e-62], N[(d1 * N[(d2 - d1), $MachinePrecision]), $MachinePrecision], If[LessEqual[d4, 4.8e+88], 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 6 \cdot 10^{-121}:\\
\;\;\;\;t\_0\\
\mathbf{elif}\;d4 \leq 1.25 \cdot 10^{-62}:\\
\;\;\;\;d1 \cdot \left(d2 - d1\right)\\
\mathbf{elif}\;d4 \leq 4.8 \cdot 10^{+88}:\\
\;\;\;\;t\_0\\
\mathbf{else}:\\
\;\;\;\;d1 \cdot \left(d2 + d4\right)\\
\end{array}
\end{array}
if d4 < 5.9999999999999999e-121 or 1.25e-62 < d4 < 4.7999999999999998e88Initial program 88.3%
associate--l+88.3%
distribute-lft-out--88.8%
distribute-rgt-out--91.2%
distribute-lft-out100.0%
Simplified100.0%
Taylor expanded in d1 around 0 80.0%
Taylor expanded in d4 around 0 66.8%
if 5.9999999999999999e-121 < d4 < 1.25e-62Initial 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 92.4%
Taylor expanded in d4 around 0 92.4%
if 4.7999999999999998e88 < d4 Initial program 94.7%
associate--l+94.7%
distribute-lft-out--97.3%
distribute-rgt-out--100.0%
distribute-lft-out100.0%
Simplified100.0%
Taylor expanded in d1 around 0 100.0%
Taylor expanded in d3 around 0 92.3%
Final simplification71.9%
(FPCore (d1 d2 d3 d4) :precision binary64 (if (or (<= d3 -1.5e+138) (not (<= d3 1e+121))) (* d1 (- d3)) (* d1 (+ d2 d4))))
double code(double d1, double d2, double d3, double d4) {
double tmp;
if ((d3 <= -1.5e+138) || !(d3 <= 1e+121)) {
tmp = d1 * -d3;
} 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 ((d3 <= (-1.5d+138)) .or. (.not. (d3 <= 1d+121))) then
tmp = d1 * -d3
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 ((d3 <= -1.5e+138) || !(d3 <= 1e+121)) {
tmp = d1 * -d3;
} else {
tmp = d1 * (d2 + d4);
}
return tmp;
}
def code(d1, d2, d3, d4): tmp = 0 if (d3 <= -1.5e+138) or not (d3 <= 1e+121): tmp = d1 * -d3 else: tmp = d1 * (d2 + d4) return tmp
function code(d1, d2, d3, d4) tmp = 0.0 if ((d3 <= -1.5e+138) || !(d3 <= 1e+121)) tmp = Float64(d1 * Float64(-d3)); else tmp = Float64(d1 * Float64(d2 + d4)); end return tmp end
function tmp_2 = code(d1, d2, d3, d4) tmp = 0.0; if ((d3 <= -1.5e+138) || ~((d3 <= 1e+121))) tmp = d1 * -d3; else tmp = d1 * (d2 + d4); end tmp_2 = tmp; end
code[d1_, d2_, d3_, d4_] := If[Or[LessEqual[d3, -1.5e+138], N[Not[LessEqual[d3, 1e+121]], $MachinePrecision]], N[(d1 * (-d3)), $MachinePrecision], N[(d1 * N[(d2 + d4), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;d3 \leq -1.5 \cdot 10^{+138} \lor \neg \left(d3 \leq 10^{+121}\right):\\
\;\;\;\;d1 \cdot \left(-d3\right)\\
\mathbf{else}:\\
\;\;\;\;d1 \cdot \left(d2 + d4\right)\\
\end{array}
\end{array}
if d3 < -1.50000000000000005e138 or 1.00000000000000004e121 < d3 Initial program 85.2%
associate--l+85.2%
distribute-lft-out--87.5%
distribute-rgt-out--89.8%
distribute-lft-out100.0%
Simplified100.0%
Taylor expanded in d3 around inf 80.3%
associate-*r*80.3%
neg-mul-180.3%
Simplified80.3%
if -1.50000000000000005e138 < d3 < 1.00000000000000004e121Initial program 92.3%
associate--l+92.3%
distribute-lft-out--92.2%
distribute-rgt-out--94.6%
distribute-lft-out100.0%
Simplified100.0%
Taylor expanded in d1 around 0 75.3%
Taylor expanded in d3 around 0 68.3%
Final simplification72.5%
(FPCore (d1 d2 d3 d4) :precision binary64 (if (<= d4 -6.5e-214) (* d1 d2) (if (<= d4 34000000000000.0) (* d1 (- d1)) (* d1 d4))))
double code(double d1, double d2, double d3, double d4) {
double tmp;
if (d4 <= -6.5e-214) {
tmp = d1 * d2;
} else if (d4 <= 34000000000000.0) {
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 <= (-6.5d-214)) then
tmp = d1 * d2
else if (d4 <= 34000000000000.0d0) 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 <= -6.5e-214) {
tmp = d1 * d2;
} else if (d4 <= 34000000000000.0) {
tmp = d1 * -d1;
} else {
tmp = d1 * d4;
}
return tmp;
}
def code(d1, d2, d3, d4): tmp = 0 if d4 <= -6.5e-214: tmp = d1 * d2 elif d4 <= 34000000000000.0: tmp = d1 * -d1 else: tmp = d1 * d4 return tmp
function code(d1, d2, d3, d4) tmp = 0.0 if (d4 <= -6.5e-214) tmp = Float64(d1 * d2); elseif (d4 <= 34000000000000.0) tmp = Float64(d1 * Float64(-d1)); else tmp = Float64(d1 * d4); end return tmp end
function tmp_2 = code(d1, d2, d3, d4) tmp = 0.0; if (d4 <= -6.5e-214) tmp = d1 * d2; elseif (d4 <= 34000000000000.0) tmp = d1 * -d1; else tmp = d1 * d4; end tmp_2 = tmp; end
code[d1_, d2_, d3_, d4_] := If[LessEqual[d4, -6.5e-214], N[(d1 * d2), $MachinePrecision], If[LessEqual[d4, 34000000000000.0], N[(d1 * (-d1)), $MachinePrecision], N[(d1 * d4), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;d4 \leq -6.5 \cdot 10^{-214}:\\
\;\;\;\;d1 \cdot d2\\
\mathbf{elif}\;d4 \leq 34000000000000:\\
\;\;\;\;d1 \cdot \left(-d1\right)\\
\mathbf{else}:\\
\;\;\;\;d1 \cdot d4\\
\end{array}
\end{array}
if d4 < -6.5000000000000004e-214Initial program 86.8%
associate--l+86.8%
distribute-lft-out--86.8%
distribute-rgt-out--91.5%
distribute-lft-out100.0%
Simplified100.0%
Taylor expanded in d2 around inf 32.8%
if -6.5000000000000004e-214 < d4 < 3.4e13Initial program 91.8%
associate--l+91.8%
distribute-lft-out--92.8%
distribute-rgt-out--92.8%
distribute-lft-out100.0%
Simplified100.0%
Taylor expanded in d1 around inf 39.7%
neg-mul-139.7%
Simplified39.7%
if 3.4e13 < d4 Initial program 92.3%
associate--l+92.3%
distribute-lft-out--94.2%
distribute-rgt-out--96.1%
distribute-lft-out100.0%
Simplified100.0%
Taylor expanded in d4 around inf 55.7%
Final simplification40.1%
(FPCore (d1 d2 d3 d4) :precision binary64 (if (<= d2 -3.8e+124) (* d1 (- d2 d3)) (* d1 (- d4 (+ d1 d3)))))
double code(double d1, double d2, double d3, double d4) {
double tmp;
if (d2 <= -3.8e+124) {
tmp = d1 * (d2 - d3);
} else {
tmp = d1 * (d4 - (d1 + 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 <= (-3.8d+124)) then
tmp = d1 * (d2 - d3)
else
tmp = d1 * (d4 - (d1 + d3))
end if
code = tmp
end function
public static double code(double d1, double d2, double d3, double d4) {
double tmp;
if (d2 <= -3.8e+124) {
tmp = d1 * (d2 - d3);
} else {
tmp = d1 * (d4 - (d1 + d3));
}
return tmp;
}
def code(d1, d2, d3, d4): tmp = 0 if d2 <= -3.8e+124: tmp = d1 * (d2 - d3) else: tmp = d1 * (d4 - (d1 + d3)) return tmp
function code(d1, d2, d3, d4) tmp = 0.0 if (d2 <= -3.8e+124) tmp = Float64(d1 * Float64(d2 - d3)); else tmp = Float64(d1 * Float64(d4 - Float64(d1 + d3))); end return tmp end
function tmp_2 = code(d1, d2, d3, d4) tmp = 0.0; if (d2 <= -3.8e+124) tmp = d1 * (d2 - d3); else tmp = d1 * (d4 - (d1 + d3)); end tmp_2 = tmp; end
code[d1_, d2_, d3_, d4_] := If[LessEqual[d2, -3.8e+124], N[(d1 * N[(d2 - d3), $MachinePrecision]), $MachinePrecision], N[(d1 * N[(d4 - N[(d1 + d3), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;d2 \leq -3.8 \cdot 10^{+124}:\\
\;\;\;\;d1 \cdot \left(d2 - d3\right)\\
\mathbf{else}:\\
\;\;\;\;d1 \cdot \left(d4 - \left(d1 + d3\right)\right)\\
\end{array}
\end{array}
if d2 < -3.7999999999999998e124Initial program 92.1%
associate--l+92.1%
distribute-lft-out--94.7%
distribute-rgt-out--94.7%
distribute-lft-out100.0%
Simplified100.0%
Taylor expanded in d1 around 0 100.0%
Taylor expanded in d4 around 0 97.5%
if -3.7999999999999998e124 < d2 Initial program 89.4%
associate--l+89.4%
distribute-lft-out--89.9%
distribute-rgt-out--92.6%
distribute-lft-out100.0%
Simplified100.0%
Taylor expanded in d2 around 0 81.8%
Final simplification84.1%
(FPCore (d1 d2 d3 d4) :precision binary64 (if (<= d2 -2.45e+70) (* d1 (- (+ d2 d4) d1)) (* d1 (- d4 (+ d1 d3)))))
double code(double d1, double d2, double d3, double d4) {
double tmp;
if (d2 <= -2.45e+70) {
tmp = d1 * ((d2 + d4) - d1);
} else {
tmp = d1 * (d4 - (d1 + d3));
}
return tmp;
}
real(8) function code(d1, d2, d3, d4)
real(8), intent (in) :: d1
real(8), intent (in) :: d2
real(8), intent (in) :: d3
real(8), intent (in) :: d4
real(8) :: tmp
if (d2 <= (-2.45d+70)) then
tmp = d1 * ((d2 + d4) - d1)
else
tmp = d1 * (d4 - (d1 + d3))
end if
code = tmp
end function
public static double code(double d1, double d2, double d3, double d4) {
double tmp;
if (d2 <= -2.45e+70) {
tmp = d1 * ((d2 + d4) - d1);
} else {
tmp = d1 * (d4 - (d1 + d3));
}
return tmp;
}
def code(d1, d2, d3, d4): tmp = 0 if d2 <= -2.45e+70: tmp = d1 * ((d2 + d4) - d1) else: tmp = d1 * (d4 - (d1 + d3)) return tmp
function code(d1, d2, d3, d4) tmp = 0.0 if (d2 <= -2.45e+70) tmp = Float64(d1 * Float64(Float64(d2 + d4) - d1)); else tmp = Float64(d1 * Float64(d4 - Float64(d1 + d3))); end return tmp end
function tmp_2 = code(d1, d2, d3, d4) tmp = 0.0; if (d2 <= -2.45e+70) tmp = d1 * ((d2 + d4) - d1); else tmp = d1 * (d4 - (d1 + d3)); end tmp_2 = tmp; end
code[d1_, d2_, d3_, d4_] := If[LessEqual[d2, -2.45e+70], N[(d1 * N[(N[(d2 + d4), $MachinePrecision] - d1), $MachinePrecision]), $MachinePrecision], N[(d1 * N[(d4 - N[(d1 + d3), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;d2 \leq -2.45 \cdot 10^{+70}:\\
\;\;\;\;d1 \cdot \left(\left(d2 + d4\right) - d1\right)\\
\mathbf{else}:\\
\;\;\;\;d1 \cdot \left(d4 - \left(d1 + d3\right)\right)\\
\end{array}
\end{array}
if d2 < -2.45000000000000014e70Initial program 85.7%
associate--l+85.7%
distribute-lft-out--87.7%
distribute-rgt-out--87.7%
distribute-lft-out100.0%
Simplified100.0%
Taylor expanded in d3 around 0 98.0%
if -2.45000000000000014e70 < d2 Initial program 90.8%
associate--l+90.8%
distribute-lft-out--91.3%
distribute-rgt-out--94.2%
distribute-lft-out100.0%
Simplified100.0%
Taylor expanded in d2 around 0 82.7%
Final simplification85.6%
(FPCore (d1 d2 d3 d4) :precision binary64 (if (<= d2 -1.75e+52) (* d1 (- (+ d2 d4) d3)) (* d1 (- d4 (+ d1 d3)))))
double code(double d1, double d2, double d3, double d4) {
double tmp;
if (d2 <= -1.75e+52) {
tmp = d1 * ((d2 + d4) - d3);
} else {
tmp = d1 * (d4 - (d1 + 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.75d+52)) then
tmp = d1 * ((d2 + d4) - d3)
else
tmp = d1 * (d4 - (d1 + d3))
end if
code = tmp
end function
public static double code(double d1, double d2, double d3, double d4) {
double tmp;
if (d2 <= -1.75e+52) {
tmp = d1 * ((d2 + d4) - d3);
} else {
tmp = d1 * (d4 - (d1 + d3));
}
return tmp;
}
def code(d1, d2, d3, d4): tmp = 0 if d2 <= -1.75e+52: tmp = d1 * ((d2 + d4) - d3) else: tmp = d1 * (d4 - (d1 + d3)) return tmp
function code(d1, d2, d3, d4) tmp = 0.0 if (d2 <= -1.75e+52) tmp = Float64(d1 * Float64(Float64(d2 + d4) - d3)); else tmp = Float64(d1 * Float64(d4 - Float64(d1 + d3))); end return tmp end
function tmp_2 = code(d1, d2, d3, d4) tmp = 0.0; if (d2 <= -1.75e+52) tmp = d1 * ((d2 + d4) - d3); else tmp = d1 * (d4 - (d1 + d3)); end tmp_2 = tmp; end
code[d1_, d2_, d3_, d4_] := If[LessEqual[d2, -1.75e+52], N[(d1 * N[(N[(d2 + d4), $MachinePrecision] - d3), $MachinePrecision]), $MachinePrecision], N[(d1 * N[(d4 - N[(d1 + d3), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;d2 \leq -1.75 \cdot 10^{+52}:\\
\;\;\;\;d1 \cdot \left(\left(d2 + d4\right) - d3\right)\\
\mathbf{else}:\\
\;\;\;\;d1 \cdot \left(d4 - \left(d1 + d3\right)\right)\\
\end{array}
\end{array}
if d2 < -1.75e52Initial program 87.0%
associate--l+87.0%
distribute-lft-out--88.9%
distribute-rgt-out--88.9%
distribute-lft-out100.0%
Simplified100.0%
Taylor expanded in d1 around 0 94.4%
if -1.75e52 < d2 Initial program 90.6%
associate--l+90.6%
distribute-lft-out--91.1%
distribute-rgt-out--94.0%
distribute-lft-out100.0%
Simplified100.0%
Taylor expanded in d2 around 0 83.2%
Final simplification85.6%
(FPCore (d1 d2 d3 d4) :precision binary64 (if (<= d4 1.45e+91) (* d1 d2) (* d1 d4)))
double code(double d1, double d2, double d3, double d4) {
double tmp;
if (d4 <= 1.45e+91) {
tmp = d1 * d2;
} else {
tmp = d1 * d4;
}
return tmp;
}
real(8) function code(d1, d2, d3, d4)
real(8), intent (in) :: d1
real(8), intent (in) :: d2
real(8), intent (in) :: d3
real(8), intent (in) :: d4
real(8) :: tmp
if (d4 <= 1.45d+91) then
tmp = d1 * d2
else
tmp = d1 * d4
end if
code = tmp
end function
public static double code(double d1, double d2, double d3, double d4) {
double tmp;
if (d4 <= 1.45e+91) {
tmp = d1 * d2;
} else {
tmp = d1 * d4;
}
return tmp;
}
def code(d1, d2, d3, d4): tmp = 0 if d4 <= 1.45e+91: tmp = d1 * d2 else: tmp = d1 * d4 return tmp
function code(d1, d2, d3, d4) tmp = 0.0 if (d4 <= 1.45e+91) tmp = Float64(d1 * d2); else tmp = Float64(d1 * d4); end return tmp end
function tmp_2 = code(d1, d2, d3, d4) tmp = 0.0; if (d4 <= 1.45e+91) tmp = d1 * d2; else tmp = d1 * d4; end tmp_2 = tmp; end
code[d1_, d2_, d3_, d4_] := If[LessEqual[d4, 1.45e+91], N[(d1 * d2), $MachinePrecision], N[(d1 * d4), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;d4 \leq 1.45 \cdot 10^{+91}:\\
\;\;\;\;d1 \cdot d2\\
\mathbf{else}:\\
\;\;\;\;d1 \cdot d4\\
\end{array}
\end{array}
if d4 < 1.45000000000000007e91Initial program 89.0%
associate--l+89.0%
distribute-lft-out--89.4%
distribute-rgt-out--91.7%
distribute-lft-out100.0%
Simplified100.0%
Taylor expanded in d2 around inf 34.2%
if 1.45000000000000007e91 < d4 Initial program 94.7%
associate--l+94.7%
distribute-lft-out--97.3%
distribute-rgt-out--100.0%
distribute-lft-out100.0%
Simplified100.0%
Taylor expanded in d4 around inf 71.9%
Final simplification39.8%
(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.8%
associate--l+89.8%
distribute-lft-out--90.6%
distribute-rgt-out--93.0%
distribute-lft-out100.0%
Simplified100.0%
Taylor expanded in d2 around inf 32.8%
Final simplification32.8%
(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 2024066
(FPCore (d1 d2 d3 d4)
:name "FastMath dist4"
:precision binary64
:alt
(* d1 (- (+ (- d2 d3) d4) d1))
(- (+ (- (* d1 d2) (* d1 d3)) (* d4 d1)) (* d1 d1)))