
(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 15 alternatives:
| Alternative | Accuracy | Speedup |
|---|
(FPCore (d1 d2 d3 d4) :precision binary64 (- (+ (- (* d1 d2) (* d1 d3)) (* d4 d1)) (* d1 d1)))
double code(double d1, double d2, double d3, double d4) {
return (((d1 * d2) - (d1 * d3)) + (d4 * d1)) - (d1 * d1);
}
real(8) function code(d1, d2, d3, d4)
real(8), intent (in) :: d1
real(8), intent (in) :: d2
real(8), intent (in) :: d3
real(8), intent (in) :: d4
code = (((d1 * d2) - (d1 * d3)) + (d4 * d1)) - (d1 * d1)
end function
public static double code(double d1, double d2, double d3, double d4) {
return (((d1 * d2) - (d1 * d3)) + (d4 * d1)) - (d1 * d1);
}
def code(d1, d2, d3, d4): return (((d1 * d2) - (d1 * d3)) + (d4 * d1)) - (d1 * d1)
function code(d1, d2, d3, d4) return Float64(Float64(Float64(Float64(d1 * d2) - Float64(d1 * d3)) + Float64(d4 * d1)) - Float64(d1 * d1)) end
function tmp = code(d1, d2, d3, d4) tmp = (((d1 * d2) - (d1 * d3)) + (d4 * d1)) - (d1 * d1); end
code[d1_, d2_, d3_, d4_] := N[(N[(N[(N[(d1 * d2), $MachinePrecision] - N[(d1 * d3), $MachinePrecision]), $MachinePrecision] + N[(d4 * d1), $MachinePrecision]), $MachinePrecision] - N[(d1 * d1), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
\left(\left(d1 \cdot d2 - d1 \cdot d3\right) + d4 \cdot d1\right) - d1 \cdot d1
\end{array}
(FPCore (d1 d2 d3 d4) :precision binary64 (* d1 (- (+ d4 (- d2 d3)) d1)))
double code(double d1, double d2, double d3, double d4) {
return d1 * ((d4 + (d2 - d3)) - 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 * ((d4 + (d2 - d3)) - d1)
end function
public static double code(double d1, double d2, double d3, double d4) {
return d1 * ((d4 + (d2 - d3)) - d1);
}
def code(d1, d2, d3, d4): return d1 * ((d4 + (d2 - d3)) - d1)
function code(d1, d2, d3, d4) return Float64(d1 * Float64(Float64(d4 + Float64(d2 - d3)) - d1)) end
function tmp = code(d1, d2, d3, d4) tmp = d1 * ((d4 + (d2 - d3)) - d1); end
code[d1_, d2_, d3_, d4_] := N[(d1 * N[(N[(d4 + N[(d2 - d3), $MachinePrecision]), $MachinePrecision] - d1), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
d1 \cdot \left(\left(d4 + \left(d2 - d3\right)\right) - d1\right)
\end{array}
Initial program 91.0%
+-commutative91.0%
*-commutative91.0%
distribute-lft-out--91.4%
distribute-lft-out92.6%
distribute-lft-out--100.0%
Simplified100.0%
(FPCore (d1 d2 d3 d4)
:precision binary64
(let* ((t_0 (* d1 (- d3))))
(if (<= d4 4.6e-299)
(* d1 d2)
(if (<= d4 1.25e-174)
t_0
(if (<= d4 3.8e-42)
(- (* d1 d1))
(if (<= d4 5.4e+41) t_0 (* d1 d4)))))))
double code(double d1, double d2, double d3, double d4) {
double t_0 = d1 * -d3;
double tmp;
if (d4 <= 4.6e-299) {
tmp = d1 * d2;
} else if (d4 <= 1.25e-174) {
tmp = t_0;
} else if (d4 <= 3.8e-42) {
tmp = -(d1 * d1);
} else if (d4 <= 5.4e+41) {
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 <= 4.6d-299) then
tmp = d1 * d2
else if (d4 <= 1.25d-174) then
tmp = t_0
else if (d4 <= 3.8d-42) then
tmp = -(d1 * d1)
else if (d4 <= 5.4d+41) 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 <= 4.6e-299) {
tmp = d1 * d2;
} else if (d4 <= 1.25e-174) {
tmp = t_0;
} else if (d4 <= 3.8e-42) {
tmp = -(d1 * d1);
} else if (d4 <= 5.4e+41) {
tmp = t_0;
} else {
tmp = d1 * d4;
}
return tmp;
}
def code(d1, d2, d3, d4): t_0 = d1 * -d3 tmp = 0 if d4 <= 4.6e-299: tmp = d1 * d2 elif d4 <= 1.25e-174: tmp = t_0 elif d4 <= 3.8e-42: tmp = -(d1 * d1) elif d4 <= 5.4e+41: 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 <= 4.6e-299) tmp = Float64(d1 * d2); elseif (d4 <= 1.25e-174) tmp = t_0; elseif (d4 <= 3.8e-42) tmp = Float64(-Float64(d1 * d1)); elseif (d4 <= 5.4e+41) 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 <= 4.6e-299) tmp = d1 * d2; elseif (d4 <= 1.25e-174) tmp = t_0; elseif (d4 <= 3.8e-42) tmp = -(d1 * d1); elseif (d4 <= 5.4e+41) 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, 4.6e-299], N[(d1 * d2), $MachinePrecision], If[LessEqual[d4, 1.25e-174], t$95$0, If[LessEqual[d4, 3.8e-42], (-N[(d1 * d1), $MachinePrecision]), If[LessEqual[d4, 5.4e+41], t$95$0, N[(d1 * d4), $MachinePrecision]]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := d1 \cdot \left(-d3\right)\\
\mathbf{if}\;d4 \leq 4.6 \cdot 10^{-299}:\\
\;\;\;\;d1 \cdot d2\\
\mathbf{elif}\;d4 \leq 1.25 \cdot 10^{-174}:\\
\;\;\;\;t\_0\\
\mathbf{elif}\;d4 \leq 3.8 \cdot 10^{-42}:\\
\;\;\;\;-d1 \cdot d1\\
\mathbf{elif}\;d4 \leq 5.4 \cdot 10^{+41}:\\
\;\;\;\;t\_0\\
\mathbf{else}:\\
\;\;\;\;d1 \cdot d4\\
\end{array}
\end{array}
if d4 < 4.6000000000000001e-299Initial program 89.9%
+-commutative89.9%
*-commutative89.9%
distribute-lft-out--90.7%
distribute-lft-out92.2%
distribute-lft-out--100.0%
Simplified100.0%
Taylor expanded in d2 around inf 26.2%
if 4.6000000000000001e-299 < d4 < 1.2500000000000001e-174 or 3.80000000000000017e-42 < d4 < 5.39999999999999999e41Initial program 92.9%
+-commutative92.9%
*-commutative92.9%
distribute-lft-out--92.9%
distribute-lft-out92.9%
distribute-lft-out--100.0%
Simplified100.0%
Taylor expanded in d3 around inf 49.1%
mul-1-neg49.1%
distribute-rgt-neg-out49.1%
Simplified49.1%
if 1.2500000000000001e-174 < d4 < 3.80000000000000017e-42Initial program 99.9%
+-commutative99.9%
*-commutative99.9%
distribute-lft-out--99.9%
distribute-lft-out99.9%
distribute-lft-out--99.9%
Simplified99.9%
Taylor expanded in d1 around inf 50.7%
neg-mul-150.7%
Simplified50.7%
if 5.39999999999999999e41 < d4 Initial program 87.8%
+-commutative87.8%
*-commutative87.8%
distribute-lft-out--87.8%
distribute-lft-out89.8%
distribute-lft-out--100.0%
Simplified100.0%
Taylor expanded in d4 around inf 66.6%
Final simplification41.0%
(FPCore (d1 d2 d3 d4)
:precision binary64
(let* ((t_0 (* d1 (- d2 d3))))
(if (<= d4 1.7e-173)
t_0
(if (<= d4 2.8e-25)
(* d1 (- d2 d1))
(if (<= d4 2.1e+37) t_0 (* d1 (+ d4 d2)))))))
double code(double d1, double d2, double d3, double d4) {
double t_0 = d1 * (d2 - d3);
double tmp;
if (d4 <= 1.7e-173) {
tmp = t_0;
} else if (d4 <= 2.8e-25) {
tmp = d1 * (d2 - d1);
} else if (d4 <= 2.1e+37) {
tmp = t_0;
} else {
tmp = d1 * (d4 + d2);
}
return tmp;
}
real(8) function code(d1, d2, d3, d4)
real(8), intent (in) :: d1
real(8), intent (in) :: d2
real(8), intent (in) :: d3
real(8), intent (in) :: d4
real(8) :: t_0
real(8) :: tmp
t_0 = d1 * (d2 - d3)
if (d4 <= 1.7d-173) then
tmp = t_0
else if (d4 <= 2.8d-25) then
tmp = d1 * (d2 - d1)
else if (d4 <= 2.1d+37) then
tmp = t_0
else
tmp = d1 * (d4 + d2)
end if
code = tmp
end function
public static double code(double d1, double d2, double d3, double d4) {
double t_0 = d1 * (d2 - d3);
double tmp;
if (d4 <= 1.7e-173) {
tmp = t_0;
} else if (d4 <= 2.8e-25) {
tmp = d1 * (d2 - d1);
} else if (d4 <= 2.1e+37) {
tmp = t_0;
} else {
tmp = d1 * (d4 + d2);
}
return tmp;
}
def code(d1, d2, d3, d4): t_0 = d1 * (d2 - d3) tmp = 0 if d4 <= 1.7e-173: tmp = t_0 elif d4 <= 2.8e-25: tmp = d1 * (d2 - d1) elif d4 <= 2.1e+37: tmp = t_0 else: tmp = d1 * (d4 + d2) return tmp
function code(d1, d2, d3, d4) t_0 = Float64(d1 * Float64(d2 - d3)) tmp = 0.0 if (d4 <= 1.7e-173) tmp = t_0; elseif (d4 <= 2.8e-25) tmp = Float64(d1 * Float64(d2 - d1)); elseif (d4 <= 2.1e+37) tmp = t_0; else tmp = Float64(d1 * Float64(d4 + d2)); end return tmp end
function tmp_2 = code(d1, d2, d3, d4) t_0 = d1 * (d2 - d3); tmp = 0.0; if (d4 <= 1.7e-173) tmp = t_0; elseif (d4 <= 2.8e-25) tmp = d1 * (d2 - d1); elseif (d4 <= 2.1e+37) tmp = t_0; else tmp = d1 * (d4 + d2); end tmp_2 = tmp; end
code[d1_, d2_, d3_, d4_] := Block[{t$95$0 = N[(d1 * N[(d2 - d3), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[d4, 1.7e-173], t$95$0, If[LessEqual[d4, 2.8e-25], N[(d1 * N[(d2 - d1), $MachinePrecision]), $MachinePrecision], If[LessEqual[d4, 2.1e+37], t$95$0, N[(d1 * N[(d4 + d2), $MachinePrecision]), $MachinePrecision]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := d1 \cdot \left(d2 - d3\right)\\
\mathbf{if}\;d4 \leq 1.7 \cdot 10^{-173}:\\
\;\;\;\;t\_0\\
\mathbf{elif}\;d4 \leq 2.8 \cdot 10^{-25}:\\
\;\;\;\;d1 \cdot \left(d2 - d1\right)\\
\mathbf{elif}\;d4 \leq 2.1 \cdot 10^{+37}:\\
\;\;\;\;t\_0\\
\mathbf{else}:\\
\;\;\;\;d1 \cdot \left(d4 + d2\right)\\
\end{array}
\end{array}
if d4 < 1.6999999999999999e-173 or 2.79999999999999988e-25 < d4 < 2.1000000000000001e37Initial program 90.4%
+-commutative90.4%
*-commutative90.4%
distribute-lft-out--91.0%
distribute-lft-out92.1%
distribute-lft-out--100.0%
Simplified100.0%
Taylor expanded in d1 around 0 76.9%
Taylor expanded in d4 around 0 58.6%
if 1.6999999999999999e-173 < d4 < 2.79999999999999988e-25Initial program 99.9%
+-commutative99.9%
*-commutative99.9%
distribute-lft-out--99.9%
distribute-lft-out99.9%
distribute-lft-out--99.9%
Simplified99.9%
Taylor expanded in d3 around 0 76.1%
Taylor expanded in d4 around 0 70.2%
if 2.1000000000000001e37 < d4 Initial program 88.0%
+-commutative88.0%
*-commutative88.0%
distribute-lft-out--88.0%
distribute-lft-out90.0%
distribute-lft-out--100.0%
Simplified100.0%
Taylor expanded in d3 around 0 88.4%
Taylor expanded in d1 around 0 82.5%
Final simplification64.5%
(FPCore (d1 d2 d3 d4) :precision binary64 (if (or (<= d3 -9000000000000.0) (not (<= d3 5.5e-5))) (* d1 (- (+ d4 d2) d3)) (* d1 (- (+ d4 d2) d1))))
double code(double d1, double d2, double d3, double d4) {
double tmp;
if ((d3 <= -9000000000000.0) || !(d3 <= 5.5e-5)) {
tmp = d1 * ((d4 + d2) - d3);
} else {
tmp = d1 * ((d4 + d2) - d1);
}
return tmp;
}
real(8) function code(d1, d2, d3, d4)
real(8), intent (in) :: d1
real(8), intent (in) :: d2
real(8), intent (in) :: d3
real(8), intent (in) :: d4
real(8) :: tmp
if ((d3 <= (-9000000000000.0d0)) .or. (.not. (d3 <= 5.5d-5))) then
tmp = d1 * ((d4 + d2) - d3)
else
tmp = d1 * ((d4 + d2) - d1)
end if
code = tmp
end function
public static double code(double d1, double d2, double d3, double d4) {
double tmp;
if ((d3 <= -9000000000000.0) || !(d3 <= 5.5e-5)) {
tmp = d1 * ((d4 + d2) - d3);
} else {
tmp = d1 * ((d4 + d2) - d1);
}
return tmp;
}
def code(d1, d2, d3, d4): tmp = 0 if (d3 <= -9000000000000.0) or not (d3 <= 5.5e-5): tmp = d1 * ((d4 + d2) - d3) else: tmp = d1 * ((d4 + d2) - d1) return tmp
function code(d1, d2, d3, d4) tmp = 0.0 if ((d3 <= -9000000000000.0) || !(d3 <= 5.5e-5)) tmp = Float64(d1 * Float64(Float64(d4 + d2) - d3)); else tmp = Float64(d1 * Float64(Float64(d4 + d2) - d1)); end return tmp end
function tmp_2 = code(d1, d2, d3, d4) tmp = 0.0; if ((d3 <= -9000000000000.0) || ~((d3 <= 5.5e-5))) tmp = d1 * ((d4 + d2) - d3); else tmp = d1 * ((d4 + d2) - d1); end tmp_2 = tmp; end
code[d1_, d2_, d3_, d4_] := If[Or[LessEqual[d3, -9000000000000.0], N[Not[LessEqual[d3, 5.5e-5]], $MachinePrecision]], N[(d1 * N[(N[(d4 + d2), $MachinePrecision] - d3), $MachinePrecision]), $MachinePrecision], N[(d1 * N[(N[(d4 + d2), $MachinePrecision] - d1), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;d3 \leq -9000000000000 \lor \neg \left(d3 \leq 5.5 \cdot 10^{-5}\right):\\
\;\;\;\;d1 \cdot \left(\left(d4 + d2\right) - d3\right)\\
\mathbf{else}:\\
\;\;\;\;d1 \cdot \left(\left(d4 + d2\right) - d1\right)\\
\end{array}
\end{array}
if d3 < -9e12 or 5.5000000000000002e-5 < d3 Initial program 88.8%
+-commutative88.8%
*-commutative88.8%
distribute-lft-out--88.9%
distribute-lft-out90.3%
distribute-lft-out--100.0%
Simplified100.0%
Taylor expanded in d1 around 0 90.1%
if -9e12 < d3 < 5.5000000000000002e-5Initial program 93.4%
+-commutative93.4%
*-commutative93.4%
distribute-lft-out--94.2%
distribute-lft-out95.0%
distribute-lft-out--100.0%
Simplified100.0%
Taylor expanded in d3 around 0 98.8%
Final simplification94.2%
(FPCore (d1 d2 d3 d4) :precision binary64 (if (or (<= d3 -2.05e+103) (not (<= d3 1.6e+225))) (* d1 (- d4 d3)) (* d1 (- (+ d4 d2) d1))))
double code(double d1, double d2, double d3, double d4) {
double tmp;
if ((d3 <= -2.05e+103) || !(d3 <= 1.6e+225)) {
tmp = d1 * (d4 - d3);
} else {
tmp = d1 * ((d4 + d2) - d1);
}
return tmp;
}
real(8) function code(d1, d2, d3, d4)
real(8), intent (in) :: d1
real(8), intent (in) :: d2
real(8), intent (in) :: d3
real(8), intent (in) :: d4
real(8) :: tmp
if ((d3 <= (-2.05d+103)) .or. (.not. (d3 <= 1.6d+225))) then
tmp = d1 * (d4 - d3)
else
tmp = d1 * ((d4 + d2) - d1)
end if
code = tmp
end function
public static double code(double d1, double d2, double d3, double d4) {
double tmp;
if ((d3 <= -2.05e+103) || !(d3 <= 1.6e+225)) {
tmp = d1 * (d4 - d3);
} else {
tmp = d1 * ((d4 + d2) - d1);
}
return tmp;
}
def code(d1, d2, d3, d4): tmp = 0 if (d3 <= -2.05e+103) or not (d3 <= 1.6e+225): tmp = d1 * (d4 - d3) else: tmp = d1 * ((d4 + d2) - d1) return tmp
function code(d1, d2, d3, d4) tmp = 0.0 if ((d3 <= -2.05e+103) || !(d3 <= 1.6e+225)) tmp = Float64(d1 * Float64(d4 - d3)); else tmp = Float64(d1 * Float64(Float64(d4 + d2) - d1)); end return tmp end
function tmp_2 = code(d1, d2, d3, d4) tmp = 0.0; if ((d3 <= -2.05e+103) || ~((d3 <= 1.6e+225))) tmp = d1 * (d4 - d3); else tmp = d1 * ((d4 + d2) - d1); end tmp_2 = tmp; end
code[d1_, d2_, d3_, d4_] := If[Or[LessEqual[d3, -2.05e+103], N[Not[LessEqual[d3, 1.6e+225]], $MachinePrecision]], N[(d1 * N[(d4 - d3), $MachinePrecision]), $MachinePrecision], N[(d1 * N[(N[(d4 + d2), $MachinePrecision] - d1), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;d3 \leq -2.05 \cdot 10^{+103} \lor \neg \left(d3 \leq 1.6 \cdot 10^{+225}\right):\\
\;\;\;\;d1 \cdot \left(d4 - d3\right)\\
\mathbf{else}:\\
\;\;\;\;d1 \cdot \left(\left(d4 + d2\right) - d1\right)\\
\end{array}
\end{array}
if d3 < -2.0500000000000001e103 or 1.59999999999999995e225 < d3 Initial program 88.8%
+-commutative88.8%
*-commutative88.8%
distribute-lft-out--88.9%
distribute-lft-out92.0%
distribute-lft-out--100.0%
Simplified100.0%
Taylor expanded in d2 around 0 95.4%
+-commutative95.4%
associate--r+95.4%
Simplified95.4%
Taylor expanded in d1 around 0 93.8%
if -2.0500000000000001e103 < d3 < 1.59999999999999995e225Initial program 91.7%
+-commutative91.7%
*-commutative91.7%
distribute-lft-out--92.2%
distribute-lft-out92.7%
distribute-lft-out--100.0%
Simplified100.0%
Taylor expanded in d3 around 0 89.6%
Final simplification90.6%
(FPCore (d1 d2 d3 d4) :precision binary64 (if (<= d4 3.1e-304) (* d1 (- d2 d1)) (if (<= d4 1.05e+54) (* d1 (- (- d1) d3)) (* d1 (- d4 d3)))))
double code(double d1, double d2, double d3, double d4) {
double tmp;
if (d4 <= 3.1e-304) {
tmp = d1 * (d2 - d1);
} else if (d4 <= 1.05e+54) {
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 (d4 <= 3.1d-304) then
tmp = d1 * (d2 - d1)
else if (d4 <= 1.05d+54) 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 (d4 <= 3.1e-304) {
tmp = d1 * (d2 - d1);
} else if (d4 <= 1.05e+54) {
tmp = d1 * (-d1 - d3);
} else {
tmp = d1 * (d4 - d3);
}
return tmp;
}
def code(d1, d2, d3, d4): tmp = 0 if d4 <= 3.1e-304: tmp = d1 * (d2 - d1) elif d4 <= 1.05e+54: tmp = d1 * (-d1 - d3) else: tmp = d1 * (d4 - d3) return tmp
function code(d1, d2, d3, d4) tmp = 0.0 if (d4 <= 3.1e-304) tmp = Float64(d1 * Float64(d2 - d1)); elseif (d4 <= 1.05e+54) 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 (d4 <= 3.1e-304) tmp = d1 * (d2 - d1); elseif (d4 <= 1.05e+54) tmp = d1 * (-d1 - d3); else tmp = d1 * (d4 - d3); end tmp_2 = tmp; end
code[d1_, d2_, d3_, d4_] := If[LessEqual[d4, 3.1e-304], N[(d1 * N[(d2 - d1), $MachinePrecision]), $MachinePrecision], If[LessEqual[d4, 1.05e+54], N[(d1 * N[((-d1) - d3), $MachinePrecision]), $MachinePrecision], N[(d1 * N[(d4 - d3), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;d4 \leq 3.1 \cdot 10^{-304}:\\
\;\;\;\;d1 \cdot \left(d2 - d1\right)\\
\mathbf{elif}\;d4 \leq 1.05 \cdot 10^{+54}:\\
\;\;\;\;d1 \cdot \left(\left(-d1\right) - d3\right)\\
\mathbf{else}:\\
\;\;\;\;d1 \cdot \left(d4 - d3\right)\\
\end{array}
\end{array}
if d4 < 3.09999999999999985e-304Initial program 90.5%
+-commutative90.5%
*-commutative90.5%
distribute-lft-out--90.5%
distribute-lft-out92.1%
distribute-lft-out--100.0%
Simplified100.0%
Taylor expanded in d3 around 0 74.4%
Taylor expanded in d4 around 0 50.3%
if 3.09999999999999985e-304 < d4 < 1.04999999999999993e54Initial program 93.8%
+-commutative93.8%
*-commutative93.8%
distribute-lft-out--95.1%
distribute-lft-out95.1%
distribute-lft-out--100.0%
Simplified100.0%
Taylor expanded in d2 around 0 82.3%
+-commutative82.3%
associate--r+82.3%
Simplified82.3%
Taylor expanded in d4 around 0 78.0%
associate-*r*78.0%
mul-1-neg78.0%
Simplified78.0%
if 1.04999999999999993e54 < d4 Initial program 87.5%
+-commutative87.5%
*-commutative87.5%
distribute-lft-out--87.5%
distribute-lft-out89.6%
distribute-lft-out--100.0%
Simplified100.0%
Taylor expanded in d2 around 0 84.1%
+-commutative84.1%
associate--r+84.1%
Simplified84.1%
Taylor expanded in d1 around 0 79.9%
Final simplification64.7%
(FPCore (d1 d2 d3 d4) :precision binary64 (if (or (<= d3 -6.4e+102) (not (<= d3 1.05e+165))) (* d1 (- d3)) (* d1 (+ d4 d2))))
double code(double d1, double d2, double d3, double d4) {
double tmp;
if ((d3 <= -6.4e+102) || !(d3 <= 1.05e+165)) {
tmp = d1 * -d3;
} else {
tmp = d1 * (d4 + d2);
}
return tmp;
}
real(8) function code(d1, d2, d3, d4)
real(8), intent (in) :: d1
real(8), intent (in) :: d2
real(8), intent (in) :: d3
real(8), intent (in) :: d4
real(8) :: tmp
if ((d3 <= (-6.4d+102)) .or. (.not. (d3 <= 1.05d+165))) then
tmp = d1 * -d3
else
tmp = d1 * (d4 + d2)
end if
code = tmp
end function
public static double code(double d1, double d2, double d3, double d4) {
double tmp;
if ((d3 <= -6.4e+102) || !(d3 <= 1.05e+165)) {
tmp = d1 * -d3;
} else {
tmp = d1 * (d4 + d2);
}
return tmp;
}
def code(d1, d2, d3, d4): tmp = 0 if (d3 <= -6.4e+102) or not (d3 <= 1.05e+165): tmp = d1 * -d3 else: tmp = d1 * (d4 + d2) return tmp
function code(d1, d2, d3, d4) tmp = 0.0 if ((d3 <= -6.4e+102) || !(d3 <= 1.05e+165)) tmp = Float64(d1 * Float64(-d3)); else tmp = Float64(d1 * Float64(d4 + d2)); end return tmp end
function tmp_2 = code(d1, d2, d3, d4) tmp = 0.0; if ((d3 <= -6.4e+102) || ~((d3 <= 1.05e+165))) tmp = d1 * -d3; else tmp = d1 * (d4 + d2); end tmp_2 = tmp; end
code[d1_, d2_, d3_, d4_] := If[Or[LessEqual[d3, -6.4e+102], N[Not[LessEqual[d3, 1.05e+165]], $MachinePrecision]], N[(d1 * (-d3)), $MachinePrecision], N[(d1 * N[(d4 + d2), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;d3 \leq -6.4 \cdot 10^{+102} \lor \neg \left(d3 \leq 1.05 \cdot 10^{+165}\right):\\
\;\;\;\;d1 \cdot \left(-d3\right)\\
\mathbf{else}:\\
\;\;\;\;d1 \cdot \left(d4 + d2\right)\\
\end{array}
\end{array}
if d3 < -6.3999999999999999e102 or 1.05e165 < d3 Initial program 88.4%
+-commutative88.4%
*-commutative88.4%
distribute-lft-out--88.4%
distribute-lft-out91.3%
distribute-lft-out--100.0%
Simplified100.0%
Taylor expanded in d3 around inf 80.5%
mul-1-neg80.5%
distribute-rgt-neg-out80.5%
Simplified80.5%
if -6.3999999999999999e102 < d3 < 1.05e165Initial program 92.0%
+-commutative92.0%
*-commutative92.0%
distribute-lft-out--92.5%
distribute-lft-out93.0%
distribute-lft-out--100.0%
Simplified100.0%
Taylor expanded in d3 around 0 89.8%
Taylor expanded in d1 around 0 60.8%
Final simplification66.1%
(FPCore (d1 d2 d3 d4) :precision binary64 (if (<= d4 2.1e-169) (* d1 (- d2 d3)) (if (<= d4 4e-22) (* d1 (- d2 d1)) (* d1 (- d4 d3)))))
double code(double d1, double d2, double d3, double d4) {
double tmp;
if (d4 <= 2.1e-169) {
tmp = d1 * (d2 - d3);
} else if (d4 <= 4e-22) {
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 (d4 <= 2.1d-169) then
tmp = d1 * (d2 - d3)
else if (d4 <= 4d-22) 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 (d4 <= 2.1e-169) {
tmp = d1 * (d2 - d3);
} else if (d4 <= 4e-22) {
tmp = d1 * (d2 - d1);
} else {
tmp = d1 * (d4 - d3);
}
return tmp;
}
def code(d1, d2, d3, d4): tmp = 0 if d4 <= 2.1e-169: tmp = d1 * (d2 - d3) elif d4 <= 4e-22: tmp = d1 * (d2 - d1) else: tmp = d1 * (d4 - d3) return tmp
function code(d1, d2, d3, d4) tmp = 0.0 if (d4 <= 2.1e-169) tmp = Float64(d1 * Float64(d2 - d3)); elseif (d4 <= 4e-22) 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 (d4 <= 2.1e-169) tmp = d1 * (d2 - d3); elseif (d4 <= 4e-22) tmp = d1 * (d2 - d1); else tmp = d1 * (d4 - d3); end tmp_2 = tmp; end
code[d1_, d2_, d3_, d4_] := If[LessEqual[d4, 2.1e-169], N[(d1 * N[(d2 - d3), $MachinePrecision]), $MachinePrecision], If[LessEqual[d4, 4e-22], N[(d1 * N[(d2 - d1), $MachinePrecision]), $MachinePrecision], N[(d1 * N[(d4 - d3), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;d4 \leq 2.1 \cdot 10^{-169}:\\
\;\;\;\;d1 \cdot \left(d2 - d3\right)\\
\mathbf{elif}\;d4 \leq 4 \cdot 10^{-22}:\\
\;\;\;\;d1 \cdot \left(d2 - d1\right)\\
\mathbf{else}:\\
\;\;\;\;d1 \cdot \left(d4 - d3\right)\\
\end{array}
\end{array}
if d4 < 2.1000000000000001e-169Initial program 90.7%
+-commutative90.7%
*-commutative90.7%
distribute-lft-out--91.3%
distribute-lft-out92.6%
distribute-lft-out--100.0%
Simplified100.0%
Taylor expanded in d1 around 0 77.0%
Taylor expanded in d4 around 0 58.1%
if 2.1000000000000001e-169 < d4 < 4.0000000000000002e-22Initial program 99.9%
+-commutative99.9%
*-commutative99.9%
distribute-lft-out--99.9%
distribute-lft-out99.9%
distribute-lft-out--99.9%
Simplified99.9%
Taylor expanded in d3 around 0 76.1%
Taylor expanded in d4 around 0 70.2%
if 4.0000000000000002e-22 < d4 Initial program 87.9%
+-commutative87.9%
*-commutative87.9%
distribute-lft-out--87.9%
distribute-lft-out89.4%
distribute-lft-out--100.0%
Simplified100.0%
Taylor expanded in d2 around 0 84.0%
+-commutative84.0%
associate--r+84.0%
Simplified84.0%
Taylor expanded in d1 around 0 72.2%
(FPCore (d1 d2 d3 d4) :precision binary64 (if (<= d4 2.9e-6) (* d1 (- d2 d1)) (if (<= d4 8e+36) (* d1 (- d3)) (* d1 (+ d4 d2)))))
double code(double d1, double d2, double d3, double d4) {
double tmp;
if (d4 <= 2.9e-6) {
tmp = d1 * (d2 - d1);
} else if (d4 <= 8e+36) {
tmp = d1 * -d3;
} else {
tmp = d1 * (d4 + d2);
}
return tmp;
}
real(8) function code(d1, d2, d3, d4)
real(8), intent (in) :: d1
real(8), intent (in) :: d2
real(8), intent (in) :: d3
real(8), intent (in) :: d4
real(8) :: tmp
if (d4 <= 2.9d-6) then
tmp = d1 * (d2 - d1)
else if (d4 <= 8d+36) then
tmp = d1 * -d3
else
tmp = d1 * (d4 + d2)
end if
code = tmp
end function
public static double code(double d1, double d2, double d3, double d4) {
double tmp;
if (d4 <= 2.9e-6) {
tmp = d1 * (d2 - d1);
} else if (d4 <= 8e+36) {
tmp = d1 * -d3;
} else {
tmp = d1 * (d4 + d2);
}
return tmp;
}
def code(d1, d2, d3, d4): tmp = 0 if d4 <= 2.9e-6: tmp = d1 * (d2 - d1) elif d4 <= 8e+36: tmp = d1 * -d3 else: tmp = d1 * (d4 + d2) return tmp
function code(d1, d2, d3, d4) tmp = 0.0 if (d4 <= 2.9e-6) tmp = Float64(d1 * Float64(d2 - d1)); elseif (d4 <= 8e+36) tmp = Float64(d1 * Float64(-d3)); else tmp = Float64(d1 * Float64(d4 + d2)); end return tmp end
function tmp_2 = code(d1, d2, d3, d4) tmp = 0.0; if (d4 <= 2.9e-6) tmp = d1 * (d2 - d1); elseif (d4 <= 8e+36) tmp = d1 * -d3; else tmp = d1 * (d4 + d2); end tmp_2 = tmp; end
code[d1_, d2_, d3_, d4_] := If[LessEqual[d4, 2.9e-6], N[(d1 * N[(d2 - d1), $MachinePrecision]), $MachinePrecision], If[LessEqual[d4, 8e+36], N[(d1 * (-d3)), $MachinePrecision], N[(d1 * N[(d4 + d2), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;d4 \leq 2.9 \cdot 10^{-6}:\\
\;\;\;\;d1 \cdot \left(d2 - d1\right)\\
\mathbf{elif}\;d4 \leq 8 \cdot 10^{+36}:\\
\;\;\;\;d1 \cdot \left(-d3\right)\\
\mathbf{else}:\\
\;\;\;\;d1 \cdot \left(d4 + d2\right)\\
\end{array}
\end{array}
if d4 < 2.9000000000000002e-6Initial program 91.7%
+-commutative91.7%
*-commutative91.7%
distribute-lft-out--92.2%
distribute-lft-out93.2%
distribute-lft-out--100.0%
Simplified100.0%
Taylor expanded in d3 around 0 72.1%
Taylor expanded in d4 around 0 54.5%
if 2.9000000000000002e-6 < d4 < 8.00000000000000034e36Initial program 92.3%
+-commutative92.3%
*-commutative92.3%
distribute-lft-out--92.3%
distribute-lft-out92.3%
distribute-lft-out--100.0%
Simplified100.0%
Taylor expanded in d3 around inf 55.5%
mul-1-neg55.5%
distribute-rgt-neg-out55.5%
Simplified55.5%
if 8.00000000000000034e36 < d4 Initial program 88.0%
+-commutative88.0%
*-commutative88.0%
distribute-lft-out--88.0%
distribute-lft-out90.0%
distribute-lft-out--100.0%
Simplified100.0%
Taylor expanded in d3 around 0 88.4%
Taylor expanded in d1 around 0 82.5%
Final simplification60.0%
(FPCore (d1 d2 d3 d4) :precision binary64 (if (<= d4 -1.6e-187) (* d1 d2) (if (<= d4 1.35e+54) (- (* d1 d1)) (* d1 d4))))
double code(double d1, double d2, double d3, double d4) {
double tmp;
if (d4 <= -1.6e-187) {
tmp = d1 * d2;
} else if (d4 <= 1.35e+54) {
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 <= (-1.6d-187)) then
tmp = d1 * d2
else if (d4 <= 1.35d+54) 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 <= -1.6e-187) {
tmp = d1 * d2;
} else if (d4 <= 1.35e+54) {
tmp = -(d1 * d1);
} else {
tmp = d1 * d4;
}
return tmp;
}
def code(d1, d2, d3, d4): tmp = 0 if d4 <= -1.6e-187: tmp = d1 * d2 elif d4 <= 1.35e+54: tmp = -(d1 * d1) else: tmp = d1 * d4 return tmp
function code(d1, d2, d3, d4) tmp = 0.0 if (d4 <= -1.6e-187) tmp = Float64(d1 * d2); elseif (d4 <= 1.35e+54) 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 <= -1.6e-187) tmp = d1 * d2; elseif (d4 <= 1.35e+54) tmp = -(d1 * d1); else tmp = d1 * d4; end tmp_2 = tmp; end
code[d1_, d2_, d3_, d4_] := If[LessEqual[d4, -1.6e-187], N[(d1 * d2), $MachinePrecision], If[LessEqual[d4, 1.35e+54], (-N[(d1 * d1), $MachinePrecision]), N[(d1 * d4), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;d4 \leq -1.6 \cdot 10^{-187}:\\
\;\;\;\;d1 \cdot d2\\
\mathbf{elif}\;d4 \leq 1.35 \cdot 10^{+54}:\\
\;\;\;\;-d1 \cdot d1\\
\mathbf{else}:\\
\;\;\;\;d1 \cdot d4\\
\end{array}
\end{array}
if d4 < -1.5999999999999999e-187Initial program 90.0%
+-commutative90.0%
*-commutative90.0%
distribute-lft-out--90.0%
distribute-lft-out92.0%
distribute-lft-out--100.0%
Simplified100.0%
Taylor expanded in d2 around inf 24.2%
if -1.5999999999999999e-187 < d4 < 1.35000000000000005e54Initial program 93.5%
+-commutative93.5%
*-commutative93.5%
distribute-lft-out--94.4%
distribute-lft-out94.4%
distribute-lft-out--100.0%
Simplified100.0%
Taylor expanded in d1 around inf 44.4%
neg-mul-144.4%
Simplified44.4%
if 1.35000000000000005e54 < d4 Initial program 87.5%
+-commutative87.5%
*-commutative87.5%
distribute-lft-out--87.5%
distribute-lft-out89.6%
distribute-lft-out--100.0%
Simplified100.0%
Taylor expanded in d4 around inf 67.9%
Final simplification40.9%
(FPCore (d1 d2 d3 d4) :precision binary64 (if (<= d2 -7.8e+56) (* d1 (- (+ d4 d2) d3)) (* d1 (- (- d4 d3) d1))))
double code(double d1, double d2, double d3, double d4) {
double tmp;
if (d2 <= -7.8e+56) {
tmp = d1 * ((d4 + d2) - d3);
} else {
tmp = d1 * ((d4 - d3) - d1);
}
return tmp;
}
real(8) function code(d1, d2, d3, d4)
real(8), intent (in) :: d1
real(8), intent (in) :: d2
real(8), intent (in) :: d3
real(8), intent (in) :: d4
real(8) :: tmp
if (d2 <= (-7.8d+56)) then
tmp = d1 * ((d4 + d2) - d3)
else
tmp = d1 * ((d4 - d3) - d1)
end if
code = tmp
end function
public static double code(double d1, double d2, double d3, double d4) {
double tmp;
if (d2 <= -7.8e+56) {
tmp = d1 * ((d4 + d2) - d3);
} else {
tmp = d1 * ((d4 - d3) - d1);
}
return tmp;
}
def code(d1, d2, d3, d4): tmp = 0 if d2 <= -7.8e+56: tmp = d1 * ((d4 + d2) - d3) else: tmp = d1 * ((d4 - d3) - d1) return tmp
function code(d1, d2, d3, d4) tmp = 0.0 if (d2 <= -7.8e+56) tmp = Float64(d1 * Float64(Float64(d4 + d2) - d3)); else tmp = Float64(d1 * Float64(Float64(d4 - d3) - d1)); end return tmp end
function tmp_2 = code(d1, d2, d3, d4) tmp = 0.0; if (d2 <= -7.8e+56) tmp = d1 * ((d4 + d2) - d3); else tmp = d1 * ((d4 - d3) - d1); end tmp_2 = tmp; end
code[d1_, d2_, d3_, d4_] := If[LessEqual[d2, -7.8e+56], N[(d1 * N[(N[(d4 + d2), $MachinePrecision] - d3), $MachinePrecision]), $MachinePrecision], N[(d1 * N[(N[(d4 - d3), $MachinePrecision] - d1), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;d2 \leq -7.8 \cdot 10^{+56}:\\
\;\;\;\;d1 \cdot \left(\left(d4 + d2\right) - d3\right)\\
\mathbf{else}:\\
\;\;\;\;d1 \cdot \left(\left(d4 - d3\right) - d1\right)\\
\end{array}
\end{array}
if d2 < -7.79999999999999989e56Initial program 78.7%
+-commutative78.7%
*-commutative78.7%
distribute-lft-out--81.8%
distribute-lft-out87.8%
distribute-lft-out--100.0%
Simplified100.0%
Taylor expanded in d1 around 0 94.2%
if -7.79999999999999989e56 < d2 Initial program 92.8%
+-commutative92.8%
*-commutative92.8%
distribute-lft-out--92.8%
distribute-lft-out93.3%
distribute-lft-out--100.0%
Simplified100.0%
Taylor expanded in d2 around 0 86.2%
+-commutative86.2%
associate--r+86.2%
Simplified86.2%
Final simplification87.2%
(FPCore (d1 d2 d3 d4) :precision binary64 (if (<= d2 -1.6e-81) (* d1 (- d2 d3)) (* d1 (- d4 d1))))
double code(double d1, double d2, double d3, double d4) {
double tmp;
if (d2 <= -1.6e-81) {
tmp = d1 * (d2 - d3);
} else {
tmp = d1 * (d4 - d1);
}
return tmp;
}
real(8) function code(d1, d2, d3, d4)
real(8), intent (in) :: d1
real(8), intent (in) :: d2
real(8), intent (in) :: d3
real(8), intent (in) :: d4
real(8) :: tmp
if (d2 <= (-1.6d-81)) then
tmp = d1 * (d2 - d3)
else
tmp = d1 * (d4 - d1)
end if
code = tmp
end function
public static double code(double d1, double d2, double d3, double d4) {
double tmp;
if (d2 <= -1.6e-81) {
tmp = d1 * (d2 - d3);
} else {
tmp = d1 * (d4 - d1);
}
return tmp;
}
def code(d1, d2, d3, d4): tmp = 0 if d2 <= -1.6e-81: tmp = d1 * (d2 - d3) else: tmp = d1 * (d4 - d1) return tmp
function code(d1, d2, d3, d4) tmp = 0.0 if (d2 <= -1.6e-81) tmp = Float64(d1 * Float64(d2 - d3)); else tmp = Float64(d1 * Float64(d4 - d1)); end return tmp end
function tmp_2 = code(d1, d2, d3, d4) tmp = 0.0; if (d2 <= -1.6e-81) tmp = d1 * (d2 - d3); else tmp = d1 * (d4 - d1); end tmp_2 = tmp; end
code[d1_, d2_, d3_, d4_] := If[LessEqual[d2, -1.6e-81], N[(d1 * N[(d2 - d3), $MachinePrecision]), $MachinePrecision], N[(d1 * N[(d4 - d1), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;d2 \leq -1.6 \cdot 10^{-81}:\\
\;\;\;\;d1 \cdot \left(d2 - d3\right)\\
\mathbf{else}:\\
\;\;\;\;d1 \cdot \left(d4 - d1\right)\\
\end{array}
\end{array}
if d2 < -1.6e-81Initial program 82.7%
+-commutative82.7%
*-commutative82.7%
distribute-lft-out--84.5%
distribute-lft-out87.9%
distribute-lft-out--100.0%
Simplified100.0%
Taylor expanded in d1 around 0 85.1%
Taylor expanded in d4 around 0 64.3%
if -1.6e-81 < d2 Initial program 93.4%
+-commutative93.4%
*-commutative93.4%
distribute-lft-out--93.4%
distribute-lft-out93.9%
distribute-lft-out--100.0%
Simplified100.0%
Taylor expanded in d2 around 0 85.4%
+-commutative85.4%
associate--r+85.4%
Simplified85.4%
Taylor expanded in d3 around inf 79.1%
*-commutative79.1%
associate-/l*73.6%
distribute-lft-out73.6%
Simplified73.6%
Taylor expanded in d3 around 0 59.0%
(FPCore (d1 d2 d3 d4) :precision binary64 (if (<= d4 2.9e+54) (* d1 d2) (* d1 d4)))
double code(double d1, double d2, double d3, double d4) {
double tmp;
if (d4 <= 2.9e+54) {
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 <= 2.9d+54) 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 <= 2.9e+54) {
tmp = d1 * d2;
} else {
tmp = d1 * d4;
}
return tmp;
}
def code(d1, d2, d3, d4): tmp = 0 if d4 <= 2.9e+54: tmp = d1 * d2 else: tmp = d1 * d4 return tmp
function code(d1, d2, d3, d4) tmp = 0.0 if (d4 <= 2.9e+54) 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 <= 2.9e+54) tmp = d1 * d2; else tmp = d1 * d4; end tmp_2 = tmp; end
code[d1_, d2_, d3_, d4_] := If[LessEqual[d4, 2.9e+54], N[(d1 * d2), $MachinePrecision], N[(d1 * d4), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;d4 \leq 2.9 \cdot 10^{+54}:\\
\;\;\;\;d1 \cdot d2\\
\mathbf{else}:\\
\;\;\;\;d1 \cdot d4\\
\end{array}
\end{array}
if d4 < 2.8999999999999999e54Initial program 91.8%
+-commutative91.8%
*-commutative91.8%
distribute-lft-out--92.3%
distribute-lft-out93.2%
distribute-lft-out--100.0%
Simplified100.0%
Taylor expanded in d2 around inf 26.2%
if 2.8999999999999999e54 < d4 Initial program 87.5%
+-commutative87.5%
*-commutative87.5%
distribute-lft-out--87.5%
distribute-lft-out89.6%
distribute-lft-out--100.0%
Simplified100.0%
Taylor expanded in d4 around inf 67.9%
(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 91.0%
+-commutative91.0%
*-commutative91.0%
distribute-lft-out--91.4%
distribute-lft-out92.6%
distribute-lft-out--100.0%
Simplified100.0%
Taylor expanded in d2 around inf 24.9%
(FPCore (d1 d2 d3 d4) :precision binary64 (* d1 d1))
double code(double d1, double d2, double d3, double d4) {
return 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 * d1
end function
public static double code(double d1, double d2, double d3, double d4) {
return d1 * d1;
}
def code(d1, d2, d3, d4): return d1 * d1
function code(d1, d2, d3, d4) return Float64(d1 * d1) end
function tmp = code(d1, d2, d3, d4) tmp = d1 * d1; end
code[d1_, d2_, d3_, d4_] := N[(d1 * d1), $MachinePrecision]
\begin{array}{l}
\\
d1 \cdot d1
\end{array}
Initial program 91.0%
+-commutative91.0%
*-commutative91.0%
distribute-lft-out--91.4%
distribute-lft-out92.6%
distribute-lft-out--100.0%
Simplified100.0%
Taylor expanded in d1 around inf 31.0%
neg-mul-131.0%
Simplified31.0%
neg-sub031.0%
sub-neg31.0%
add-sqr-sqrt14.3%
sqrt-unprod17.4%
sqr-neg17.4%
sqrt-unprod3.1%
add-sqr-sqrt7.4%
Applied egg-rr7.4%
+-lft-identity7.4%
Simplified7.4%
(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 2024157
(FPCore (d1 d2 d3 d4)
:name "FastMath dist4"
:precision binary64
:alt
(! :herbie-platform default (* d1 (- (+ (- d2 d3) d4) d1)))
(- (+ (- (* d1 d2) (* d1 d3)) (* d4 d1)) (* d1 d1)))