
(FPCore (x y z t) :precision binary64 (+ x (* (- y z) (- t x))))
double code(double x, double y, double z, double t) {
return x + ((y - z) * (t - x));
}
real(8) function code(x, y, z, t)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
code = x + ((y - z) * (t - x))
end function
public static double code(double x, double y, double z, double t) {
return x + ((y - z) * (t - x));
}
def code(x, y, z, t): return x + ((y - z) * (t - x))
function code(x, y, z, t) return Float64(x + Float64(Float64(y - z) * Float64(t - x))) end
function tmp = code(x, y, z, t) tmp = x + ((y - z) * (t - x)); end
code[x_, y_, z_, t_] := N[(x + N[(N[(y - z), $MachinePrecision] * N[(t - x), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
x + \left(y - z\right) \cdot \left(t - x\right)
\end{array}
Sampling outcomes in binary64 precision:
Herbie found 9 alternatives:
| Alternative | Accuracy | Speedup |
|---|
(FPCore (x y z t) :precision binary64 (+ x (* (- y z) (- t x))))
double code(double x, double y, double z, double t) {
return x + ((y - z) * (t - x));
}
real(8) function code(x, y, z, t)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
code = x + ((y - z) * (t - x))
end function
public static double code(double x, double y, double z, double t) {
return x + ((y - z) * (t - x));
}
def code(x, y, z, t): return x + ((y - z) * (t - x))
function code(x, y, z, t) return Float64(x + Float64(Float64(y - z) * Float64(t - x))) end
function tmp = code(x, y, z, t) tmp = x + ((y - z) * (t - x)); end
code[x_, y_, z_, t_] := N[(x + N[(N[(y - z), $MachinePrecision] * N[(t - x), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
x + \left(y - z\right) \cdot \left(t - x\right)
\end{array}
(FPCore (x y z t) :precision binary64 (+ x (* (- y z) (- t x))))
double code(double x, double y, double z, double t) {
return x + ((y - z) * (t - x));
}
real(8) function code(x, y, z, t)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
code = x + ((y - z) * (t - x))
end function
public static double code(double x, double y, double z, double t) {
return x + ((y - z) * (t - x));
}
def code(x, y, z, t): return x + ((y - z) * (t - x))
function code(x, y, z, t) return Float64(x + Float64(Float64(y - z) * Float64(t - x))) end
function tmp = code(x, y, z, t) tmp = x + ((y - z) * (t - x)); end
code[x_, y_, z_, t_] := N[(x + N[(N[(y - z), $MachinePrecision] * N[(t - x), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
x + \left(y - z\right) \cdot \left(t - x\right)
\end{array}
Initial program 100.0%
(FPCore (x y z t)
:precision binary64
(if (<= z -1.6e+30)
(* x z)
(if (<= z 2.95e+26)
(+ x (* y t))
(if (or (<= z 2.7e+250) (not (<= z 3e+258)))
(- x (* z t))
(+ x (* x z))))))
double code(double x, double y, double z, double t) {
double tmp;
if (z <= -1.6e+30) {
tmp = x * z;
} else if (z <= 2.95e+26) {
tmp = x + (y * t);
} else if ((z <= 2.7e+250) || !(z <= 3e+258)) {
tmp = x - (z * t);
} else {
tmp = x + (x * z);
}
return tmp;
}
real(8) function code(x, y, z, t)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
real(8) :: tmp
if (z <= (-1.6d+30)) then
tmp = x * z
else if (z <= 2.95d+26) then
tmp = x + (y * t)
else if ((z <= 2.7d+250) .or. (.not. (z <= 3d+258))) then
tmp = x - (z * t)
else
tmp = x + (x * z)
end if
code = tmp
end function
public static double code(double x, double y, double z, double t) {
double tmp;
if (z <= -1.6e+30) {
tmp = x * z;
} else if (z <= 2.95e+26) {
tmp = x + (y * t);
} else if ((z <= 2.7e+250) || !(z <= 3e+258)) {
tmp = x - (z * t);
} else {
tmp = x + (x * z);
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if z <= -1.6e+30: tmp = x * z elif z <= 2.95e+26: tmp = x + (y * t) elif (z <= 2.7e+250) or not (z <= 3e+258): tmp = x - (z * t) else: tmp = x + (x * z) return tmp
function code(x, y, z, t) tmp = 0.0 if (z <= -1.6e+30) tmp = Float64(x * z); elseif (z <= 2.95e+26) tmp = Float64(x + Float64(y * t)); elseif ((z <= 2.7e+250) || !(z <= 3e+258)) tmp = Float64(x - Float64(z * t)); else tmp = Float64(x + Float64(x * z)); end return tmp end
function tmp_2 = code(x, y, z, t) tmp = 0.0; if (z <= -1.6e+30) tmp = x * z; elseif (z <= 2.95e+26) tmp = x + (y * t); elseif ((z <= 2.7e+250) || ~((z <= 3e+258))) tmp = x - (z * t); else tmp = x + (x * z); end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[LessEqual[z, -1.6e+30], N[(x * z), $MachinePrecision], If[LessEqual[z, 2.95e+26], N[(x + N[(y * t), $MachinePrecision]), $MachinePrecision], If[Or[LessEqual[z, 2.7e+250], N[Not[LessEqual[z, 3e+258]], $MachinePrecision]], N[(x - N[(z * t), $MachinePrecision]), $MachinePrecision], N[(x + N[(x * z), $MachinePrecision]), $MachinePrecision]]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \leq -1.6 \cdot 10^{+30}:\\
\;\;\;\;x \cdot z\\
\mathbf{elif}\;z \leq 2.95 \cdot 10^{+26}:\\
\;\;\;\;x + y \cdot t\\
\mathbf{elif}\;z \leq 2.7 \cdot 10^{+250} \lor \neg \left(z \leq 3 \cdot 10^{+258}\right):\\
\;\;\;\;x - z \cdot t\\
\mathbf{else}:\\
\;\;\;\;x + x \cdot z\\
\end{array}
\end{array}
if z < -1.59999999999999986e30Initial program 100.0%
Taylor expanded in y around 0 74.0%
mul-1-neg74.0%
distribute-rgt-neg-in74.0%
sub-neg74.0%
+-commutative74.0%
distribute-neg-in74.0%
remove-double-neg74.0%
sub-neg74.0%
Simplified74.0%
sub-neg74.0%
distribute-lft-in72.0%
Applied egg-rr72.0%
Taylor expanded in x around inf 48.1%
*-commutative48.1%
Simplified48.1%
Taylor expanded in z around inf 48.1%
if -1.59999999999999986e30 < z < 2.95000000000000015e26Initial program 100.0%
Taylor expanded in x around inf 87.9%
*-commutative87.9%
*-commutative87.9%
associate-/l*87.2%
distribute-lft-out87.2%
Simplified87.2%
Taylor expanded in t around inf 58.1%
associate-/l*57.4%
Simplified57.4%
Taylor expanded in y around inf 61.6%
if 2.95000000000000015e26 < z < 2.7e250 or 3e258 < z Initial program 100.0%
Taylor expanded in x around inf 89.1%
*-commutative89.1%
*-commutative89.1%
associate-/l*89.0%
distribute-lft-out89.0%
Simplified89.0%
Taylor expanded in t around inf 59.4%
associate-/l*51.5%
Simplified51.5%
Taylor expanded in y around 0 66.3%
associate-*r*66.3%
mul-1-neg66.3%
Simplified66.3%
if 2.7e250 < z < 3e258Initial program 99.7%
Taylor expanded in y around 0 99.7%
mul-1-neg99.7%
distribute-rgt-neg-in99.7%
sub-neg99.7%
+-commutative99.7%
distribute-neg-in99.7%
remove-double-neg99.7%
sub-neg99.7%
Simplified99.7%
sub-neg99.7%
distribute-lft-in100.0%
Applied egg-rr100.0%
Taylor expanded in x around inf 92.4%
*-commutative92.4%
Simplified92.4%
Final simplification60.4%
(FPCore (x y z t) :precision binary64 (if (or (<= z -5.2e+53) (not (<= z 2.2e+44))) (+ x (* z (- x t))) (+ x (* y (- t x)))))
double code(double x, double y, double z, double t) {
double tmp;
if ((z <= -5.2e+53) || !(z <= 2.2e+44)) {
tmp = x + (z * (x - t));
} else {
tmp = x + (y * (t - x));
}
return tmp;
}
real(8) function code(x, y, z, t)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
real(8) :: tmp
if ((z <= (-5.2d+53)) .or. (.not. (z <= 2.2d+44))) then
tmp = x + (z * (x - t))
else
tmp = x + (y * (t - x))
end if
code = tmp
end function
public static double code(double x, double y, double z, double t) {
double tmp;
if ((z <= -5.2e+53) || !(z <= 2.2e+44)) {
tmp = x + (z * (x - t));
} else {
tmp = x + (y * (t - x));
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if (z <= -5.2e+53) or not (z <= 2.2e+44): tmp = x + (z * (x - t)) else: tmp = x + (y * (t - x)) return tmp
function code(x, y, z, t) tmp = 0.0 if ((z <= -5.2e+53) || !(z <= 2.2e+44)) tmp = Float64(x + Float64(z * Float64(x - t))); else tmp = Float64(x + Float64(y * Float64(t - x))); end return tmp end
function tmp_2 = code(x, y, z, t) tmp = 0.0; if ((z <= -5.2e+53) || ~((z <= 2.2e+44))) tmp = x + (z * (x - t)); else tmp = x + (y * (t - x)); end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[Or[LessEqual[z, -5.2e+53], N[Not[LessEqual[z, 2.2e+44]], $MachinePrecision]], N[(x + N[(z * N[(x - t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(x + N[(y * N[(t - x), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \leq -5.2 \cdot 10^{+53} \lor \neg \left(z \leq 2.2 \cdot 10^{+44}\right):\\
\;\;\;\;x + z \cdot \left(x - t\right)\\
\mathbf{else}:\\
\;\;\;\;x + y \cdot \left(t - x\right)\\
\end{array}
\end{array}
if z < -5.19999999999999996e53 or 2.19999999999999996e44 < z Initial program 100.0%
Taylor expanded in y around 0 85.7%
mul-1-neg85.7%
distribute-rgt-neg-in85.7%
sub-neg85.7%
+-commutative85.7%
distribute-neg-in85.7%
remove-double-neg85.7%
sub-neg85.7%
Simplified85.7%
if -5.19999999999999996e53 < z < 2.19999999999999996e44Initial program 100.0%
Taylor expanded in y around inf 89.6%
*-commutative89.6%
Simplified89.6%
Final simplification88.1%
(FPCore (x y z t) :precision binary64 (if (or (<= z -1.25e+30) (not (<= z 1.2e+55))) (+ x (* z (- x t))) (+ x (* (- y z) t))))
double code(double x, double y, double z, double t) {
double tmp;
if ((z <= -1.25e+30) || !(z <= 1.2e+55)) {
tmp = x + (z * (x - t));
} else {
tmp = x + ((y - z) * t);
}
return tmp;
}
real(8) function code(x, y, z, t)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
real(8) :: tmp
if ((z <= (-1.25d+30)) .or. (.not. (z <= 1.2d+55))) then
tmp = x + (z * (x - t))
else
tmp = x + ((y - z) * t)
end if
code = tmp
end function
public static double code(double x, double y, double z, double t) {
double tmp;
if ((z <= -1.25e+30) || !(z <= 1.2e+55)) {
tmp = x + (z * (x - t));
} else {
tmp = x + ((y - z) * t);
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if (z <= -1.25e+30) or not (z <= 1.2e+55): tmp = x + (z * (x - t)) else: tmp = x + ((y - z) * t) return tmp
function code(x, y, z, t) tmp = 0.0 if ((z <= -1.25e+30) || !(z <= 1.2e+55)) tmp = Float64(x + Float64(z * Float64(x - t))); else tmp = Float64(x + Float64(Float64(y - z) * t)); end return tmp end
function tmp_2 = code(x, y, z, t) tmp = 0.0; if ((z <= -1.25e+30) || ~((z <= 1.2e+55))) tmp = x + (z * (x - t)); else tmp = x + ((y - z) * t); end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[Or[LessEqual[z, -1.25e+30], N[Not[LessEqual[z, 1.2e+55]], $MachinePrecision]], N[(x + N[(z * N[(x - t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(x + N[(N[(y - z), $MachinePrecision] * t), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \leq -1.25 \cdot 10^{+30} \lor \neg \left(z \leq 1.2 \cdot 10^{+55}\right):\\
\;\;\;\;x + z \cdot \left(x - t\right)\\
\mathbf{else}:\\
\;\;\;\;x + \left(y - z\right) \cdot t\\
\end{array}
\end{array}
if z < -1.25e30 or 1.2e55 < z Initial program 100.0%
Taylor expanded in y around 0 83.7%
mul-1-neg83.7%
distribute-rgt-neg-in83.7%
sub-neg83.7%
+-commutative83.7%
distribute-neg-in83.7%
remove-double-neg83.7%
sub-neg83.7%
Simplified83.7%
if -1.25e30 < z < 1.2e55Initial program 100.0%
Taylor expanded in t around inf 70.4%
Final simplification75.6%
(FPCore (x y z t) :precision binary64 (if (or (<= t -7.5e-131) (not (<= t 8.8e-144))) (+ x (* (- y z) t)) (+ x (* x z))))
double code(double x, double y, double z, double t) {
double tmp;
if ((t <= -7.5e-131) || !(t <= 8.8e-144)) {
tmp = x + ((y - z) * t);
} else {
tmp = x + (x * z);
}
return tmp;
}
real(8) function code(x, y, z, t)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
real(8) :: tmp
if ((t <= (-7.5d-131)) .or. (.not. (t <= 8.8d-144))) then
tmp = x + ((y - z) * t)
else
tmp = x + (x * z)
end if
code = tmp
end function
public static double code(double x, double y, double z, double t) {
double tmp;
if ((t <= -7.5e-131) || !(t <= 8.8e-144)) {
tmp = x + ((y - z) * t);
} else {
tmp = x + (x * z);
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if (t <= -7.5e-131) or not (t <= 8.8e-144): tmp = x + ((y - z) * t) else: tmp = x + (x * z) return tmp
function code(x, y, z, t) tmp = 0.0 if ((t <= -7.5e-131) || !(t <= 8.8e-144)) tmp = Float64(x + Float64(Float64(y - z) * t)); else tmp = Float64(x + Float64(x * z)); end return tmp end
function tmp_2 = code(x, y, z, t) tmp = 0.0; if ((t <= -7.5e-131) || ~((t <= 8.8e-144))) tmp = x + ((y - z) * t); else tmp = x + (x * z); end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[Or[LessEqual[t, -7.5e-131], N[Not[LessEqual[t, 8.8e-144]], $MachinePrecision]], N[(x + N[(N[(y - z), $MachinePrecision] * t), $MachinePrecision]), $MachinePrecision], N[(x + N[(x * z), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;t \leq -7.5 \cdot 10^{-131} \lor \neg \left(t \leq 8.8 \cdot 10^{-144}\right):\\
\;\;\;\;x + \left(y - z\right) \cdot t\\
\mathbf{else}:\\
\;\;\;\;x + x \cdot z\\
\end{array}
\end{array}
if t < -7.49999999999999964e-131 or 8.80000000000000025e-144 < t Initial program 100.0%
Taylor expanded in t around inf 74.6%
if -7.49999999999999964e-131 < t < 8.80000000000000025e-144Initial program 100.0%
Taylor expanded in y around 0 64.0%
mul-1-neg64.0%
distribute-rgt-neg-in64.0%
sub-neg64.0%
+-commutative64.0%
distribute-neg-in64.0%
remove-double-neg64.0%
sub-neg64.0%
Simplified64.0%
sub-neg64.0%
distribute-lft-in64.0%
Applied egg-rr64.0%
Taylor expanded in x around inf 57.1%
*-commutative57.1%
Simplified57.1%
Final simplification69.5%
(FPCore (x y z t) :precision binary64 (if (or (<= z -1.7e+29) (not (<= z 2.1e+51))) (* x z) (+ x (* y t))))
double code(double x, double y, double z, double t) {
double tmp;
if ((z <= -1.7e+29) || !(z <= 2.1e+51)) {
tmp = x * z;
} else {
tmp = x + (y * t);
}
return tmp;
}
real(8) function code(x, y, z, t)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
real(8) :: tmp
if ((z <= (-1.7d+29)) .or. (.not. (z <= 2.1d+51))) then
tmp = x * z
else
tmp = x + (y * t)
end if
code = tmp
end function
public static double code(double x, double y, double z, double t) {
double tmp;
if ((z <= -1.7e+29) || !(z <= 2.1e+51)) {
tmp = x * z;
} else {
tmp = x + (y * t);
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if (z <= -1.7e+29) or not (z <= 2.1e+51): tmp = x * z else: tmp = x + (y * t) return tmp
function code(x, y, z, t) tmp = 0.0 if ((z <= -1.7e+29) || !(z <= 2.1e+51)) tmp = Float64(x * z); else tmp = Float64(x + Float64(y * t)); end return tmp end
function tmp_2 = code(x, y, z, t) tmp = 0.0; if ((z <= -1.7e+29) || ~((z <= 2.1e+51))) tmp = x * z; else tmp = x + (y * t); end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[Or[LessEqual[z, -1.7e+29], N[Not[LessEqual[z, 2.1e+51]], $MachinePrecision]], N[(x * z), $MachinePrecision], N[(x + N[(y * t), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \leq -1.7 \cdot 10^{+29} \lor \neg \left(z \leq 2.1 \cdot 10^{+51}\right):\\
\;\;\;\;x \cdot z\\
\mathbf{else}:\\
\;\;\;\;x + y \cdot t\\
\end{array}
\end{array}
if z < -1.69999999999999991e29 or 2.1000000000000001e51 < z Initial program 100.0%
Taylor expanded in y around 0 84.2%
mul-1-neg84.2%
distribute-rgt-neg-in84.2%
sub-neg84.2%
+-commutative84.2%
distribute-neg-in84.2%
remove-double-neg84.2%
sub-neg84.2%
Simplified84.2%
sub-neg84.2%
distribute-lft-in83.3%
Applied egg-rr83.3%
Taylor expanded in x around inf 42.7%
*-commutative42.7%
Simplified42.7%
Taylor expanded in z around inf 42.7%
if -1.69999999999999991e29 < z < 2.1000000000000001e51Initial program 100.0%
Taylor expanded in x around inf 87.5%
*-commutative87.5%
*-commutative87.5%
associate-/l*86.9%
distribute-lft-out86.9%
Simplified86.9%
Taylor expanded in t around inf 58.0%
associate-/l*57.3%
Simplified57.3%
Taylor expanded in y around inf 60.7%
Final simplification53.5%
(FPCore (x y z t) :precision binary64 (if (<= z -1.65e+31) (* x z) (if (<= z 2.2e+52) (+ x (* y t)) (+ x (* x z)))))
double code(double x, double y, double z, double t) {
double tmp;
if (z <= -1.65e+31) {
tmp = x * z;
} else if (z <= 2.2e+52) {
tmp = x + (y * t);
} else {
tmp = x + (x * z);
}
return tmp;
}
real(8) function code(x, y, z, t)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
real(8) :: tmp
if (z <= (-1.65d+31)) then
tmp = x * z
else if (z <= 2.2d+52) then
tmp = x + (y * t)
else
tmp = x + (x * z)
end if
code = tmp
end function
public static double code(double x, double y, double z, double t) {
double tmp;
if (z <= -1.65e+31) {
tmp = x * z;
} else if (z <= 2.2e+52) {
tmp = x + (y * t);
} else {
tmp = x + (x * z);
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if z <= -1.65e+31: tmp = x * z elif z <= 2.2e+52: tmp = x + (y * t) else: tmp = x + (x * z) return tmp
function code(x, y, z, t) tmp = 0.0 if (z <= -1.65e+31) tmp = Float64(x * z); elseif (z <= 2.2e+52) tmp = Float64(x + Float64(y * t)); else tmp = Float64(x + Float64(x * z)); end return tmp end
function tmp_2 = code(x, y, z, t) tmp = 0.0; if (z <= -1.65e+31) tmp = x * z; elseif (z <= 2.2e+52) tmp = x + (y * t); else tmp = x + (x * z); end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[LessEqual[z, -1.65e+31], N[(x * z), $MachinePrecision], If[LessEqual[z, 2.2e+52], N[(x + N[(y * t), $MachinePrecision]), $MachinePrecision], N[(x + N[(x * z), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \leq -1.65 \cdot 10^{+31}:\\
\;\;\;\;x \cdot z\\
\mathbf{elif}\;z \leq 2.2 \cdot 10^{+52}:\\
\;\;\;\;x + y \cdot t\\
\mathbf{else}:\\
\;\;\;\;x + x \cdot z\\
\end{array}
\end{array}
if z < -1.64999999999999996e31Initial program 100.0%
Taylor expanded in y around 0 74.0%
mul-1-neg74.0%
distribute-rgt-neg-in74.0%
sub-neg74.0%
+-commutative74.0%
distribute-neg-in74.0%
remove-double-neg74.0%
sub-neg74.0%
Simplified74.0%
sub-neg74.0%
distribute-lft-in72.0%
Applied egg-rr72.0%
Taylor expanded in x around inf 48.1%
*-commutative48.1%
Simplified48.1%
Taylor expanded in z around inf 48.1%
if -1.64999999999999996e31 < z < 2.2e52Initial program 100.0%
Taylor expanded in x around inf 87.5%
*-commutative87.5%
*-commutative87.5%
associate-/l*86.9%
distribute-lft-out86.9%
Simplified86.9%
Taylor expanded in t around inf 58.0%
associate-/l*57.3%
Simplified57.3%
Taylor expanded in y around inf 60.7%
if 2.2e52 < z Initial program 99.9%
Taylor expanded in y around 0 94.3%
mul-1-neg94.3%
distribute-rgt-neg-in94.3%
sub-neg94.3%
+-commutative94.3%
distribute-neg-in94.3%
remove-double-neg94.3%
sub-neg94.3%
Simplified94.3%
sub-neg94.3%
distribute-lft-in94.3%
Applied egg-rr94.3%
Taylor expanded in x around inf 37.5%
*-commutative37.5%
Simplified37.5%
Final simplification53.5%
(FPCore (x y z t) :precision binary64 (if (or (<= z -1e-5) (not (<= z 0.215))) (* x z) x))
double code(double x, double y, double z, double t) {
double tmp;
if ((z <= -1e-5) || !(z <= 0.215)) {
tmp = x * z;
} else {
tmp = x;
}
return tmp;
}
real(8) function code(x, y, z, t)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
real(8) :: tmp
if ((z <= (-1d-5)) .or. (.not. (z <= 0.215d0))) then
tmp = x * z
else
tmp = x
end if
code = tmp
end function
public static double code(double x, double y, double z, double t) {
double tmp;
if ((z <= -1e-5) || !(z <= 0.215)) {
tmp = x * z;
} else {
tmp = x;
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if (z <= -1e-5) or not (z <= 0.215): tmp = x * z else: tmp = x return tmp
function code(x, y, z, t) tmp = 0.0 if ((z <= -1e-5) || !(z <= 0.215)) tmp = Float64(x * z); else tmp = x; end return tmp end
function tmp_2 = code(x, y, z, t) tmp = 0.0; if ((z <= -1e-5) || ~((z <= 0.215))) tmp = x * z; else tmp = x; end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[Or[LessEqual[z, -1e-5], N[Not[LessEqual[z, 0.215]], $MachinePrecision]], N[(x * z), $MachinePrecision], x]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \leq -1 \cdot 10^{-5} \lor \neg \left(z \leq 0.215\right):\\
\;\;\;\;x \cdot z\\
\mathbf{else}:\\
\;\;\;\;x\\
\end{array}
\end{array}
if z < -1.00000000000000008e-5 or 0.214999999999999997 < z Initial program 100.0%
Taylor expanded in y around 0 75.7%
mul-1-neg75.7%
distribute-rgt-neg-in75.7%
sub-neg75.7%
+-commutative75.7%
distribute-neg-in75.7%
remove-double-neg75.7%
sub-neg75.7%
Simplified75.7%
sub-neg75.7%
distribute-lft-in74.9%
Applied egg-rr74.9%
Taylor expanded in x around inf 36.9%
*-commutative36.9%
Simplified36.9%
Taylor expanded in z around inf 36.6%
if -1.00000000000000008e-5 < z < 0.214999999999999997Initial program 100.0%
Taylor expanded in y around 0 38.2%
mul-1-neg38.2%
distribute-rgt-neg-in38.2%
sub-neg38.2%
+-commutative38.2%
distribute-neg-in38.2%
remove-double-neg38.2%
sub-neg38.2%
Simplified38.2%
sub-neg38.2%
distribute-lft-in38.2%
Applied egg-rr38.2%
Taylor expanded in x around inf 32.5%
*-commutative32.5%
Simplified32.5%
Taylor expanded in z around 0 32.2%
Final simplification34.3%
(FPCore (x y z t) :precision binary64 x)
double code(double x, double y, double z, double t) {
return x;
}
real(8) function code(x, y, z, t)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
code = x
end function
public static double code(double x, double y, double z, double t) {
return x;
}
def code(x, y, z, t): return x
function code(x, y, z, t) return x end
function tmp = code(x, y, z, t) tmp = x; end
code[x_, y_, z_, t_] := x
\begin{array}{l}
\\
x
\end{array}
Initial program 100.0%
Taylor expanded in y around 0 56.2%
mul-1-neg56.2%
distribute-rgt-neg-in56.2%
sub-neg56.2%
+-commutative56.2%
distribute-neg-in56.2%
remove-double-neg56.2%
sub-neg56.2%
Simplified56.2%
sub-neg56.2%
distribute-lft-in55.8%
Applied egg-rr55.8%
Taylor expanded in x around inf 34.6%
*-commutative34.6%
Simplified34.6%
Taylor expanded in z around 0 18.0%
(FPCore (x y z t) :precision binary64 (+ x (+ (* t (- y z)) (* (- x) (- y z)))))
double code(double x, double y, double z, double t) {
return x + ((t * (y - z)) + (-x * (y - z)));
}
real(8) function code(x, y, z, t)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
code = x + ((t * (y - z)) + (-x * (y - z)))
end function
public static double code(double x, double y, double z, double t) {
return x + ((t * (y - z)) + (-x * (y - z)));
}
def code(x, y, z, t): return x + ((t * (y - z)) + (-x * (y - z)))
function code(x, y, z, t) return Float64(x + Float64(Float64(t * Float64(y - z)) + Float64(Float64(-x) * Float64(y - z)))) end
function tmp = code(x, y, z, t) tmp = x + ((t * (y - z)) + (-x * (y - z))); end
code[x_, y_, z_, t_] := N[(x + N[(N[(t * N[(y - z), $MachinePrecision]), $MachinePrecision] + N[((-x) * N[(y - z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
x + \left(t \cdot \left(y - z\right) + \left(-x\right) \cdot \left(y - z\right)\right)
\end{array}
herbie shell --seed 2024103
(FPCore (x y z t)
:name "Data.Metrics.Snapshot:quantile from metrics-0.3.0.2"
:precision binary64
:alt
(+ x (+ (* t (- y z)) (* (- x) (- y z))))
(+ x (* (- y z) (- t x))))