
(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 10 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%
Final simplification100.0%
(FPCore (x y z t)
:precision binary64
(let* ((t_1 (- x (* x y))) (t_2 (* z (- x t))) (t_3 (+ x (* y t))))
(if (<= z -0.84)
t_2
(if (<= z -3.6e-59)
t_3
(if (<= z -1.95e-234)
t_1
(if (<= z 6.4e-106) t_3 (if (<= z 1.06e+26) t_1 t_2)))))))
double code(double x, double y, double z, double t) {
double t_1 = x - (x * y);
double t_2 = z * (x - t);
double t_3 = x + (y * t);
double tmp;
if (z <= -0.84) {
tmp = t_2;
} else if (z <= -3.6e-59) {
tmp = t_3;
} else if (z <= -1.95e-234) {
tmp = t_1;
} else if (z <= 6.4e-106) {
tmp = t_3;
} else if (z <= 1.06e+26) {
tmp = t_1;
} else {
tmp = t_2;
}
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) :: t_1
real(8) :: t_2
real(8) :: t_3
real(8) :: tmp
t_1 = x - (x * y)
t_2 = z * (x - t)
t_3 = x + (y * t)
if (z <= (-0.84d0)) then
tmp = t_2
else if (z <= (-3.6d-59)) then
tmp = t_3
else if (z <= (-1.95d-234)) then
tmp = t_1
else if (z <= 6.4d-106) then
tmp = t_3
else if (z <= 1.06d+26) then
tmp = t_1
else
tmp = t_2
end if
code = tmp
end function
public static double code(double x, double y, double z, double t) {
double t_1 = x - (x * y);
double t_2 = z * (x - t);
double t_3 = x + (y * t);
double tmp;
if (z <= -0.84) {
tmp = t_2;
} else if (z <= -3.6e-59) {
tmp = t_3;
} else if (z <= -1.95e-234) {
tmp = t_1;
} else if (z <= 6.4e-106) {
tmp = t_3;
} else if (z <= 1.06e+26) {
tmp = t_1;
} else {
tmp = t_2;
}
return tmp;
}
def code(x, y, z, t): t_1 = x - (x * y) t_2 = z * (x - t) t_3 = x + (y * t) tmp = 0 if z <= -0.84: tmp = t_2 elif z <= -3.6e-59: tmp = t_3 elif z <= -1.95e-234: tmp = t_1 elif z <= 6.4e-106: tmp = t_3 elif z <= 1.06e+26: tmp = t_1 else: tmp = t_2 return tmp
function code(x, y, z, t) t_1 = Float64(x - Float64(x * y)) t_2 = Float64(z * Float64(x - t)) t_3 = Float64(x + Float64(y * t)) tmp = 0.0 if (z <= -0.84) tmp = t_2; elseif (z <= -3.6e-59) tmp = t_3; elseif (z <= -1.95e-234) tmp = t_1; elseif (z <= 6.4e-106) tmp = t_3; elseif (z <= 1.06e+26) tmp = t_1; else tmp = t_2; end return tmp end
function tmp_2 = code(x, y, z, t) t_1 = x - (x * y); t_2 = z * (x - t); t_3 = x + (y * t); tmp = 0.0; if (z <= -0.84) tmp = t_2; elseif (z <= -3.6e-59) tmp = t_3; elseif (z <= -1.95e-234) tmp = t_1; elseif (z <= 6.4e-106) tmp = t_3; elseif (z <= 1.06e+26) tmp = t_1; else tmp = t_2; end tmp_2 = tmp; end
code[x_, y_, z_, t_] := Block[{t$95$1 = N[(x - N[(x * y), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$2 = N[(z * N[(x - t), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$3 = N[(x + N[(y * t), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[z, -0.84], t$95$2, If[LessEqual[z, -3.6e-59], t$95$3, If[LessEqual[z, -1.95e-234], t$95$1, If[LessEqual[z, 6.4e-106], t$95$3, If[LessEqual[z, 1.06e+26], t$95$1, t$95$2]]]]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := x - x \cdot y\\
t_2 := z \cdot \left(x - t\right)\\
t_3 := x + y \cdot t\\
\mathbf{if}\;z \leq -0.84:\\
\;\;\;\;t\_2\\
\mathbf{elif}\;z \leq -3.6 \cdot 10^{-59}:\\
\;\;\;\;t\_3\\
\mathbf{elif}\;z \leq -1.95 \cdot 10^{-234}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;z \leq 6.4 \cdot 10^{-106}:\\
\;\;\;\;t\_3\\
\mathbf{elif}\;z \leq 1.06 \cdot 10^{+26}:\\
\;\;\;\;t\_1\\
\mathbf{else}:\\
\;\;\;\;t\_2\\
\end{array}
\end{array}
if z < -0.839999999999999969 or 1.05999999999999997e26 < z Initial program 100.0%
Taylor expanded in y around 0 79.6%
mul-1-neg79.6%
distribute-rgt-neg-in79.6%
sub-neg79.6%
+-commutative79.6%
distribute-neg-in79.6%
remove-double-neg79.6%
sub-neg79.6%
Simplified79.6%
Taylor expanded in z around inf 79.1%
if -0.839999999999999969 < z < -3.6e-59 or -1.9500000000000001e-234 < z < 6.4e-106Initial program 100.0%
Taylor expanded in y around inf 93.7%
*-commutative93.7%
Simplified93.7%
Taylor expanded in t around inf 75.8%
*-commutative75.8%
Simplified75.8%
if -3.6e-59 < z < -1.9500000000000001e-234 or 6.4e-106 < z < 1.05999999999999997e26Initial program 100.0%
Taylor expanded in y around inf 89.4%
*-commutative89.4%
Simplified89.4%
Taylor expanded in t around 0 68.4%
mul-1-neg68.4%
*-commutative68.4%
distribute-rgt-neg-out68.4%
Simplified68.4%
distribute-rgt-neg-out68.4%
unsub-neg68.4%
Applied egg-rr68.4%
Final simplification75.3%
(FPCore (x y z t)
:precision binary64
(let* ((t_1 (* z (- x t))) (t_2 (+ x (* (- y z) t))))
(if (<= z -2.15e+26)
t_1
(if (<= z -1.9e-63)
t_2
(if (<= z -6.1e-235) (- x (* x y)) (if (<= z 1e+103) t_2 t_1))))))
double code(double x, double y, double z, double t) {
double t_1 = z * (x - t);
double t_2 = x + ((y - z) * t);
double tmp;
if (z <= -2.15e+26) {
tmp = t_1;
} else if (z <= -1.9e-63) {
tmp = t_2;
} else if (z <= -6.1e-235) {
tmp = x - (x * y);
} else if (z <= 1e+103) {
tmp = t_2;
} else {
tmp = t_1;
}
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) :: t_1
real(8) :: t_2
real(8) :: tmp
t_1 = z * (x - t)
t_2 = x + ((y - z) * t)
if (z <= (-2.15d+26)) then
tmp = t_1
else if (z <= (-1.9d-63)) then
tmp = t_2
else if (z <= (-6.1d-235)) then
tmp = x - (x * y)
else if (z <= 1d+103) then
tmp = t_2
else
tmp = t_1
end if
code = tmp
end function
public static double code(double x, double y, double z, double t) {
double t_1 = z * (x - t);
double t_2 = x + ((y - z) * t);
double tmp;
if (z <= -2.15e+26) {
tmp = t_1;
} else if (z <= -1.9e-63) {
tmp = t_2;
} else if (z <= -6.1e-235) {
tmp = x - (x * y);
} else if (z <= 1e+103) {
tmp = t_2;
} else {
tmp = t_1;
}
return tmp;
}
def code(x, y, z, t): t_1 = z * (x - t) t_2 = x + ((y - z) * t) tmp = 0 if z <= -2.15e+26: tmp = t_1 elif z <= -1.9e-63: tmp = t_2 elif z <= -6.1e-235: tmp = x - (x * y) elif z <= 1e+103: tmp = t_2 else: tmp = t_1 return tmp
function code(x, y, z, t) t_1 = Float64(z * Float64(x - t)) t_2 = Float64(x + Float64(Float64(y - z) * t)) tmp = 0.0 if (z <= -2.15e+26) tmp = t_1; elseif (z <= -1.9e-63) tmp = t_2; elseif (z <= -6.1e-235) tmp = Float64(x - Float64(x * y)); elseif (z <= 1e+103) tmp = t_2; else tmp = t_1; end return tmp end
function tmp_2 = code(x, y, z, t) t_1 = z * (x - t); t_2 = x + ((y - z) * t); tmp = 0.0; if (z <= -2.15e+26) tmp = t_1; elseif (z <= -1.9e-63) tmp = t_2; elseif (z <= -6.1e-235) tmp = x - (x * y); elseif (z <= 1e+103) tmp = t_2; else tmp = t_1; end tmp_2 = tmp; end
code[x_, y_, z_, t_] := Block[{t$95$1 = N[(z * N[(x - t), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$2 = N[(x + N[(N[(y - z), $MachinePrecision] * t), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[z, -2.15e+26], t$95$1, If[LessEqual[z, -1.9e-63], t$95$2, If[LessEqual[z, -6.1e-235], N[(x - N[(x * y), $MachinePrecision]), $MachinePrecision], If[LessEqual[z, 1e+103], t$95$2, t$95$1]]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := z \cdot \left(x - t\right)\\
t_2 := x + \left(y - z\right) \cdot t\\
\mathbf{if}\;z \leq -2.15 \cdot 10^{+26}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;z \leq -1.9 \cdot 10^{-63}:\\
\;\;\;\;t\_2\\
\mathbf{elif}\;z \leq -6.1 \cdot 10^{-235}:\\
\;\;\;\;x - x \cdot y\\
\mathbf{elif}\;z \leq 10^{+103}:\\
\;\;\;\;t\_2\\
\mathbf{else}:\\
\;\;\;\;t\_1\\
\end{array}
\end{array}
if z < -2.1499999999999999e26 or 1e103 < z Initial program 100.0%
Taylor expanded in y around 0 86.3%
mul-1-neg86.3%
distribute-rgt-neg-in86.3%
sub-neg86.3%
+-commutative86.3%
distribute-neg-in86.3%
remove-double-neg86.3%
sub-neg86.3%
Simplified86.3%
Taylor expanded in z around inf 86.3%
if -2.1499999999999999e26 < z < -1.90000000000000009e-63 or -6.09999999999999988e-235 < z < 1e103Initial program 100.0%
Taylor expanded in t around inf 73.4%
if -1.90000000000000009e-63 < z < -6.09999999999999988e-235Initial program 100.0%
Taylor expanded in y around inf 95.0%
*-commutative95.0%
Simplified95.0%
Taylor expanded in t around 0 72.7%
mul-1-neg72.7%
*-commutative72.7%
distribute-rgt-neg-out72.7%
Simplified72.7%
distribute-rgt-neg-out72.7%
unsub-neg72.7%
Applied egg-rr72.7%
Final simplification78.1%
(FPCore (x y z t)
:precision binary64
(let* ((t_1 (* z (- x t))) (t_2 (* x (- y))))
(if (<= z -3.2e-55)
t_1
(if (<= z -2.45e-198)
t_2
(if (<= z 2.9e-160) x (if (<= z 2.6e+26) t_2 t_1))))))
double code(double x, double y, double z, double t) {
double t_1 = z * (x - t);
double t_2 = x * -y;
double tmp;
if (z <= -3.2e-55) {
tmp = t_1;
} else if (z <= -2.45e-198) {
tmp = t_2;
} else if (z <= 2.9e-160) {
tmp = x;
} else if (z <= 2.6e+26) {
tmp = t_2;
} else {
tmp = t_1;
}
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) :: t_1
real(8) :: t_2
real(8) :: tmp
t_1 = z * (x - t)
t_2 = x * -y
if (z <= (-3.2d-55)) then
tmp = t_1
else if (z <= (-2.45d-198)) then
tmp = t_2
else if (z <= 2.9d-160) then
tmp = x
else if (z <= 2.6d+26) then
tmp = t_2
else
tmp = t_1
end if
code = tmp
end function
public static double code(double x, double y, double z, double t) {
double t_1 = z * (x - t);
double t_2 = x * -y;
double tmp;
if (z <= -3.2e-55) {
tmp = t_1;
} else if (z <= -2.45e-198) {
tmp = t_2;
} else if (z <= 2.9e-160) {
tmp = x;
} else if (z <= 2.6e+26) {
tmp = t_2;
} else {
tmp = t_1;
}
return tmp;
}
def code(x, y, z, t): t_1 = z * (x - t) t_2 = x * -y tmp = 0 if z <= -3.2e-55: tmp = t_1 elif z <= -2.45e-198: tmp = t_2 elif z <= 2.9e-160: tmp = x elif z <= 2.6e+26: tmp = t_2 else: tmp = t_1 return tmp
function code(x, y, z, t) t_1 = Float64(z * Float64(x - t)) t_2 = Float64(x * Float64(-y)) tmp = 0.0 if (z <= -3.2e-55) tmp = t_1; elseif (z <= -2.45e-198) tmp = t_2; elseif (z <= 2.9e-160) tmp = x; elseif (z <= 2.6e+26) tmp = t_2; else tmp = t_1; end return tmp end
function tmp_2 = code(x, y, z, t) t_1 = z * (x - t); t_2 = x * -y; tmp = 0.0; if (z <= -3.2e-55) tmp = t_1; elseif (z <= -2.45e-198) tmp = t_2; elseif (z <= 2.9e-160) tmp = x; elseif (z <= 2.6e+26) tmp = t_2; else tmp = t_1; end tmp_2 = tmp; end
code[x_, y_, z_, t_] := Block[{t$95$1 = N[(z * N[(x - t), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$2 = N[(x * (-y)), $MachinePrecision]}, If[LessEqual[z, -3.2e-55], t$95$1, If[LessEqual[z, -2.45e-198], t$95$2, If[LessEqual[z, 2.9e-160], x, If[LessEqual[z, 2.6e+26], t$95$2, t$95$1]]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := z \cdot \left(x - t\right)\\
t_2 := x \cdot \left(-y\right)\\
\mathbf{if}\;z \leq -3.2 \cdot 10^{-55}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;z \leq -2.45 \cdot 10^{-198}:\\
\;\;\;\;t\_2\\
\mathbf{elif}\;z \leq 2.9 \cdot 10^{-160}:\\
\;\;\;\;x\\
\mathbf{elif}\;z \leq 2.6 \cdot 10^{+26}:\\
\;\;\;\;t\_2\\
\mathbf{else}:\\
\;\;\;\;t\_1\\
\end{array}
\end{array}
if z < -3.2000000000000001e-55 or 2.60000000000000002e26 < z Initial program 100.0%
Taylor expanded in y around 0 76.9%
mul-1-neg76.9%
distribute-rgt-neg-in76.9%
sub-neg76.9%
+-commutative76.9%
distribute-neg-in76.9%
remove-double-neg76.9%
sub-neg76.9%
Simplified76.9%
Taylor expanded in z around inf 75.7%
if -3.2000000000000001e-55 < z < -2.4500000000000001e-198 or 2.8999999999999999e-160 < z < 2.60000000000000002e26Initial program 100.0%
Taylor expanded in y around inf 87.2%
*-commutative87.2%
Simplified87.2%
Taylor expanded in t around 0 64.6%
mul-1-neg64.6%
*-commutative64.6%
distribute-rgt-neg-out64.6%
Simplified64.6%
Taylor expanded in y around inf 44.6%
mul-1-neg44.6%
*-commutative44.6%
distribute-lft-neg-in44.6%
Simplified44.6%
if -2.4500000000000001e-198 < z < 2.8999999999999999e-160Initial program 100.0%
Taylor expanded in y around 0 45.9%
mul-1-neg45.9%
distribute-rgt-neg-in45.9%
sub-neg45.9%
+-commutative45.9%
distribute-neg-in45.9%
remove-double-neg45.9%
sub-neg45.9%
Simplified45.9%
Taylor expanded in z around 0 43.9%
Final simplification60.0%
(FPCore (x y z t)
:precision binary64
(let* ((t_1 (* x (- y))))
(if (<= y -1.9e+22)
t_1
(if (<= y -7.5e-87)
(* x z)
(if (<= y 3e-118) x (if (<= y 1.6e+99) (* x z) t_1))))))
double code(double x, double y, double z, double t) {
double t_1 = x * -y;
double tmp;
if (y <= -1.9e+22) {
tmp = t_1;
} else if (y <= -7.5e-87) {
tmp = x * z;
} else if (y <= 3e-118) {
tmp = x;
} else if (y <= 1.6e+99) {
tmp = x * z;
} else {
tmp = t_1;
}
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) :: t_1
real(8) :: tmp
t_1 = x * -y
if (y <= (-1.9d+22)) then
tmp = t_1
else if (y <= (-7.5d-87)) then
tmp = x * z
else if (y <= 3d-118) then
tmp = x
else if (y <= 1.6d+99) then
tmp = x * z
else
tmp = t_1
end if
code = tmp
end function
public static double code(double x, double y, double z, double t) {
double t_1 = x * -y;
double tmp;
if (y <= -1.9e+22) {
tmp = t_1;
} else if (y <= -7.5e-87) {
tmp = x * z;
} else if (y <= 3e-118) {
tmp = x;
} else if (y <= 1.6e+99) {
tmp = x * z;
} else {
tmp = t_1;
}
return tmp;
}
def code(x, y, z, t): t_1 = x * -y tmp = 0 if y <= -1.9e+22: tmp = t_1 elif y <= -7.5e-87: tmp = x * z elif y <= 3e-118: tmp = x elif y <= 1.6e+99: tmp = x * z else: tmp = t_1 return tmp
function code(x, y, z, t) t_1 = Float64(x * Float64(-y)) tmp = 0.0 if (y <= -1.9e+22) tmp = t_1; elseif (y <= -7.5e-87) tmp = Float64(x * z); elseif (y <= 3e-118) tmp = x; elseif (y <= 1.6e+99) tmp = Float64(x * z); else tmp = t_1; end return tmp end
function tmp_2 = code(x, y, z, t) t_1 = x * -y; tmp = 0.0; if (y <= -1.9e+22) tmp = t_1; elseif (y <= -7.5e-87) tmp = x * z; elseif (y <= 3e-118) tmp = x; elseif (y <= 1.6e+99) tmp = x * z; else tmp = t_1; end tmp_2 = tmp; end
code[x_, y_, z_, t_] := Block[{t$95$1 = N[(x * (-y)), $MachinePrecision]}, If[LessEqual[y, -1.9e+22], t$95$1, If[LessEqual[y, -7.5e-87], N[(x * z), $MachinePrecision], If[LessEqual[y, 3e-118], x, If[LessEqual[y, 1.6e+99], N[(x * z), $MachinePrecision], t$95$1]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := x \cdot \left(-y\right)\\
\mathbf{if}\;y \leq -1.9 \cdot 10^{+22}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;y \leq -7.5 \cdot 10^{-87}:\\
\;\;\;\;x \cdot z\\
\mathbf{elif}\;y \leq 3 \cdot 10^{-118}:\\
\;\;\;\;x\\
\mathbf{elif}\;y \leq 1.6 \cdot 10^{+99}:\\
\;\;\;\;x \cdot z\\
\mathbf{else}:\\
\;\;\;\;t\_1\\
\end{array}
\end{array}
if y < -1.9000000000000002e22 or 1.6e99 < y Initial program 100.0%
Taylor expanded in y around inf 88.2%
*-commutative88.2%
Simplified88.2%
Taylor expanded in t around 0 49.2%
mul-1-neg49.2%
*-commutative49.2%
distribute-rgt-neg-out49.2%
Simplified49.2%
Taylor expanded in y around inf 49.2%
mul-1-neg49.2%
*-commutative49.2%
distribute-lft-neg-in49.2%
Simplified49.2%
if -1.9000000000000002e22 < y < -7.5000000000000002e-87 or 3.00000000000000018e-118 < y < 1.6e99Initial program 100.0%
Taylor expanded in y around 0 76.7%
mul-1-neg76.7%
distribute-rgt-neg-in76.7%
sub-neg76.7%
+-commutative76.7%
distribute-neg-in76.7%
remove-double-neg76.7%
sub-neg76.7%
Simplified76.7%
Taylor expanded in t around 0 54.0%
Taylor expanded in z around inf 42.1%
*-commutative42.1%
Simplified42.1%
if -7.5000000000000002e-87 < y < 3.00000000000000018e-118Initial program 100.0%
Taylor expanded in y around 0 95.3%
mul-1-neg95.3%
distribute-rgt-neg-in95.3%
sub-neg95.3%
+-commutative95.3%
distribute-neg-in95.3%
remove-double-neg95.3%
sub-neg95.3%
Simplified95.3%
Taylor expanded in z around 0 40.4%
Final simplification44.7%
(FPCore (x y z t) :precision binary64 (if (or (<= t -2.7e-28) (not (<= t 7e+14))) (+ x (* (- y z) t)) (+ x (* x (- z y)))))
double code(double x, double y, double z, double t) {
double tmp;
if ((t <= -2.7e-28) || !(t <= 7e+14)) {
tmp = x + ((y - z) * t);
} else {
tmp = x + (x * (z - y));
}
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 <= (-2.7d-28)) .or. (.not. (t <= 7d+14))) then
tmp = x + ((y - z) * t)
else
tmp = x + (x * (z - y))
end if
code = tmp
end function
public static double code(double x, double y, double z, double t) {
double tmp;
if ((t <= -2.7e-28) || !(t <= 7e+14)) {
tmp = x + ((y - z) * t);
} else {
tmp = x + (x * (z - y));
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if (t <= -2.7e-28) or not (t <= 7e+14): tmp = x + ((y - z) * t) else: tmp = x + (x * (z - y)) return tmp
function code(x, y, z, t) tmp = 0.0 if ((t <= -2.7e-28) || !(t <= 7e+14)) tmp = Float64(x + Float64(Float64(y - z) * t)); else tmp = Float64(x + Float64(x * Float64(z - y))); end return tmp end
function tmp_2 = code(x, y, z, t) tmp = 0.0; if ((t <= -2.7e-28) || ~((t <= 7e+14))) tmp = x + ((y - z) * t); else tmp = x + (x * (z - y)); end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[Or[LessEqual[t, -2.7e-28], N[Not[LessEqual[t, 7e+14]], $MachinePrecision]], N[(x + N[(N[(y - z), $MachinePrecision] * t), $MachinePrecision]), $MachinePrecision], N[(x + N[(x * N[(z - y), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;t \leq -2.7 \cdot 10^{-28} \lor \neg \left(t \leq 7 \cdot 10^{+14}\right):\\
\;\;\;\;x + \left(y - z\right) \cdot t\\
\mathbf{else}:\\
\;\;\;\;x + x \cdot \left(z - y\right)\\
\end{array}
\end{array}
if t < -2.6999999999999999e-28 or 7e14 < t Initial program 100.0%
Taylor expanded in t around inf 84.5%
if -2.6999999999999999e-28 < t < 7e14Initial program 100.0%
Taylor expanded in t around 0 87.0%
mul-1-neg87.0%
distribute-rgt-neg-in87.0%
sub-neg87.0%
+-commutative87.0%
distribute-neg-in87.0%
remove-double-neg87.0%
sub-neg87.0%
Simplified87.0%
Final simplification85.6%
(FPCore (x y z t) :precision binary64 (if (or (<= z -0.00085) (not (<= z 4.5e+103))) (+ x (* z (- x t))) (+ x (* y (- t x)))))
double code(double x, double y, double z, double t) {
double tmp;
if ((z <= -0.00085) || !(z <= 4.5e+103)) {
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 <= (-0.00085d0)) .or. (.not. (z <= 4.5d+103))) 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 <= -0.00085) || !(z <= 4.5e+103)) {
tmp = x + (z * (x - t));
} else {
tmp = x + (y * (t - x));
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if (z <= -0.00085) or not (z <= 4.5e+103): tmp = x + (z * (x - t)) else: tmp = x + (y * (t - x)) return tmp
function code(x, y, z, t) tmp = 0.0 if ((z <= -0.00085) || !(z <= 4.5e+103)) 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 <= -0.00085) || ~((z <= 4.5e+103))) 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, -0.00085], N[Not[LessEqual[z, 4.5e+103]], $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 -0.00085 \lor \neg \left(z \leq 4.5 \cdot 10^{+103}\right):\\
\;\;\;\;x + z \cdot \left(x - t\right)\\
\mathbf{else}:\\
\;\;\;\;x + y \cdot \left(t - x\right)\\
\end{array}
\end{array}
if z < -8.49999999999999953e-4 or 4.50000000000000001e103 < z Initial program 100.0%
Taylor expanded in y around 0 86.1%
mul-1-neg86.1%
distribute-rgt-neg-in86.1%
sub-neg86.1%
+-commutative86.1%
distribute-neg-in86.1%
remove-double-neg86.1%
sub-neg86.1%
Simplified86.1%
if -8.49999999999999953e-4 < z < 4.50000000000000001e103Initial program 100.0%
Taylor expanded in y around inf 88.2%
*-commutative88.2%
Simplified88.2%
Final simplification87.3%
(FPCore (x y z t) :precision binary64 (if (or (<= z -1.55) (not (<= z 1.35e+103))) (* z (- x t)) (+ x (* y t))))
double code(double x, double y, double z, double t) {
double tmp;
if ((z <= -1.55) || !(z <= 1.35e+103)) {
tmp = z * (x - t);
} 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.55d0)) .or. (.not. (z <= 1.35d+103))) then
tmp = z * (x - t)
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.55) || !(z <= 1.35e+103)) {
tmp = z * (x - t);
} else {
tmp = x + (y * t);
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if (z <= -1.55) or not (z <= 1.35e+103): tmp = z * (x - t) else: tmp = x + (y * t) return tmp
function code(x, y, z, t) tmp = 0.0 if ((z <= -1.55) || !(z <= 1.35e+103)) tmp = Float64(z * Float64(x - t)); 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.55) || ~((z <= 1.35e+103))) tmp = z * (x - t); else tmp = x + (y * t); end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[Or[LessEqual[z, -1.55], N[Not[LessEqual[z, 1.35e+103]], $MachinePrecision]], N[(z * N[(x - t), $MachinePrecision]), $MachinePrecision], N[(x + N[(y * t), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \leq -1.55 \lor \neg \left(z \leq 1.35 \cdot 10^{+103}\right):\\
\;\;\;\;z \cdot \left(x - t\right)\\
\mathbf{else}:\\
\;\;\;\;x + y \cdot t\\
\end{array}
\end{array}
if z < -1.55000000000000004 or 1.34999999999999996e103 < z Initial program 100.0%
Taylor expanded in y around 0 85.3%
mul-1-neg85.3%
distribute-rgt-neg-in85.3%
sub-neg85.3%
+-commutative85.3%
distribute-neg-in85.3%
remove-double-neg85.3%
sub-neg85.3%
Simplified85.3%
Taylor expanded in z around inf 84.8%
if -1.55000000000000004 < z < 1.34999999999999996e103Initial program 100.0%
Taylor expanded in y around inf 88.1%
*-commutative88.1%
Simplified88.1%
Taylor expanded in t around inf 61.2%
*-commutative61.2%
Simplified61.2%
Final simplification70.7%
(FPCore (x y z t) :precision binary64 (if (or (<= z -190.0) (not (<= z 1.0))) (* x z) x))
double code(double x, double y, double z, double t) {
double tmp;
if ((z <= -190.0) || !(z <= 1.0)) {
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 <= (-190.0d0)) .or. (.not. (z <= 1.0d0))) 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 <= -190.0) || !(z <= 1.0)) {
tmp = x * z;
} else {
tmp = x;
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if (z <= -190.0) or not (z <= 1.0): tmp = x * z else: tmp = x return tmp
function code(x, y, z, t) tmp = 0.0 if ((z <= -190.0) || !(z <= 1.0)) tmp = Float64(x * z); else tmp = x; end return tmp end
function tmp_2 = code(x, y, z, t) tmp = 0.0; if ((z <= -190.0) || ~((z <= 1.0))) tmp = x * z; else tmp = x; end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[Or[LessEqual[z, -190.0], N[Not[LessEqual[z, 1.0]], $MachinePrecision]], N[(x * z), $MachinePrecision], x]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \leq -190 \lor \neg \left(z \leq 1\right):\\
\;\;\;\;x \cdot z\\
\mathbf{else}:\\
\;\;\;\;x\\
\end{array}
\end{array}
if z < -190 or 1 < z Initial program 100.0%
Taylor expanded in y around 0 77.1%
mul-1-neg77.1%
distribute-rgt-neg-in77.1%
sub-neg77.1%
+-commutative77.1%
distribute-neg-in77.1%
remove-double-neg77.1%
sub-neg77.1%
Simplified77.1%
Taylor expanded in t around 0 41.7%
Taylor expanded in z around inf 40.6%
*-commutative40.6%
Simplified40.6%
if -190 < z < 1Initial program 100.0%
Taylor expanded in y around 0 40.3%
mul-1-neg40.3%
distribute-rgt-neg-in40.3%
sub-neg40.3%
+-commutative40.3%
distribute-neg-in40.3%
remove-double-neg40.3%
sub-neg40.3%
Simplified40.3%
Taylor expanded in z around 0 32.2%
Final simplification36.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 58.6%
mul-1-neg58.6%
distribute-rgt-neg-in58.6%
sub-neg58.6%
+-commutative58.6%
distribute-neg-in58.6%
remove-double-neg58.6%
sub-neg58.6%
Simplified58.6%
Taylor expanded in z around 0 17.7%
Final simplification17.7%
(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 2024071
(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))))