
(FPCore (d1 d2 d3 d4) :precision binary64 (- (+ (- (* d1 d2) (* d1 d3)) (* d4 d1)) (* d1 d1)))
double code(double d1, double d2, double d3, double d4) {
return (((d1 * d2) - (d1 * d3)) + (d4 * d1)) - (d1 * d1);
}
real(8) function code(d1, d2, d3, d4)
real(8), intent (in) :: d1
real(8), intent (in) :: d2
real(8), intent (in) :: d3
real(8), intent (in) :: d4
code = (((d1 * d2) - (d1 * d3)) + (d4 * d1)) - (d1 * d1)
end function
public static double code(double d1, double d2, double d3, double d4) {
return (((d1 * d2) - (d1 * d3)) + (d4 * d1)) - (d1 * d1);
}
def code(d1, d2, d3, d4): return (((d1 * d2) - (d1 * d3)) + (d4 * d1)) - (d1 * d1)
function code(d1, d2, d3, d4) return Float64(Float64(Float64(Float64(d1 * d2) - Float64(d1 * d3)) + Float64(d4 * d1)) - Float64(d1 * d1)) end
function tmp = code(d1, d2, d3, d4) tmp = (((d1 * d2) - (d1 * d3)) + (d4 * d1)) - (d1 * d1); end
code[d1_, d2_, d3_, d4_] := N[(N[(N[(N[(d1 * d2), $MachinePrecision] - N[(d1 * d3), $MachinePrecision]), $MachinePrecision] + N[(d4 * d1), $MachinePrecision]), $MachinePrecision] - N[(d1 * d1), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
\left(\left(d1 \cdot d2 - d1 \cdot d3\right) + d4 \cdot d1\right) - d1 \cdot d1
\end{array}
Sampling outcomes in binary64 precision:
Herbie found 14 alternatives:
| Alternative | Accuracy | Speedup |
|---|
(FPCore (d1 d2 d3 d4) :precision binary64 (- (+ (- (* d1 d2) (* d1 d3)) (* d4 d1)) (* d1 d1)))
double code(double d1, double d2, double d3, double d4) {
return (((d1 * d2) - (d1 * d3)) + (d4 * d1)) - (d1 * d1);
}
real(8) function code(d1, d2, d3, d4)
real(8), intent (in) :: d1
real(8), intent (in) :: d2
real(8), intent (in) :: d3
real(8), intent (in) :: d4
code = (((d1 * d2) - (d1 * d3)) + (d4 * d1)) - (d1 * d1)
end function
public static double code(double d1, double d2, double d3, double d4) {
return (((d1 * d2) - (d1 * d3)) + (d4 * d1)) - (d1 * d1);
}
def code(d1, d2, d3, d4): return (((d1 * d2) - (d1 * d3)) + (d4 * d1)) - (d1 * d1)
function code(d1, d2, d3, d4) return Float64(Float64(Float64(Float64(d1 * d2) - Float64(d1 * d3)) + Float64(d4 * d1)) - Float64(d1 * d1)) end
function tmp = code(d1, d2, d3, d4) tmp = (((d1 * d2) - (d1 * d3)) + (d4 * d1)) - (d1 * d1); end
code[d1_, d2_, d3_, d4_] := N[(N[(N[(N[(d1 * d2), $MachinePrecision] - N[(d1 * d3), $MachinePrecision]), $MachinePrecision] + N[(d4 * d1), $MachinePrecision]), $MachinePrecision] - N[(d1 * d1), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
\left(\left(d1 \cdot d2 - d1 \cdot d3\right) + d4 \cdot d1\right) - d1 \cdot d1
\end{array}
(FPCore (d1 d2 d3 d4) :precision binary64 (* d1 (- (+ d4 (- 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 84.4%
+-commutative84.4%
*-commutative84.4%
distribute-lft-out--86.3%
distribute-lft-out87.9%
distribute-lft-out--100.0%
Simplified100.0%
(FPCore (d1 d2 d3 d4)
:precision binary64
(if (<= d2 -8.2e+198)
(* d1 (+ d4 d2))
(if (<= d2 -4.1e-11)
(* d1 (- d2 d1))
(if (or (<= d2 -2.4e-97) (not (<= d2 1.2e-284)))
(* d1 (- d4 d1))
(* d1 (- d4 d3))))))
double code(double d1, double d2, double d3, double d4) {
double tmp;
if (d2 <= -8.2e+198) {
tmp = d1 * (d4 + d2);
} else if (d2 <= -4.1e-11) {
tmp = d1 * (d2 - d1);
} else if ((d2 <= -2.4e-97) || !(d2 <= 1.2e-284)) {
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 <= (-8.2d+198)) then
tmp = d1 * (d4 + d2)
else if (d2 <= (-4.1d-11)) then
tmp = d1 * (d2 - d1)
else if ((d2 <= (-2.4d-97)) .or. (.not. (d2 <= 1.2d-284))) 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 <= -8.2e+198) {
tmp = d1 * (d4 + d2);
} else if (d2 <= -4.1e-11) {
tmp = d1 * (d2 - d1);
} else if ((d2 <= -2.4e-97) || !(d2 <= 1.2e-284)) {
tmp = d1 * (d4 - d1);
} else {
tmp = d1 * (d4 - d3);
}
return tmp;
}
def code(d1, d2, d3, d4): tmp = 0 if d2 <= -8.2e+198: tmp = d1 * (d4 + d2) elif d2 <= -4.1e-11: tmp = d1 * (d2 - d1) elif (d2 <= -2.4e-97) or not (d2 <= 1.2e-284): tmp = d1 * (d4 - d1) else: tmp = d1 * (d4 - d3) return tmp
function code(d1, d2, d3, d4) tmp = 0.0 if (d2 <= -8.2e+198) tmp = Float64(d1 * Float64(d4 + d2)); elseif (d2 <= -4.1e-11) tmp = Float64(d1 * Float64(d2 - d1)); elseif ((d2 <= -2.4e-97) || !(d2 <= 1.2e-284)) 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 <= -8.2e+198) tmp = d1 * (d4 + d2); elseif (d2 <= -4.1e-11) tmp = d1 * (d2 - d1); elseif ((d2 <= -2.4e-97) || ~((d2 <= 1.2e-284))) tmp = d1 * (d4 - d1); else tmp = d1 * (d4 - d3); end tmp_2 = tmp; end
code[d1_, d2_, d3_, d4_] := If[LessEqual[d2, -8.2e+198], N[(d1 * N[(d4 + d2), $MachinePrecision]), $MachinePrecision], If[LessEqual[d2, -4.1e-11], N[(d1 * N[(d2 - d1), $MachinePrecision]), $MachinePrecision], If[Or[LessEqual[d2, -2.4e-97], N[Not[LessEqual[d2, 1.2e-284]], $MachinePrecision]], N[(d1 * N[(d4 - d1), $MachinePrecision]), $MachinePrecision], N[(d1 * N[(d4 - d3), $MachinePrecision]), $MachinePrecision]]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;d2 \leq -8.2 \cdot 10^{+198}:\\
\;\;\;\;d1 \cdot \left(d4 + d2\right)\\
\mathbf{elif}\;d2 \leq -4.1 \cdot 10^{-11}:\\
\;\;\;\;d1 \cdot \left(d2 - d1\right)\\
\mathbf{elif}\;d2 \leq -2.4 \cdot 10^{-97} \lor \neg \left(d2 \leq 1.2 \cdot 10^{-284}\right):\\
\;\;\;\;d1 \cdot \left(d4 - d1\right)\\
\mathbf{else}:\\
\;\;\;\;d1 \cdot \left(d4 - d3\right)\\
\end{array}
\end{array}
if d2 < -8.2000000000000003e198Initial program 74.1%
+-commutative74.1%
*-commutative74.1%
distribute-lft-out--77.8%
distribute-lft-out81.5%
distribute-lft-out--100.0%
Simplified100.0%
Taylor expanded in d3 around 0 100.0%
Taylor expanded in d1 around 0 100.0%
if -8.2000000000000003e198 < d2 < -4.1000000000000001e-11Initial program 75.5%
+-commutative75.5%
*-commutative75.5%
distribute-lft-out--79.2%
distribute-lft-out81.1%
distribute-lft-out--100.0%
Simplified100.0%
Taylor expanded in d3 around 0 74.7%
Taylor expanded in d4 around 0 62.5%
if -4.1000000000000001e-11 < d2 < -2.4e-97 or 1.20000000000000001e-284 < d2 Initial program 86.5%
+-commutative86.5%
*-commutative86.5%
distribute-lft-out--88.0%
distribute-lft-out89.5%
distribute-lft-out--100.0%
Simplified100.0%
Taylor expanded in d3 around 0 81.6%
Taylor expanded in d2 around 0 61.9%
if -2.4e-97 < d2 < 1.20000000000000001e-284Initial program 95.3%
+-commutative95.3%
*-commutative95.3%
distribute-lft-out--95.3%
distribute-lft-out95.3%
distribute-lft-out--100.0%
Simplified100.0%
Taylor expanded in d2 around 0 100.0%
+-commutative100.0%
associate--r+100.0%
Simplified100.0%
Taylor expanded in d1 around 0 76.1%
Final simplification68.4%
(FPCore (d1 d2 d3 d4)
:precision binary64
(if (<= d4 4.8e-214)
(* d1 (- d2 d1))
(if (<= d4 51000000000000.0)
(* d1 (- (- d1) d3))
(if (<= d4 1.5e+131) (* d1 (+ d4 d2)) (* d1 (- d4 d1))))))
double code(double d1, double d2, double d3, double d4) {
double tmp;
if (d4 <= 4.8e-214) {
tmp = d1 * (d2 - d1);
} else if (d4 <= 51000000000000.0) {
tmp = d1 * (-d1 - d3);
} else if (d4 <= 1.5e+131) {
tmp = d1 * (d4 + d2);
} 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 (d4 <= 4.8d-214) then
tmp = d1 * (d2 - d1)
else if (d4 <= 51000000000000.0d0) then
tmp = d1 * (-d1 - d3)
else if (d4 <= 1.5d+131) then
tmp = d1 * (d4 + d2)
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 (d4 <= 4.8e-214) {
tmp = d1 * (d2 - d1);
} else if (d4 <= 51000000000000.0) {
tmp = d1 * (-d1 - d3);
} else if (d4 <= 1.5e+131) {
tmp = d1 * (d4 + d2);
} else {
tmp = d1 * (d4 - d1);
}
return tmp;
}
def code(d1, d2, d3, d4): tmp = 0 if d4 <= 4.8e-214: tmp = d1 * (d2 - d1) elif d4 <= 51000000000000.0: tmp = d1 * (-d1 - d3) elif d4 <= 1.5e+131: tmp = d1 * (d4 + d2) else: tmp = d1 * (d4 - d1) return tmp
function code(d1, d2, d3, d4) tmp = 0.0 if (d4 <= 4.8e-214) tmp = Float64(d1 * Float64(d2 - d1)); elseif (d4 <= 51000000000000.0) tmp = Float64(d1 * Float64(Float64(-d1) - d3)); elseif (d4 <= 1.5e+131) tmp = Float64(d1 * Float64(d4 + d2)); else tmp = Float64(d1 * Float64(d4 - d1)); end return tmp end
function tmp_2 = code(d1, d2, d3, d4) tmp = 0.0; if (d4 <= 4.8e-214) tmp = d1 * (d2 - d1); elseif (d4 <= 51000000000000.0) tmp = d1 * (-d1 - d3); elseif (d4 <= 1.5e+131) tmp = d1 * (d4 + d2); else tmp = d1 * (d4 - d1); end tmp_2 = tmp; end
code[d1_, d2_, d3_, d4_] := If[LessEqual[d4, 4.8e-214], N[(d1 * N[(d2 - d1), $MachinePrecision]), $MachinePrecision], If[LessEqual[d4, 51000000000000.0], N[(d1 * N[((-d1) - d3), $MachinePrecision]), $MachinePrecision], If[LessEqual[d4, 1.5e+131], N[(d1 * N[(d4 + d2), $MachinePrecision]), $MachinePrecision], N[(d1 * N[(d4 - d1), $MachinePrecision]), $MachinePrecision]]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;d4 \leq 4.8 \cdot 10^{-214}:\\
\;\;\;\;d1 \cdot \left(d2 - d1\right)\\
\mathbf{elif}\;d4 \leq 51000000000000:\\
\;\;\;\;d1 \cdot \left(\left(-d1\right) - d3\right)\\
\mathbf{elif}\;d4 \leq 1.5 \cdot 10^{+131}:\\
\;\;\;\;d1 \cdot \left(d4 + d2\right)\\
\mathbf{else}:\\
\;\;\;\;d1 \cdot \left(d4 - d1\right)\\
\end{array}
\end{array}
if d4 < 4.80000000000000041e-214Initial program 88.0%
+-commutative88.0%
*-commutative88.0%
distribute-lft-out--89.3%
distribute-lft-out90.7%
distribute-lft-out--100.0%
Simplified100.0%
Taylor expanded in d3 around 0 81.4%
Taylor expanded in d4 around 0 59.5%
if 4.80000000000000041e-214 < d4 < 5.1e13Initial program 86.8%
+-commutative86.8%
*-commutative86.8%
distribute-lft-out--92.1%
distribute-lft-out92.1%
distribute-lft-out--100.0%
Simplified100.0%
Taylor expanded in d2 around 0 84.9%
+-commutative84.9%
associate--r+84.9%
Simplified84.9%
Taylor expanded in d4 around 0 82.5%
mul-1-neg82.5%
*-commutative82.5%
distribute-rgt-neg-in82.5%
Simplified82.5%
if 5.1e13 < d4 < 1.5000000000000001e131Initial program 87.5%
+-commutative87.5%
*-commutative87.5%
distribute-lft-out--87.5%
distribute-lft-out87.4%
distribute-lft-out--99.9%
Simplified99.9%
Taylor expanded in d3 around 0 72.2%
Taylor expanded in d1 around 0 56.1%
if 1.5000000000000001e131 < d4 Initial program 68.2%
+-commutative68.2%
*-commutative68.2%
distribute-lft-out--70.5%
distribute-lft-out75.0%
distribute-lft-out--100.0%
Simplified100.0%
Taylor expanded in d3 around 0 97.0%
Taylor expanded in d2 around 0 92.7%
Final simplification68.3%
(FPCore (d1 d2 d3 d4)
:precision binary64
(if (<= d4 2.9e-213)
(* d1 d2)
(if (<= d4 1.45e-64)
(* d1 (- d1))
(if (<= d4 1.25e+75) (* d1 (- d3)) (* d1 d4)))))
double code(double d1, double d2, double d3, double d4) {
double tmp;
if (d4 <= 2.9e-213) {
tmp = d1 * d2;
} else if (d4 <= 1.45e-64) {
tmp = d1 * -d1;
} else if (d4 <= 1.25e+75) {
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 (d4 <= 2.9d-213) then
tmp = d1 * d2
else if (d4 <= 1.45d-64) then
tmp = d1 * -d1
else if (d4 <= 1.25d+75) 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 (d4 <= 2.9e-213) {
tmp = d1 * d2;
} else if (d4 <= 1.45e-64) {
tmp = d1 * -d1;
} else if (d4 <= 1.25e+75) {
tmp = d1 * -d3;
} else {
tmp = d1 * d4;
}
return tmp;
}
def code(d1, d2, d3, d4): tmp = 0 if d4 <= 2.9e-213: tmp = d1 * d2 elif d4 <= 1.45e-64: tmp = d1 * -d1 elif d4 <= 1.25e+75: tmp = d1 * -d3 else: tmp = d1 * d4 return tmp
function code(d1, d2, d3, d4) tmp = 0.0 if (d4 <= 2.9e-213) tmp = Float64(d1 * d2); elseif (d4 <= 1.45e-64) tmp = Float64(d1 * Float64(-d1)); elseif (d4 <= 1.25e+75) 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 (d4 <= 2.9e-213) tmp = d1 * d2; elseif (d4 <= 1.45e-64) tmp = d1 * -d1; elseif (d4 <= 1.25e+75) tmp = d1 * -d3; else tmp = d1 * d4; end tmp_2 = tmp; end
code[d1_, d2_, d3_, d4_] := If[LessEqual[d4, 2.9e-213], N[(d1 * d2), $MachinePrecision], If[LessEqual[d4, 1.45e-64], N[(d1 * (-d1)), $MachinePrecision], If[LessEqual[d4, 1.25e+75], N[(d1 * (-d3)), $MachinePrecision], N[(d1 * d4), $MachinePrecision]]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;d4 \leq 2.9 \cdot 10^{-213}:\\
\;\;\;\;d1 \cdot d2\\
\mathbf{elif}\;d4 \leq 1.45 \cdot 10^{-64}:\\
\;\;\;\;d1 \cdot \left(-d1\right)\\
\mathbf{elif}\;d4 \leq 1.25 \cdot 10^{+75}:\\
\;\;\;\;d1 \cdot \left(-d3\right)\\
\mathbf{else}:\\
\;\;\;\;d1 \cdot d4\\
\end{array}
\end{array}
if d4 < 2.8999999999999999e-213Initial program 88.0%
+-commutative88.0%
*-commutative88.0%
distribute-lft-out--89.3%
distribute-lft-out90.7%
distribute-lft-out--100.0%
Simplified100.0%
Taylor expanded in d2 around inf 38.4%
if 2.8999999999999999e-213 < d4 < 1.4499999999999999e-64Initial program 81.0%
+-commutative81.0%
*-commutative81.0%
distribute-lft-out--90.5%
distribute-lft-out90.5%
distribute-lft-out--100.0%
Simplified100.0%
Taylor expanded in d1 around inf 75.9%
neg-mul-175.9%
Simplified75.9%
if 1.4499999999999999e-64 < d4 < 1.2500000000000001e75Initial program 88.6%
+-commutative88.6%
*-commutative88.6%
distribute-lft-out--88.6%
distribute-lft-out88.6%
distribute-lft-out--100.0%
Simplified100.0%
Taylor expanded in d3 around inf 36.7%
mul-1-neg36.7%
distribute-rgt-neg-out36.7%
Simplified36.7%
if 1.2500000000000001e75 < d4 Initial program 72.0%
+-commutative72.0%
*-commutative72.0%
distribute-lft-out--74.0%
distribute-lft-out78.0%
distribute-lft-out--100.0%
Simplified100.0%
Taylor expanded in d4 around inf 69.2%
(FPCore (d1 d2 d3 d4) :precision binary64 (if (or (<= d3 -2.3e+231) (not (<= d3 6.5e+189))) (* d1 (- d4 d3)) (* d1 (- (+ d4 d2) d1))))
double code(double d1, double d2, double d3, double d4) {
double tmp;
if ((d3 <= -2.3e+231) || !(d3 <= 6.5e+189)) {
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.3d+231)) .or. (.not. (d3 <= 6.5d+189))) 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.3e+231) || !(d3 <= 6.5e+189)) {
tmp = d1 * (d4 - d3);
} else {
tmp = d1 * ((d4 + d2) - d1);
}
return tmp;
}
def code(d1, d2, d3, d4): tmp = 0 if (d3 <= -2.3e+231) or not (d3 <= 6.5e+189): tmp = d1 * (d4 - d3) else: tmp = d1 * ((d4 + d2) - d1) return tmp
function code(d1, d2, d3, d4) tmp = 0.0 if ((d3 <= -2.3e+231) || !(d3 <= 6.5e+189)) 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.3e+231) || ~((d3 <= 6.5e+189))) 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.3e+231], N[Not[LessEqual[d3, 6.5e+189]], $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.3 \cdot 10^{+231} \lor \neg \left(d3 \leq 6.5 \cdot 10^{+189}\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.29999999999999999e231 or 6.50000000000000027e189 < d3 Initial program 88.6%
+-commutative88.6%
*-commutative88.6%
distribute-lft-out--94.3%
distribute-lft-out94.3%
distribute-lft-out--100.0%
Simplified100.0%
Taylor expanded in d2 around 0 80.8%
+-commutative80.8%
associate--r+80.8%
Simplified80.8%
Taylor expanded in d1 around 0 77.9%
if -2.29999999999999999e231 < d3 < 6.50000000000000027e189Initial program 83.7%
+-commutative83.7%
*-commutative83.7%
distribute-lft-out--85.1%
distribute-lft-out86.9%
distribute-lft-out--100.0%
Simplified100.0%
Taylor expanded in d3 around 0 89.4%
Final simplification87.8%
(FPCore (d1 d2 d3 d4) :precision binary64 (if (or (<= d1 -5.1e+127) (not (<= d1 1.4e+161))) (* d1 (- d1)) (* d1 (+ d4 d2))))
double code(double d1, double d2, double d3, double d4) {
double tmp;
if ((d1 <= -5.1e+127) || !(d1 <= 1.4e+161)) {
tmp = d1 * -d1;
} else {
tmp = d1 * (d4 + d2);
}
return tmp;
}
real(8) function code(d1, d2, d3, d4)
real(8), intent (in) :: d1
real(8), intent (in) :: d2
real(8), intent (in) :: d3
real(8), intent (in) :: d4
real(8) :: tmp
if ((d1 <= (-5.1d+127)) .or. (.not. (d1 <= 1.4d+161))) then
tmp = d1 * -d1
else
tmp = d1 * (d4 + d2)
end if
code = tmp
end function
public static double code(double d1, double d2, double d3, double d4) {
double tmp;
if ((d1 <= -5.1e+127) || !(d1 <= 1.4e+161)) {
tmp = d1 * -d1;
} else {
tmp = d1 * (d4 + d2);
}
return tmp;
}
def code(d1, d2, d3, d4): tmp = 0 if (d1 <= -5.1e+127) or not (d1 <= 1.4e+161): tmp = d1 * -d1 else: tmp = d1 * (d4 + d2) return tmp
function code(d1, d2, d3, d4) tmp = 0.0 if ((d1 <= -5.1e+127) || !(d1 <= 1.4e+161)) tmp = Float64(d1 * Float64(-d1)); else tmp = Float64(d1 * Float64(d4 + d2)); end return tmp end
function tmp_2 = code(d1, d2, d3, d4) tmp = 0.0; if ((d1 <= -5.1e+127) || ~((d1 <= 1.4e+161))) tmp = d1 * -d1; else tmp = d1 * (d4 + d2); end tmp_2 = tmp; end
code[d1_, d2_, d3_, d4_] := If[Or[LessEqual[d1, -5.1e+127], N[Not[LessEqual[d1, 1.4e+161]], $MachinePrecision]], N[(d1 * (-d1)), $MachinePrecision], N[(d1 * N[(d4 + d2), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;d1 \leq -5.1 \cdot 10^{+127} \lor \neg \left(d1 \leq 1.4 \cdot 10^{+161}\right):\\
\;\;\;\;d1 \cdot \left(-d1\right)\\
\mathbf{else}:\\
\;\;\;\;d1 \cdot \left(d4 + d2\right)\\
\end{array}
\end{array}
if d1 < -5.10000000000000038e127 or 1.4000000000000001e161 < d1 Initial program 54.3%
+-commutative54.3%
*-commutative54.3%
distribute-lft-out--58.0%
distribute-lft-out63.0%
distribute-lft-out--100.0%
Simplified100.0%
Taylor expanded in d1 around inf 84.8%
neg-mul-184.8%
Simplified84.8%
if -5.10000000000000038e127 < d1 < 1.4000000000000001e161Initial program 98.3%
+-commutative98.3%
*-commutative98.3%
distribute-lft-out--99.4%
distribute-lft-out99.4%
distribute-lft-out--100.0%
Simplified100.0%
Taylor expanded in d3 around 0 74.7%
Taylor expanded in d1 around 0 69.1%
Final simplification74.1%
(FPCore (d1 d2 d3 d4) :precision binary64 (if (<= d2 -3.9e+194) (* d1 (+ d4 d2)) (if (<= d2 -4.6e-8) (* d1 (- d2 d1)) (* d1 (- d4 d1)))))
double code(double d1, double d2, double d3, double d4) {
double tmp;
if (d2 <= -3.9e+194) {
tmp = d1 * (d4 + d2);
} else if (d2 <= -4.6e-8) {
tmp = d1 * (d2 - d1);
} 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 <= (-3.9d+194)) then
tmp = d1 * (d4 + d2)
else if (d2 <= (-4.6d-8)) then
tmp = d1 * (d2 - d1)
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 <= -3.9e+194) {
tmp = d1 * (d4 + d2);
} else if (d2 <= -4.6e-8) {
tmp = d1 * (d2 - d1);
} else {
tmp = d1 * (d4 - d1);
}
return tmp;
}
def code(d1, d2, d3, d4): tmp = 0 if d2 <= -3.9e+194: tmp = d1 * (d4 + d2) elif d2 <= -4.6e-8: tmp = d1 * (d2 - d1) else: tmp = d1 * (d4 - d1) return tmp
function code(d1, d2, d3, d4) tmp = 0.0 if (d2 <= -3.9e+194) tmp = Float64(d1 * Float64(d4 + d2)); elseif (d2 <= -4.6e-8) tmp = Float64(d1 * Float64(d2 - d1)); else tmp = Float64(d1 * Float64(d4 - d1)); end return tmp end
function tmp_2 = code(d1, d2, d3, d4) tmp = 0.0; if (d2 <= -3.9e+194) tmp = d1 * (d4 + d2); elseif (d2 <= -4.6e-8) tmp = d1 * (d2 - d1); else tmp = d1 * (d4 - d1); end tmp_2 = tmp; end
code[d1_, d2_, d3_, d4_] := If[LessEqual[d2, -3.9e+194], N[(d1 * N[(d4 + d2), $MachinePrecision]), $MachinePrecision], If[LessEqual[d2, -4.6e-8], N[(d1 * N[(d2 - d1), $MachinePrecision]), $MachinePrecision], N[(d1 * N[(d4 - d1), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;d2 \leq -3.9 \cdot 10^{+194}:\\
\;\;\;\;d1 \cdot \left(d4 + d2\right)\\
\mathbf{elif}\;d2 \leq -4.6 \cdot 10^{-8}:\\
\;\;\;\;d1 \cdot \left(d2 - d1\right)\\
\mathbf{else}:\\
\;\;\;\;d1 \cdot \left(d4 - d1\right)\\
\end{array}
\end{array}
if d2 < -3.90000000000000016e194Initial program 74.1%
+-commutative74.1%
*-commutative74.1%
distribute-lft-out--77.8%
distribute-lft-out81.5%
distribute-lft-out--100.0%
Simplified100.0%
Taylor expanded in d3 around 0 100.0%
Taylor expanded in d1 around 0 100.0%
if -3.90000000000000016e194 < d2 < -4.6000000000000002e-8Initial program 76.9%
+-commutative76.9%
*-commutative76.9%
distribute-lft-out--80.8%
distribute-lft-out82.7%
distribute-lft-out--100.0%
Simplified100.0%
Taylor expanded in d3 around 0 74.2%
Taylor expanded in d4 around 0 63.7%
if -4.6000000000000002e-8 < d2 Initial program 88.1%
+-commutative88.1%
*-commutative88.1%
distribute-lft-out--89.3%
distribute-lft-out90.4%
distribute-lft-out--100.0%
Simplified100.0%
Taylor expanded in d3 around 0 81.8%
Taylor expanded in d2 around 0 67.0%
Final simplification69.8%
(FPCore (d1 d2 d3 d4) :precision binary64 (if (<= d4 2.4e-214) (* d1 d2) (if (<= d4 8e+86) (* d1 (- d1)) (* d1 d4))))
double code(double d1, double d2, double d3, double d4) {
double tmp;
if (d4 <= 2.4e-214) {
tmp = d1 * d2;
} else if (d4 <= 8e+86) {
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 <= 2.4d-214) then
tmp = d1 * d2
else if (d4 <= 8d+86) 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 <= 2.4e-214) {
tmp = d1 * d2;
} else if (d4 <= 8e+86) {
tmp = d1 * -d1;
} else {
tmp = d1 * d4;
}
return tmp;
}
def code(d1, d2, d3, d4): tmp = 0 if d4 <= 2.4e-214: tmp = d1 * d2 elif d4 <= 8e+86: tmp = d1 * -d1 else: tmp = d1 * d4 return tmp
function code(d1, d2, d3, d4) tmp = 0.0 if (d4 <= 2.4e-214) tmp = Float64(d1 * d2); elseif (d4 <= 8e+86) 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 <= 2.4e-214) tmp = d1 * d2; elseif (d4 <= 8e+86) tmp = d1 * -d1; else tmp = d1 * d4; end tmp_2 = tmp; end
code[d1_, d2_, d3_, d4_] := If[LessEqual[d4, 2.4e-214], N[(d1 * d2), $MachinePrecision], If[LessEqual[d4, 8e+86], N[(d1 * (-d1)), $MachinePrecision], N[(d1 * d4), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;d4 \leq 2.4 \cdot 10^{-214}:\\
\;\;\;\;d1 \cdot d2\\
\mathbf{elif}\;d4 \leq 8 \cdot 10^{+86}:\\
\;\;\;\;d1 \cdot \left(-d1\right)\\
\mathbf{else}:\\
\;\;\;\;d1 \cdot d4\\
\end{array}
\end{array}
if d4 < 2.4000000000000002e-214Initial program 88.0%
+-commutative88.0%
*-commutative88.0%
distribute-lft-out--89.3%
distribute-lft-out90.7%
distribute-lft-out--100.0%
Simplified100.0%
Taylor expanded in d2 around inf 38.4%
if 2.4000000000000002e-214 < d4 < 8.0000000000000001e86Initial program 86.0%
+-commutative86.0%
*-commutative86.0%
distribute-lft-out--89.5%
distribute-lft-out89.4%
distribute-lft-out--100.0%
Simplified100.0%
Taylor expanded in d1 around inf 45.5%
neg-mul-145.5%
Simplified45.5%
if 8.0000000000000001e86 < d4 Initial program 71.4%
+-commutative71.4%
*-commutative71.4%
distribute-lft-out--73.5%
distribute-lft-out77.6%
distribute-lft-out--100.0%
Simplified100.0%
Taylor expanded in d4 around inf 70.1%
(FPCore (d1 d2 d3 d4) :precision binary64 (if (<= d2 -4.1e-8) (* d1 (- (+ d4 d2) d1)) (* d1 (- (- d4 d3) d1))))
double code(double d1, double d2, double d3, double d4) {
double tmp;
if (d2 <= -4.1e-8) {
tmp = d1 * ((d4 + d2) - d1);
} 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 <= (-4.1d-8)) then
tmp = d1 * ((d4 + d2) - d1)
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 <= -4.1e-8) {
tmp = d1 * ((d4 + d2) - d1);
} else {
tmp = d1 * ((d4 - d3) - d1);
}
return tmp;
}
def code(d1, d2, d3, d4): tmp = 0 if d2 <= -4.1e-8: tmp = d1 * ((d4 + d2) - d1) else: tmp = d1 * ((d4 - d3) - d1) return tmp
function code(d1, d2, d3, d4) tmp = 0.0 if (d2 <= -4.1e-8) tmp = Float64(d1 * Float64(Float64(d4 + d2) - d1)); 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 <= -4.1e-8) tmp = d1 * ((d4 + d2) - d1); else tmp = d1 * ((d4 - d3) - d1); end tmp_2 = tmp; end
code[d1_, d2_, d3_, d4_] := If[LessEqual[d2, -4.1e-8], N[(d1 * N[(N[(d4 + d2), $MachinePrecision] - d1), $MachinePrecision]), $MachinePrecision], N[(d1 * N[(N[(d4 - d3), $MachinePrecision] - d1), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;d2 \leq -4.1 \cdot 10^{-8}:\\
\;\;\;\;d1 \cdot \left(\left(d4 + d2\right) - d1\right)\\
\mathbf{else}:\\
\;\;\;\;d1 \cdot \left(\left(d4 - d3\right) - d1\right)\\
\end{array}
\end{array}
if d2 < -4.10000000000000032e-8Initial program 75.9%
+-commutative75.9%
*-commutative75.9%
distribute-lft-out--79.7%
distribute-lft-out82.3%
distribute-lft-out--100.0%
Simplified100.0%
Taylor expanded in d3 around 0 83.0%
if -4.10000000000000032e-8 < d2 Initial program 88.1%
+-commutative88.1%
*-commutative88.1%
distribute-lft-out--89.3%
distribute-lft-out90.4%
distribute-lft-out--100.0%
Simplified100.0%
Taylor expanded in d2 around 0 85.3%
+-commutative85.3%
associate--r+85.3%
Simplified85.3%
Final simplification84.6%
(FPCore (d1 d2 d3 d4) :precision binary64 (if (<= d4 2100000000.0) (* d1 (- d2 d1)) (* d1 (+ d4 d2))))
double code(double d1, double d2, double d3, double d4) {
double tmp;
if (d4 <= 2100000000.0) {
tmp = d1 * (d2 - d1);
} else {
tmp = d1 * (d4 + d2);
}
return tmp;
}
real(8) function code(d1, d2, d3, d4)
real(8), intent (in) :: d1
real(8), intent (in) :: d2
real(8), intent (in) :: d3
real(8), intent (in) :: d4
real(8) :: tmp
if (d4 <= 2100000000.0d0) then
tmp = d1 * (d2 - d1)
else
tmp = d1 * (d4 + d2)
end if
code = tmp
end function
public static double code(double d1, double d2, double d3, double d4) {
double tmp;
if (d4 <= 2100000000.0) {
tmp = d1 * (d2 - d1);
} else {
tmp = d1 * (d4 + d2);
}
return tmp;
}
def code(d1, d2, d3, d4): tmp = 0 if d4 <= 2100000000.0: tmp = d1 * (d2 - d1) else: tmp = d1 * (d4 + d2) return tmp
function code(d1, d2, d3, d4) tmp = 0.0 if (d4 <= 2100000000.0) tmp = Float64(d1 * Float64(d2 - d1)); else tmp = Float64(d1 * Float64(d4 + d2)); end return tmp end
function tmp_2 = code(d1, d2, d3, d4) tmp = 0.0; if (d4 <= 2100000000.0) tmp = d1 * (d2 - d1); else tmp = d1 * (d4 + d2); end tmp_2 = tmp; end
code[d1_, d2_, d3_, d4_] := If[LessEqual[d4, 2100000000.0], N[(d1 * N[(d2 - d1), $MachinePrecision]), $MachinePrecision], N[(d1 * N[(d4 + d2), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;d4 \leq 2100000000:\\
\;\;\;\;d1 \cdot \left(d2 - d1\right)\\
\mathbf{else}:\\
\;\;\;\;d1 \cdot \left(d4 + d2\right)\\
\end{array}
\end{array}
if d4 < 2.1e9Initial program 87.7%
+-commutative87.7%
*-commutative87.7%
distribute-lft-out--89.8%
distribute-lft-out90.9%
distribute-lft-out--100.0%
Simplified100.0%
Taylor expanded in d3 around 0 80.4%
Taylor expanded in d4 around 0 62.3%
if 2.1e9 < d4 Initial program 75.4%
+-commutative75.4%
*-commutative75.4%
distribute-lft-out--76.8%
distribute-lft-out79.7%
distribute-lft-out--100.0%
Simplified100.0%
Taylor expanded in d3 around 0 87.1%
Taylor expanded in d1 around 0 70.5%
Final simplification64.5%
(FPCore (d1 d2 d3 d4) :precision binary64 (if (<= d4 1.5e+77) (* d1 d2) (* d1 d4)))
double code(double d1, double d2, double d3, double d4) {
double tmp;
if (d4 <= 1.5e+77) {
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.5d+77) 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.5e+77) {
tmp = d1 * d2;
} else {
tmp = d1 * d4;
}
return tmp;
}
def code(d1, d2, d3, d4): tmp = 0 if d4 <= 1.5e+77: tmp = d1 * d2 else: tmp = d1 * d4 return tmp
function code(d1, d2, d3, d4) tmp = 0.0 if (d4 <= 1.5e+77) 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.5e+77) tmp = d1 * d2; else tmp = d1 * d4; end tmp_2 = tmp; end
code[d1_, d2_, d3_, d4_] := If[LessEqual[d4, 1.5e+77], N[(d1 * d2), $MachinePrecision], N[(d1 * d4), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;d4 \leq 1.5 \cdot 10^{+77}:\\
\;\;\;\;d1 \cdot d2\\
\mathbf{else}:\\
\;\;\;\;d1 \cdot d4\\
\end{array}
\end{array}
if d4 < 1.4999999999999999e77Initial program 87.4%
+-commutative87.4%
*-commutative87.4%
distribute-lft-out--89.4%
distribute-lft-out90.3%
distribute-lft-out--100.0%
Simplified100.0%
Taylor expanded in d2 around inf 35.8%
if 1.4999999999999999e77 < d4 Initial program 71.4%
+-commutative71.4%
*-commutative71.4%
distribute-lft-out--73.5%
distribute-lft-out77.6%
distribute-lft-out--100.0%
Simplified100.0%
Taylor expanded in d4 around inf 70.1%
(FPCore (d1 d2 d3 d4) :precision binary64 (if (<= d2 -4.1e-187) (* d1 d2) (* d1 d3)))
double code(double d1, double d2, double d3, double d4) {
double tmp;
if (d2 <= -4.1e-187) {
tmp = d1 * d2;
} else {
tmp = 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 <= (-4.1d-187)) then
tmp = d1 * d2
else
tmp = d1 * d3
end if
code = tmp
end function
public static double code(double d1, double d2, double d3, double d4) {
double tmp;
if (d2 <= -4.1e-187) {
tmp = d1 * d2;
} else {
tmp = d1 * d3;
}
return tmp;
}
def code(d1, d2, d3, d4): tmp = 0 if d2 <= -4.1e-187: tmp = d1 * d2 else: tmp = d1 * d3 return tmp
function code(d1, d2, d3, d4) tmp = 0.0 if (d2 <= -4.1e-187) tmp = Float64(d1 * d2); else tmp = Float64(d1 * d3); end return tmp end
function tmp_2 = code(d1, d2, d3, d4) tmp = 0.0; if (d2 <= -4.1e-187) tmp = d1 * d2; else tmp = d1 * d3; end tmp_2 = tmp; end
code[d1_, d2_, d3_, d4_] := If[LessEqual[d2, -4.1e-187], N[(d1 * d2), $MachinePrecision], N[(d1 * d3), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;d2 \leq -4.1 \cdot 10^{-187}:\\
\;\;\;\;d1 \cdot d2\\
\mathbf{else}:\\
\;\;\;\;d1 \cdot d3\\
\end{array}
\end{array}
if d2 < -4.1000000000000002e-187Initial program 81.4%
+-commutative81.4%
*-commutative81.4%
distribute-lft-out--83.9%
distribute-lft-out85.6%
distribute-lft-out--100.0%
Simplified100.0%
Taylor expanded in d2 around inf 37.5%
if -4.1000000000000002e-187 < d2 Initial program 87.0%
+-commutative87.0%
*-commutative87.0%
distribute-lft-out--88.4%
distribute-lft-out89.8%
distribute-lft-out--100.0%
Simplified100.0%
Taylor expanded in d3 around inf 30.6%
mul-1-neg30.6%
distribute-rgt-neg-out30.6%
Simplified30.6%
add-sqr-sqrt15.7%
sqrt-unprod17.9%
sqr-neg17.9%
sqrt-unprod5.1%
add-sqr-sqrt9.7%
pow19.7%
Applied egg-rr9.7%
unpow19.7%
Simplified9.7%
(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 84.4%
+-commutative84.4%
*-commutative84.4%
distribute-lft-out--86.3%
distribute-lft-out87.9%
distribute-lft-out--100.0%
Simplified100.0%
Taylor expanded in d2 around inf 31.3%
(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 84.4%
+-commutative84.4%
*-commutative84.4%
distribute-lft-out--86.3%
distribute-lft-out87.9%
distribute-lft-out--100.0%
Simplified100.0%
Taylor expanded in d1 around inf 34.7%
neg-mul-134.7%
Simplified34.7%
neg-sub034.7%
sub-neg34.7%
add-sqr-sqrt17.9%
sqrt-unprod21.4%
sqr-neg21.4%
sqrt-unprod3.4%
add-sqr-sqrt8.8%
Applied egg-rr8.8%
+-lft-identity8.8%
Simplified8.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 2024172
(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)))