
(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 12 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 (* t (- z))))
(if (<= z -8.2e-12)
t_1
(if (<= z -1.65e-250)
x
(if (or (<= z 1.55e-134) (and (not (<= z 5.2e-18)) (<= z 3.8e+138)))
(* y t)
t_1)))))
double code(double x, double y, double z, double t) {
double t_1 = t * -z;
double tmp;
if (z <= -8.2e-12) {
tmp = t_1;
} else if (z <= -1.65e-250) {
tmp = x;
} else if ((z <= 1.55e-134) || (!(z <= 5.2e-18) && (z <= 3.8e+138))) {
tmp = y * t;
} 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 = t * -z
if (z <= (-8.2d-12)) then
tmp = t_1
else if (z <= (-1.65d-250)) then
tmp = x
else if ((z <= 1.55d-134) .or. (.not. (z <= 5.2d-18)) .and. (z <= 3.8d+138)) then
tmp = y * t
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 = t * -z;
double tmp;
if (z <= -8.2e-12) {
tmp = t_1;
} else if (z <= -1.65e-250) {
tmp = x;
} else if ((z <= 1.55e-134) || (!(z <= 5.2e-18) && (z <= 3.8e+138))) {
tmp = y * t;
} else {
tmp = t_1;
}
return tmp;
}
def code(x, y, z, t): t_1 = t * -z tmp = 0 if z <= -8.2e-12: tmp = t_1 elif z <= -1.65e-250: tmp = x elif (z <= 1.55e-134) or (not (z <= 5.2e-18) and (z <= 3.8e+138)): tmp = y * t else: tmp = t_1 return tmp
function code(x, y, z, t) t_1 = Float64(t * Float64(-z)) tmp = 0.0 if (z <= -8.2e-12) tmp = t_1; elseif (z <= -1.65e-250) tmp = x; elseif ((z <= 1.55e-134) || (!(z <= 5.2e-18) && (z <= 3.8e+138))) tmp = Float64(y * t); else tmp = t_1; end return tmp end
function tmp_2 = code(x, y, z, t) t_1 = t * -z; tmp = 0.0; if (z <= -8.2e-12) tmp = t_1; elseif (z <= -1.65e-250) tmp = x; elseif ((z <= 1.55e-134) || (~((z <= 5.2e-18)) && (z <= 3.8e+138))) tmp = y * t; else tmp = t_1; end tmp_2 = tmp; end
code[x_, y_, z_, t_] := Block[{t$95$1 = N[(t * (-z)), $MachinePrecision]}, If[LessEqual[z, -8.2e-12], t$95$1, If[LessEqual[z, -1.65e-250], x, If[Or[LessEqual[z, 1.55e-134], And[N[Not[LessEqual[z, 5.2e-18]], $MachinePrecision], LessEqual[z, 3.8e+138]]], N[(y * t), $MachinePrecision], t$95$1]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := t \cdot \left(-z\right)\\
\mathbf{if}\;z \leq -8.2 \cdot 10^{-12}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;z \leq -1.65 \cdot 10^{-250}:\\
\;\;\;\;x\\
\mathbf{elif}\;z \leq 1.55 \cdot 10^{-134} \lor \neg \left(z \leq 5.2 \cdot 10^{-18}\right) \land z \leq 3.8 \cdot 10^{+138}:\\
\;\;\;\;y \cdot t\\
\mathbf{else}:\\
\;\;\;\;t\_1\\
\end{array}
\end{array}
if z < -8.19999999999999979e-12 or 1.55000000000000003e-134 < z < 5.2000000000000001e-18 or 3.80000000000000012e138 < z Initial program 100.0%
Taylor expanded in t around inf 60.3%
Taylor expanded in y around 0 58.7%
associate-+r+58.7%
mul-1-neg58.7%
sub-neg58.7%
associate-+l-58.7%
Applied egg-rr58.7%
Taylor expanded in z around inf 45.5%
associate-*r*45.5%
neg-mul-145.5%
Simplified45.5%
if -8.19999999999999979e-12 < z < -1.65e-250Initial program 99.9%
Taylor expanded in t around inf 76.1%
Taylor expanded in x around inf 47.0%
if -1.65e-250 < z < 1.55000000000000003e-134 or 5.2000000000000001e-18 < z < 3.80000000000000012e138Initial program 100.0%
Taylor expanded in t around inf 63.7%
Taylor expanded in y around 0 60.9%
associate-+r+60.9%
mul-1-neg60.9%
sub-neg60.9%
associate-+l-60.9%
Applied egg-rr60.9%
Taylor expanded in y around inf 40.4%
Final simplification44.4%
(FPCore (x y z t)
:precision binary64
(let* ((t_1 (* t (- z))))
(if (<= z -3.5e-10)
t_1
(if (<= z -2.85e-248)
x
(if (<= z 1.55e-134)
(* y t)
(if (or (<= z 3.9e-20) (not (<= z 1.45e+112))) t_1 (* x (- y))))))))
double code(double x, double y, double z, double t) {
double t_1 = t * -z;
double tmp;
if (z <= -3.5e-10) {
tmp = t_1;
} else if (z <= -2.85e-248) {
tmp = x;
} else if (z <= 1.55e-134) {
tmp = y * t;
} else if ((z <= 3.9e-20) || !(z <= 1.45e+112)) {
tmp = t_1;
} else {
tmp = x * -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) :: t_1
real(8) :: tmp
t_1 = t * -z
if (z <= (-3.5d-10)) then
tmp = t_1
else if (z <= (-2.85d-248)) then
tmp = x
else if (z <= 1.55d-134) then
tmp = y * t
else if ((z <= 3.9d-20) .or. (.not. (z <= 1.45d+112))) then
tmp = t_1
else
tmp = x * -y
end if
code = tmp
end function
public static double code(double x, double y, double z, double t) {
double t_1 = t * -z;
double tmp;
if (z <= -3.5e-10) {
tmp = t_1;
} else if (z <= -2.85e-248) {
tmp = x;
} else if (z <= 1.55e-134) {
tmp = y * t;
} else if ((z <= 3.9e-20) || !(z <= 1.45e+112)) {
tmp = t_1;
} else {
tmp = x * -y;
}
return tmp;
}
def code(x, y, z, t): t_1 = t * -z tmp = 0 if z <= -3.5e-10: tmp = t_1 elif z <= -2.85e-248: tmp = x elif z <= 1.55e-134: tmp = y * t elif (z <= 3.9e-20) or not (z <= 1.45e+112): tmp = t_1 else: tmp = x * -y return tmp
function code(x, y, z, t) t_1 = Float64(t * Float64(-z)) tmp = 0.0 if (z <= -3.5e-10) tmp = t_1; elseif (z <= -2.85e-248) tmp = x; elseif (z <= 1.55e-134) tmp = Float64(y * t); elseif ((z <= 3.9e-20) || !(z <= 1.45e+112)) tmp = t_1; else tmp = Float64(x * Float64(-y)); end return tmp end
function tmp_2 = code(x, y, z, t) t_1 = t * -z; tmp = 0.0; if (z <= -3.5e-10) tmp = t_1; elseif (z <= -2.85e-248) tmp = x; elseif (z <= 1.55e-134) tmp = y * t; elseif ((z <= 3.9e-20) || ~((z <= 1.45e+112))) tmp = t_1; else tmp = x * -y; end tmp_2 = tmp; end
code[x_, y_, z_, t_] := Block[{t$95$1 = N[(t * (-z)), $MachinePrecision]}, If[LessEqual[z, -3.5e-10], t$95$1, If[LessEqual[z, -2.85e-248], x, If[LessEqual[z, 1.55e-134], N[(y * t), $MachinePrecision], If[Or[LessEqual[z, 3.9e-20], N[Not[LessEqual[z, 1.45e+112]], $MachinePrecision]], t$95$1, N[(x * (-y)), $MachinePrecision]]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := t \cdot \left(-z\right)\\
\mathbf{if}\;z \leq -3.5 \cdot 10^{-10}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;z \leq -2.85 \cdot 10^{-248}:\\
\;\;\;\;x\\
\mathbf{elif}\;z \leq 1.55 \cdot 10^{-134}:\\
\;\;\;\;y \cdot t\\
\mathbf{elif}\;z \leq 3.9 \cdot 10^{-20} \lor \neg \left(z \leq 1.45 \cdot 10^{+112}\right):\\
\;\;\;\;t\_1\\
\mathbf{else}:\\
\;\;\;\;x \cdot \left(-y\right)\\
\end{array}
\end{array}
if z < -3.4999999999999998e-10 or 1.55000000000000003e-134 < z < 3.90000000000000007e-20 or 1.4500000000000001e112 < z Initial program 100.0%
Taylor expanded in t around inf 61.0%
Taylor expanded in y around 0 58.0%
associate-+r+58.0%
mul-1-neg58.0%
sub-neg58.0%
associate-+l-58.0%
Applied egg-rr58.0%
Taylor expanded in z around inf 45.4%
associate-*r*45.4%
neg-mul-145.4%
Simplified45.4%
if -3.4999999999999998e-10 < z < -2.8499999999999999e-248Initial program 99.9%
Taylor expanded in t around inf 76.1%
Taylor expanded in x around inf 47.0%
if -2.8499999999999999e-248 < z < 1.55000000000000003e-134Initial program 100.0%
Taylor expanded in t around inf 79.7%
Taylor expanded in y around 0 79.7%
associate-+r+79.7%
mul-1-neg79.7%
sub-neg79.7%
associate-+l-79.7%
Applied egg-rr79.7%
Taylor expanded in y around inf 49.5%
if 3.90000000000000007e-20 < z < 1.4500000000000001e112Initial program 100.0%
Taylor expanded in y around inf 71.6%
*-commutative71.6%
Simplified71.6%
Taylor expanded in x around inf 56.9%
mul-1-neg56.9%
unsub-neg56.9%
Simplified56.9%
Taylor expanded in y around inf 49.8%
associate-*r*49.8%
mul-1-neg49.8%
Simplified49.8%
Final simplification46.8%
(FPCore (x y z t)
:precision binary64
(let* ((t_1 (* y (- t x))) (t_2 (+ x (* x z))))
(if (<= y -1.75e-19)
t_1
(if (<= y -5.8e-149)
t_2
(if (<= y -2.9e-192)
(* (- y z) t)
(if (<= y 14000000000.0) t_2 t_1))))))
double code(double x, double y, double z, double t) {
double t_1 = y * (t - x);
double t_2 = x + (x * z);
double tmp;
if (y <= -1.75e-19) {
tmp = t_1;
} else if (y <= -5.8e-149) {
tmp = t_2;
} else if (y <= -2.9e-192) {
tmp = (y - z) * t;
} else if (y <= 14000000000.0) {
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 = y * (t - x)
t_2 = x + (x * z)
if (y <= (-1.75d-19)) then
tmp = t_1
else if (y <= (-5.8d-149)) then
tmp = t_2
else if (y <= (-2.9d-192)) then
tmp = (y - z) * t
else if (y <= 14000000000.0d0) 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 = y * (t - x);
double t_2 = x + (x * z);
double tmp;
if (y <= -1.75e-19) {
tmp = t_1;
} else if (y <= -5.8e-149) {
tmp = t_2;
} else if (y <= -2.9e-192) {
tmp = (y - z) * t;
} else if (y <= 14000000000.0) {
tmp = t_2;
} else {
tmp = t_1;
}
return tmp;
}
def code(x, y, z, t): t_1 = y * (t - x) t_2 = x + (x * z) tmp = 0 if y <= -1.75e-19: tmp = t_1 elif y <= -5.8e-149: tmp = t_2 elif y <= -2.9e-192: tmp = (y - z) * t elif y <= 14000000000.0: tmp = t_2 else: tmp = t_1 return tmp
function code(x, y, z, t) t_1 = Float64(y * Float64(t - x)) t_2 = Float64(x + Float64(x * z)) tmp = 0.0 if (y <= -1.75e-19) tmp = t_1; elseif (y <= -5.8e-149) tmp = t_2; elseif (y <= -2.9e-192) tmp = Float64(Float64(y - z) * t); elseif (y <= 14000000000.0) tmp = t_2; else tmp = t_1; end return tmp end
function tmp_2 = code(x, y, z, t) t_1 = y * (t - x); t_2 = x + (x * z); tmp = 0.0; if (y <= -1.75e-19) tmp = t_1; elseif (y <= -5.8e-149) tmp = t_2; elseif (y <= -2.9e-192) tmp = (y - z) * t; elseif (y <= 14000000000.0) tmp = t_2; else tmp = t_1; end tmp_2 = tmp; end
code[x_, y_, z_, t_] := Block[{t$95$1 = N[(y * N[(t - x), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$2 = N[(x + N[(x * z), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[y, -1.75e-19], t$95$1, If[LessEqual[y, -5.8e-149], t$95$2, If[LessEqual[y, -2.9e-192], N[(N[(y - z), $MachinePrecision] * t), $MachinePrecision], If[LessEqual[y, 14000000000.0], t$95$2, t$95$1]]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := y \cdot \left(t - x\right)\\
t_2 := x + x \cdot z\\
\mathbf{if}\;y \leq -1.75 \cdot 10^{-19}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;y \leq -5.8 \cdot 10^{-149}:\\
\;\;\;\;t\_2\\
\mathbf{elif}\;y \leq -2.9 \cdot 10^{-192}:\\
\;\;\;\;\left(y - z\right) \cdot t\\
\mathbf{elif}\;y \leq 14000000000:\\
\;\;\;\;t\_2\\
\mathbf{else}:\\
\;\;\;\;t\_1\\
\end{array}
\end{array}
if y < -1.75000000000000008e-19 or 1.4e10 < y Initial program 100.0%
Taylor expanded in y around inf 79.3%
*-commutative79.3%
Simplified79.3%
Taylor expanded in x around -inf 74.0%
+-commutative74.0%
mul-1-neg74.0%
unsub-neg74.0%
sub-neg74.0%
metadata-eval74.0%
+-commutative74.0%
Simplified74.0%
Taylor expanded in y around inf 76.6%
if -1.75000000000000008e-19 < y < -5.8e-149 or -2.90000000000000016e-192 < y < 1.4e10Initial program 100.0%
Taylor expanded in t around 0 62.7%
mul-1-neg62.7%
distribute-lft-neg-out62.7%
*-commutative62.7%
Simplified62.7%
Taylor expanded in y around 0 61.8%
*-commutative61.8%
Simplified61.8%
if -5.8e-149 < y < -2.90000000000000016e-192Initial program 100.0%
Taylor expanded in t around inf 91.8%
Taylor expanded in y around 0 91.8%
associate-+r+91.8%
mul-1-neg91.8%
sub-neg91.8%
associate-+l-91.8%
Applied egg-rr91.8%
Taylor expanded in x around 0 83.0%
distribute-lft-out--83.0%
Simplified83.0%
Final simplification70.4%
(FPCore (x y z t)
:precision binary64
(let* ((t_1 (* y (- t x))))
(if (<= y -0.36)
t_1
(if (<= y 3.55e-127)
(- x (* z t))
(if (<= y 35000000000.0)
(+ x (* x z))
(if (<= y 5.4e+110) (* (- y z) t) t_1))))))
double code(double x, double y, double z, double t) {
double t_1 = y * (t - x);
double tmp;
if (y <= -0.36) {
tmp = t_1;
} else if (y <= 3.55e-127) {
tmp = x - (z * t);
} else if (y <= 35000000000.0) {
tmp = x + (x * z);
} else if (y <= 5.4e+110) {
tmp = (y - z) * t;
} 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 = y * (t - x)
if (y <= (-0.36d0)) then
tmp = t_1
else if (y <= 3.55d-127) then
tmp = x - (z * t)
else if (y <= 35000000000.0d0) then
tmp = x + (x * z)
else if (y <= 5.4d+110) then
tmp = (y - z) * t
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 = y * (t - x);
double tmp;
if (y <= -0.36) {
tmp = t_1;
} else if (y <= 3.55e-127) {
tmp = x - (z * t);
} else if (y <= 35000000000.0) {
tmp = x + (x * z);
} else if (y <= 5.4e+110) {
tmp = (y - z) * t;
} else {
tmp = t_1;
}
return tmp;
}
def code(x, y, z, t): t_1 = y * (t - x) tmp = 0 if y <= -0.36: tmp = t_1 elif y <= 3.55e-127: tmp = x - (z * t) elif y <= 35000000000.0: tmp = x + (x * z) elif y <= 5.4e+110: tmp = (y - z) * t else: tmp = t_1 return tmp
function code(x, y, z, t) t_1 = Float64(y * Float64(t - x)) tmp = 0.0 if (y <= -0.36) tmp = t_1; elseif (y <= 3.55e-127) tmp = Float64(x - Float64(z * t)); elseif (y <= 35000000000.0) tmp = Float64(x + Float64(x * z)); elseif (y <= 5.4e+110) tmp = Float64(Float64(y - z) * t); else tmp = t_1; end return tmp end
function tmp_2 = code(x, y, z, t) t_1 = y * (t - x); tmp = 0.0; if (y <= -0.36) tmp = t_1; elseif (y <= 3.55e-127) tmp = x - (z * t); elseif (y <= 35000000000.0) tmp = x + (x * z); elseif (y <= 5.4e+110) tmp = (y - z) * t; else tmp = t_1; end tmp_2 = tmp; end
code[x_, y_, z_, t_] := Block[{t$95$1 = N[(y * N[(t - x), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[y, -0.36], t$95$1, If[LessEqual[y, 3.55e-127], N[(x - N[(z * t), $MachinePrecision]), $MachinePrecision], If[LessEqual[y, 35000000000.0], N[(x + N[(x * z), $MachinePrecision]), $MachinePrecision], If[LessEqual[y, 5.4e+110], N[(N[(y - z), $MachinePrecision] * t), $MachinePrecision], t$95$1]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := y \cdot \left(t - x\right)\\
\mathbf{if}\;y \leq -0.36:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;y \leq 3.55 \cdot 10^{-127}:\\
\;\;\;\;x - z \cdot t\\
\mathbf{elif}\;y \leq 35000000000:\\
\;\;\;\;x + x \cdot z\\
\mathbf{elif}\;y \leq 5.4 \cdot 10^{+110}:\\
\;\;\;\;\left(y - z\right) \cdot t\\
\mathbf{else}:\\
\;\;\;\;t\_1\\
\end{array}
\end{array}
if y < -0.35999999999999999 or 5.40000000000000019e110 < y Initial program 100.0%
Taylor expanded in y around inf 84.4%
*-commutative84.4%
Simplified84.4%
Taylor expanded in x around -inf 77.5%
+-commutative77.5%
mul-1-neg77.5%
unsub-neg77.5%
sub-neg77.5%
metadata-eval77.5%
+-commutative77.5%
Simplified77.5%
Taylor expanded in y around inf 84.4%
if -0.35999999999999999 < y < 3.5500000000000001e-127Initial program 100.0%
Taylor expanded in t around inf 82.5%
Taylor expanded in y around 0 74.6%
mul-1-neg74.6%
unsub-neg74.6%
Simplified74.6%
if 3.5500000000000001e-127 < y < 3.5e10Initial program 100.0%
Taylor expanded in t around 0 68.1%
mul-1-neg68.1%
distribute-lft-neg-out68.1%
*-commutative68.1%
Simplified68.1%
Taylor expanded in y around 0 64.4%
*-commutative64.4%
Simplified64.4%
if 3.5e10 < y < 5.40000000000000019e110Initial program 100.0%
Taylor expanded in t around inf 64.5%
Taylor expanded in y around 0 64.5%
associate-+r+64.5%
mul-1-neg64.5%
sub-neg64.5%
associate-+l-64.5%
Applied egg-rr64.5%
Taylor expanded in x around 0 64.8%
distribute-lft-out--64.8%
Simplified64.8%
Final simplification76.6%
(FPCore (x y z t)
:precision binary64
(let* ((t_1 (* (- y z) t)) (t_2 (* y (- t x))))
(if (<= y -6.2e+27)
t_2
(if (<= y 1.75e-25)
(+ x t_1)
(if (<= y 70000000000.0) (+ x (* x z)) (if (<= y 1.1e+111) t_1 t_2))))))
double code(double x, double y, double z, double t) {
double t_1 = (y - z) * t;
double t_2 = y * (t - x);
double tmp;
if (y <= -6.2e+27) {
tmp = t_2;
} else if (y <= 1.75e-25) {
tmp = x + t_1;
} else if (y <= 70000000000.0) {
tmp = x + (x * z);
} else if (y <= 1.1e+111) {
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) :: tmp
t_1 = (y - z) * t
t_2 = y * (t - x)
if (y <= (-6.2d+27)) then
tmp = t_2
else if (y <= 1.75d-25) then
tmp = x + t_1
else if (y <= 70000000000.0d0) then
tmp = x + (x * z)
else if (y <= 1.1d+111) 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 = (y - z) * t;
double t_2 = y * (t - x);
double tmp;
if (y <= -6.2e+27) {
tmp = t_2;
} else if (y <= 1.75e-25) {
tmp = x + t_1;
} else if (y <= 70000000000.0) {
tmp = x + (x * z);
} else if (y <= 1.1e+111) {
tmp = t_1;
} else {
tmp = t_2;
}
return tmp;
}
def code(x, y, z, t): t_1 = (y - z) * t t_2 = y * (t - x) tmp = 0 if y <= -6.2e+27: tmp = t_2 elif y <= 1.75e-25: tmp = x + t_1 elif y <= 70000000000.0: tmp = x + (x * z) elif y <= 1.1e+111: tmp = t_1 else: tmp = t_2 return tmp
function code(x, y, z, t) t_1 = Float64(Float64(y - z) * t) t_2 = Float64(y * Float64(t - x)) tmp = 0.0 if (y <= -6.2e+27) tmp = t_2; elseif (y <= 1.75e-25) tmp = Float64(x + t_1); elseif (y <= 70000000000.0) tmp = Float64(x + Float64(x * z)); elseif (y <= 1.1e+111) tmp = t_1; else tmp = t_2; end return tmp end
function tmp_2 = code(x, y, z, t) t_1 = (y - z) * t; t_2 = y * (t - x); tmp = 0.0; if (y <= -6.2e+27) tmp = t_2; elseif (y <= 1.75e-25) tmp = x + t_1; elseif (y <= 70000000000.0) tmp = x + (x * z); elseif (y <= 1.1e+111) tmp = t_1; else tmp = t_2; end tmp_2 = tmp; end
code[x_, y_, z_, t_] := Block[{t$95$1 = N[(N[(y - z), $MachinePrecision] * t), $MachinePrecision]}, Block[{t$95$2 = N[(y * N[(t - x), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[y, -6.2e+27], t$95$2, If[LessEqual[y, 1.75e-25], N[(x + t$95$1), $MachinePrecision], If[LessEqual[y, 70000000000.0], N[(x + N[(x * z), $MachinePrecision]), $MachinePrecision], If[LessEqual[y, 1.1e+111], t$95$1, t$95$2]]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := \left(y - z\right) \cdot t\\
t_2 := y \cdot \left(t - x\right)\\
\mathbf{if}\;y \leq -6.2 \cdot 10^{+27}:\\
\;\;\;\;t\_2\\
\mathbf{elif}\;y \leq 1.75 \cdot 10^{-25}:\\
\;\;\;\;x + t\_1\\
\mathbf{elif}\;y \leq 70000000000:\\
\;\;\;\;x + x \cdot z\\
\mathbf{elif}\;y \leq 1.1 \cdot 10^{+111}:\\
\;\;\;\;t\_1\\
\mathbf{else}:\\
\;\;\;\;t\_2\\
\end{array}
\end{array}
if y < -6.19999999999999992e27 or 1.09999999999999999e111 < y Initial program 100.0%
Taylor expanded in y around inf 84.4%
*-commutative84.4%
Simplified84.4%
Taylor expanded in x around -inf 77.5%
+-commutative77.5%
mul-1-neg77.5%
unsub-neg77.5%
sub-neg77.5%
metadata-eval77.5%
+-commutative77.5%
Simplified77.5%
Taylor expanded in y around inf 84.4%
if -6.19999999999999992e27 < y < 1.7500000000000001e-25Initial program 100.0%
Taylor expanded in t around inf 81.4%
if 1.7500000000000001e-25 < y < 7e10Initial program 100.0%
Taylor expanded in t around 0 86.3%
mul-1-neg86.3%
distribute-lft-neg-out86.3%
*-commutative86.3%
Simplified86.3%
Taylor expanded in y around 0 72.1%
*-commutative72.1%
Simplified72.1%
if 7e10 < y < 1.09999999999999999e111Initial program 100.0%
Taylor expanded in t around inf 64.5%
Taylor expanded in y around 0 64.5%
associate-+r+64.5%
mul-1-neg64.5%
sub-neg64.5%
associate-+l-64.5%
Applied egg-rr64.5%
Taylor expanded in x around 0 64.8%
distribute-lft-out--64.8%
Simplified64.8%
Final simplification80.9%
(FPCore (x y z t) :precision binary64 (if (or (<= y -650000.0) (not (<= y 5.1e+14))) (* y (- t x)) (+ x (* z (- x t)))))
double code(double x, double y, double z, double t) {
double tmp;
if ((y <= -650000.0) || !(y <= 5.1e+14)) {
tmp = y * (t - x);
} else {
tmp = x + (z * (x - 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 ((y <= (-650000.0d0)) .or. (.not. (y <= 5.1d+14))) then
tmp = y * (t - x)
else
tmp = x + (z * (x - t))
end if
code = tmp
end function
public static double code(double x, double y, double z, double t) {
double tmp;
if ((y <= -650000.0) || !(y <= 5.1e+14)) {
tmp = y * (t - x);
} else {
tmp = x + (z * (x - t));
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if (y <= -650000.0) or not (y <= 5.1e+14): tmp = y * (t - x) else: tmp = x + (z * (x - t)) return tmp
function code(x, y, z, t) tmp = 0.0 if ((y <= -650000.0) || !(y <= 5.1e+14)) tmp = Float64(y * Float64(t - x)); else tmp = Float64(x + Float64(z * Float64(x - t))); end return tmp end
function tmp_2 = code(x, y, z, t) tmp = 0.0; if ((y <= -650000.0) || ~((y <= 5.1e+14))) tmp = y * (t - x); else tmp = x + (z * (x - t)); end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[Or[LessEqual[y, -650000.0], N[Not[LessEqual[y, 5.1e+14]], $MachinePrecision]], N[(y * N[(t - x), $MachinePrecision]), $MachinePrecision], N[(x + N[(z * N[(x - t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;y \leq -650000 \lor \neg \left(y \leq 5.1 \cdot 10^{+14}\right):\\
\;\;\;\;y \cdot \left(t - x\right)\\
\mathbf{else}:\\
\;\;\;\;x + z \cdot \left(x - t\right)\\
\end{array}
\end{array}
if y < -6.5e5 or 5.1e14 < y Initial program 100.0%
Taylor expanded in y around inf 79.9%
*-commutative79.9%
Simplified79.9%
Taylor expanded in x around -inf 74.2%
+-commutative74.2%
mul-1-neg74.2%
unsub-neg74.2%
sub-neg74.2%
metadata-eval74.2%
+-commutative74.2%
Simplified74.2%
Taylor expanded in y around inf 79.9%
if -6.5e5 < y < 5.1e14Initial program 100.0%
sub-neg100.0%
distribute-lft-in97.7%
Applied egg-rr97.7%
Taylor expanded in y around 0 87.3%
+-commutative87.3%
associate-*r*87.3%
distribute-rgt-in89.6%
mul-1-neg89.6%
sub-neg89.6%
Simplified89.6%
Final simplification85.0%
(FPCore (x y z t)
:precision binary64
(let* ((t_1 (* y (- t x))))
(if (<= y -1.75e-19)
(+ x t_1)
(if (<= y 6.8e+19) (+ x (* z (- x t))) t_1))))
double code(double x, double y, double z, double t) {
double t_1 = y * (t - x);
double tmp;
if (y <= -1.75e-19) {
tmp = x + t_1;
} else if (y <= 6.8e+19) {
tmp = x + (z * (x - t));
} 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 = y * (t - x)
if (y <= (-1.75d-19)) then
tmp = x + t_1
else if (y <= 6.8d+19) then
tmp = x + (z * (x - t))
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 = y * (t - x);
double tmp;
if (y <= -1.75e-19) {
tmp = x + t_1;
} else if (y <= 6.8e+19) {
tmp = x + (z * (x - t));
} else {
tmp = t_1;
}
return tmp;
}
def code(x, y, z, t): t_1 = y * (t - x) tmp = 0 if y <= -1.75e-19: tmp = x + t_1 elif y <= 6.8e+19: tmp = x + (z * (x - t)) else: tmp = t_1 return tmp
function code(x, y, z, t) t_1 = Float64(y * Float64(t - x)) tmp = 0.0 if (y <= -1.75e-19) tmp = Float64(x + t_1); elseif (y <= 6.8e+19) tmp = Float64(x + Float64(z * Float64(x - t))); else tmp = t_1; end return tmp end
function tmp_2 = code(x, y, z, t) t_1 = y * (t - x); tmp = 0.0; if (y <= -1.75e-19) tmp = x + t_1; elseif (y <= 6.8e+19) tmp = x + (z * (x - t)); else tmp = t_1; end tmp_2 = tmp; end
code[x_, y_, z_, t_] := Block[{t$95$1 = N[(y * N[(t - x), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[y, -1.75e-19], N[(x + t$95$1), $MachinePrecision], If[LessEqual[y, 6.8e+19], N[(x + N[(z * N[(x - t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], t$95$1]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := y \cdot \left(t - x\right)\\
\mathbf{if}\;y \leq -1.75 \cdot 10^{-19}:\\
\;\;\;\;x + t\_1\\
\mathbf{elif}\;y \leq 6.8 \cdot 10^{+19}:\\
\;\;\;\;x + z \cdot \left(x - t\right)\\
\mathbf{else}:\\
\;\;\;\;t\_1\\
\end{array}
\end{array}
if y < -1.75000000000000008e-19Initial program 100.0%
Taylor expanded in y around inf 78.8%
*-commutative78.8%
Simplified78.8%
if -1.75000000000000008e-19 < y < 6.8e19Initial program 100.0%
sub-neg100.0%
distribute-lft-in98.4%
Applied egg-rr98.4%
Taylor expanded in y around 0 90.9%
+-commutative90.9%
associate-*r*90.9%
distribute-rgt-in92.5%
mul-1-neg92.5%
sub-neg92.5%
Simplified92.5%
if 6.8e19 < y Initial program 100.0%
Taylor expanded in y around inf 81.3%
*-commutative81.3%
Simplified81.3%
Taylor expanded in x around -inf 72.5%
+-commutative72.5%
mul-1-neg72.5%
unsub-neg72.5%
sub-neg72.5%
metadata-eval72.5%
+-commutative72.5%
Simplified72.5%
Taylor expanded in y around inf 81.3%
Final simplification86.0%
(FPCore (x y z t) :precision binary64 (if (or (<= x -13000000000.0) (not (<= x 5.1e+197))) (* x (- y)) (* (- y z) t)))
double code(double x, double y, double z, double t) {
double tmp;
if ((x <= -13000000000.0) || !(x <= 5.1e+197)) {
tmp = x * -y;
} else {
tmp = (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 ((x <= (-13000000000.0d0)) .or. (.not. (x <= 5.1d+197))) then
tmp = x * -y
else
tmp = (y - z) * t
end if
code = tmp
end function
public static double code(double x, double y, double z, double t) {
double tmp;
if ((x <= -13000000000.0) || !(x <= 5.1e+197)) {
tmp = x * -y;
} else {
tmp = (y - z) * t;
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if (x <= -13000000000.0) or not (x <= 5.1e+197): tmp = x * -y else: tmp = (y - z) * t return tmp
function code(x, y, z, t) tmp = 0.0 if ((x <= -13000000000.0) || !(x <= 5.1e+197)) tmp = Float64(x * Float64(-y)); else tmp = Float64(Float64(y - z) * t); end return tmp end
function tmp_2 = code(x, y, z, t) tmp = 0.0; if ((x <= -13000000000.0) || ~((x <= 5.1e+197))) tmp = x * -y; else tmp = (y - z) * t; end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[Or[LessEqual[x, -13000000000.0], N[Not[LessEqual[x, 5.1e+197]], $MachinePrecision]], N[(x * (-y)), $MachinePrecision], N[(N[(y - z), $MachinePrecision] * t), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x \leq -13000000000 \lor \neg \left(x \leq 5.1 \cdot 10^{+197}\right):\\
\;\;\;\;x \cdot \left(-y\right)\\
\mathbf{else}:\\
\;\;\;\;\left(y - z\right) \cdot t\\
\end{array}
\end{array}
if x < -1.3e10 or 5.09999999999999992e197 < x Initial program 100.0%
Taylor expanded in y around inf 71.2%
*-commutative71.2%
Simplified71.2%
Taylor expanded in x around inf 67.2%
mul-1-neg67.2%
unsub-neg67.2%
Simplified67.2%
Taylor expanded in y around inf 45.3%
associate-*r*45.3%
mul-1-neg45.3%
Simplified45.3%
if -1.3e10 < x < 5.09999999999999992e197Initial program 100.0%
Taylor expanded in t around inf 77.0%
Taylor expanded in y around 0 75.2%
associate-+r+75.2%
mul-1-neg75.2%
sub-neg75.2%
associate-+l-75.2%
Applied egg-rr75.2%
Taylor expanded in x around 0 60.3%
distribute-lft-out--62.0%
Simplified62.0%
Final simplification56.7%
(FPCore (x y z t) :precision binary64 (if (or (<= x -505.0) (not (<= x 5.8e+48))) (* x (- 1.0 y)) (* (- y z) t)))
double code(double x, double y, double z, double t) {
double tmp;
if ((x <= -505.0) || !(x <= 5.8e+48)) {
tmp = x * (1.0 - y);
} else {
tmp = (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 ((x <= (-505.0d0)) .or. (.not. (x <= 5.8d+48))) then
tmp = x * (1.0d0 - y)
else
tmp = (y - z) * t
end if
code = tmp
end function
public static double code(double x, double y, double z, double t) {
double tmp;
if ((x <= -505.0) || !(x <= 5.8e+48)) {
tmp = x * (1.0 - y);
} else {
tmp = (y - z) * t;
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if (x <= -505.0) or not (x <= 5.8e+48): tmp = x * (1.0 - y) else: tmp = (y - z) * t return tmp
function code(x, y, z, t) tmp = 0.0 if ((x <= -505.0) || !(x <= 5.8e+48)) tmp = Float64(x * Float64(1.0 - y)); else tmp = Float64(Float64(y - z) * t); end return tmp end
function tmp_2 = code(x, y, z, t) tmp = 0.0; if ((x <= -505.0) || ~((x <= 5.8e+48))) tmp = x * (1.0 - y); else tmp = (y - z) * t; end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[Or[LessEqual[x, -505.0], N[Not[LessEqual[x, 5.8e+48]], $MachinePrecision]], N[(x * N[(1.0 - y), $MachinePrecision]), $MachinePrecision], N[(N[(y - z), $MachinePrecision] * t), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x \leq -505 \lor \neg \left(x \leq 5.8 \cdot 10^{+48}\right):\\
\;\;\;\;x \cdot \left(1 - y\right)\\
\mathbf{else}:\\
\;\;\;\;\left(y - z\right) \cdot t\\
\end{array}
\end{array}
if x < -505 or 5.7999999999999998e48 < x Initial program 100.0%
Taylor expanded in y around inf 67.4%
*-commutative67.4%
Simplified67.4%
Taylor expanded in x around inf 59.8%
mul-1-neg59.8%
unsub-neg59.8%
Simplified59.8%
if -505 < x < 5.7999999999999998e48Initial program 100.0%
Taylor expanded in t around inf 82.1%
Taylor expanded in y around 0 80.6%
associate-+r+80.6%
mul-1-neg80.6%
sub-neg80.6%
associate-+l-80.6%
Applied egg-rr80.6%
Taylor expanded in x around 0 68.5%
distribute-lft-out--70.0%
Simplified70.0%
Final simplification65.1%
(FPCore (x y z t) :precision binary64 (if (or (<= y -8.2e-20) (not (<= y 1.25e-34))) (* y t) x))
double code(double x, double y, double z, double t) {
double tmp;
if ((y <= -8.2e-20) || !(y <= 1.25e-34)) {
tmp = y * t;
} 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 ((y <= (-8.2d-20)) .or. (.not. (y <= 1.25d-34))) then
tmp = y * t
else
tmp = x
end if
code = tmp
end function
public static double code(double x, double y, double z, double t) {
double tmp;
if ((y <= -8.2e-20) || !(y <= 1.25e-34)) {
tmp = y * t;
} else {
tmp = x;
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if (y <= -8.2e-20) or not (y <= 1.25e-34): tmp = y * t else: tmp = x return tmp
function code(x, y, z, t) tmp = 0.0 if ((y <= -8.2e-20) || !(y <= 1.25e-34)) tmp = Float64(y * t); else tmp = x; end return tmp end
function tmp_2 = code(x, y, z, t) tmp = 0.0; if ((y <= -8.2e-20) || ~((y <= 1.25e-34))) tmp = y * t; else tmp = x; end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[Or[LessEqual[y, -8.2e-20], N[Not[LessEqual[y, 1.25e-34]], $MachinePrecision]], N[(y * t), $MachinePrecision], x]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;y \leq -8.2 \cdot 10^{-20} \lor \neg \left(y \leq 1.25 \cdot 10^{-34}\right):\\
\;\;\;\;y \cdot t\\
\mathbf{else}:\\
\;\;\;\;x\\
\end{array}
\end{array}
if y < -8.2000000000000002e-20 or 1.2500000000000001e-34 < y Initial program 100.0%
Taylor expanded in t around inf 51.2%
Taylor expanded in y around 0 48.3%
associate-+r+48.3%
mul-1-neg48.3%
sub-neg48.3%
associate-+l-48.3%
Applied egg-rr48.3%
Taylor expanded in y around inf 36.9%
if -8.2000000000000002e-20 < y < 1.2500000000000001e-34Initial program 100.0%
Taylor expanded in t around inf 81.1%
Taylor expanded in x around inf 38.5%
Final simplification37.6%
(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 t around inf 64.6%
Taylor expanded in x around inf 19.7%
Final simplification19.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 2024039
(FPCore (x y z t)
:name "Data.Metrics.Snapshot:quantile from metrics-0.3.0.2"
:precision binary64
:herbie-target
(+ x (+ (* t (- y z)) (* (- x) (- y z))))
(+ x (* (- y z) (- t x))))