
(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 13 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 (fma (- y z) (- t x) x))
double code(double x, double y, double z, double t) {
return fma((y - z), (t - x), x);
}
function code(x, y, z, t) return fma(Float64(y - z), Float64(t - x), x) end
code[x_, y_, z_, t_] := N[(N[(y - z), $MachinePrecision] * N[(t - x), $MachinePrecision] + x), $MachinePrecision]
\begin{array}{l}
\\
\mathsf{fma}\left(y - z, t - x, x\right)
\end{array}
Initial program 100.0%
+-commutative100.0%
fma-def100.0%
Simplified100.0%
Final simplification100.0%
(FPCore (x y z t)
:precision binary64
(let* ((t_1 (* x (+ z 1.0))) (t_2 (* y (- t x))) (t_3 (* (- y z) t)))
(if (<= y -19500.0)
t_2
(if (<= y -5e-40)
t_3
(if (<= y -1.55e-125)
t_1
(if (<= y -1.4e-134)
t_3
(if (<= y 3.15e-198)
t_1
(if (<= y 3.6e-81) t_3 (if (<= y 4.9e-54) t_1 t_2)))))))))
double code(double x, double y, double z, double t) {
double t_1 = x * (z + 1.0);
double t_2 = y * (t - x);
double t_3 = (y - z) * t;
double tmp;
if (y <= -19500.0) {
tmp = t_2;
} else if (y <= -5e-40) {
tmp = t_3;
} else if (y <= -1.55e-125) {
tmp = t_1;
} else if (y <= -1.4e-134) {
tmp = t_3;
} else if (y <= 3.15e-198) {
tmp = t_1;
} else if (y <= 3.6e-81) {
tmp = t_3;
} else if (y <= 4.9e-54) {
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 * (z + 1.0d0)
t_2 = y * (t - x)
t_3 = (y - z) * t
if (y <= (-19500.0d0)) then
tmp = t_2
else if (y <= (-5d-40)) then
tmp = t_3
else if (y <= (-1.55d-125)) then
tmp = t_1
else if (y <= (-1.4d-134)) then
tmp = t_3
else if (y <= 3.15d-198) then
tmp = t_1
else if (y <= 3.6d-81) then
tmp = t_3
else if (y <= 4.9d-54) 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 * (z + 1.0);
double t_2 = y * (t - x);
double t_3 = (y - z) * t;
double tmp;
if (y <= -19500.0) {
tmp = t_2;
} else if (y <= -5e-40) {
tmp = t_3;
} else if (y <= -1.55e-125) {
tmp = t_1;
} else if (y <= -1.4e-134) {
tmp = t_3;
} else if (y <= 3.15e-198) {
tmp = t_1;
} else if (y <= 3.6e-81) {
tmp = t_3;
} else if (y <= 4.9e-54) {
tmp = t_1;
} else {
tmp = t_2;
}
return tmp;
}
def code(x, y, z, t): t_1 = x * (z + 1.0) t_2 = y * (t - x) t_3 = (y - z) * t tmp = 0 if y <= -19500.0: tmp = t_2 elif y <= -5e-40: tmp = t_3 elif y <= -1.55e-125: tmp = t_1 elif y <= -1.4e-134: tmp = t_3 elif y <= 3.15e-198: tmp = t_1 elif y <= 3.6e-81: tmp = t_3 elif y <= 4.9e-54: tmp = t_1 else: tmp = t_2 return tmp
function code(x, y, z, t) t_1 = Float64(x * Float64(z + 1.0)) t_2 = Float64(y * Float64(t - x)) t_3 = Float64(Float64(y - z) * t) tmp = 0.0 if (y <= -19500.0) tmp = t_2; elseif (y <= -5e-40) tmp = t_3; elseif (y <= -1.55e-125) tmp = t_1; elseif (y <= -1.4e-134) tmp = t_3; elseif (y <= 3.15e-198) tmp = t_1; elseif (y <= 3.6e-81) tmp = t_3; elseif (y <= 4.9e-54) tmp = t_1; else tmp = t_2; end return tmp end
function tmp_2 = code(x, y, z, t) t_1 = x * (z + 1.0); t_2 = y * (t - x); t_3 = (y - z) * t; tmp = 0.0; if (y <= -19500.0) tmp = t_2; elseif (y <= -5e-40) tmp = t_3; elseif (y <= -1.55e-125) tmp = t_1; elseif (y <= -1.4e-134) tmp = t_3; elseif (y <= 3.15e-198) tmp = t_1; elseif (y <= 3.6e-81) tmp = t_3; elseif (y <= 4.9e-54) tmp = t_1; else tmp = t_2; end tmp_2 = tmp; end
code[x_, y_, z_, t_] := Block[{t$95$1 = N[(x * N[(z + 1.0), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$2 = N[(y * N[(t - x), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$3 = N[(N[(y - z), $MachinePrecision] * t), $MachinePrecision]}, If[LessEqual[y, -19500.0], t$95$2, If[LessEqual[y, -5e-40], t$95$3, If[LessEqual[y, -1.55e-125], t$95$1, If[LessEqual[y, -1.4e-134], t$95$3, If[LessEqual[y, 3.15e-198], t$95$1, If[LessEqual[y, 3.6e-81], t$95$3, If[LessEqual[y, 4.9e-54], t$95$1, t$95$2]]]]]]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := x \cdot \left(z + 1\right)\\
t_2 := y \cdot \left(t - x\right)\\
t_3 := \left(y - z\right) \cdot t\\
\mathbf{if}\;y \leq -19500:\\
\;\;\;\;t_2\\
\mathbf{elif}\;y \leq -5 \cdot 10^{-40}:\\
\;\;\;\;t_3\\
\mathbf{elif}\;y \leq -1.55 \cdot 10^{-125}:\\
\;\;\;\;t_1\\
\mathbf{elif}\;y \leq -1.4 \cdot 10^{-134}:\\
\;\;\;\;t_3\\
\mathbf{elif}\;y \leq 3.15 \cdot 10^{-198}:\\
\;\;\;\;t_1\\
\mathbf{elif}\;y \leq 3.6 \cdot 10^{-81}:\\
\;\;\;\;t_3\\
\mathbf{elif}\;y \leq 4.9 \cdot 10^{-54}:\\
\;\;\;\;t_1\\
\mathbf{else}:\\
\;\;\;\;t_2\\
\end{array}
\end{array}
if y < -19500 or 4.90000000000000021e-54 < y Initial program 100.0%
Taylor expanded in y around inf 81.0%
*-commutative81.0%
Simplified81.0%
Taylor expanded in x around -inf 75.1%
+-commutative75.1%
mul-1-neg75.1%
unsub-neg75.1%
*-commutative75.1%
sub-neg75.1%
metadata-eval75.1%
+-commutative75.1%
Simplified75.1%
Taylor expanded in y around inf 79.2%
if -19500 < y < -4.99999999999999965e-40 or -1.55000000000000006e-125 < y < -1.3999999999999999e-134 or 3.15000000000000008e-198 < y < 3.5999999999999999e-81Initial program 100.0%
*-commutative100.0%
sub-neg100.0%
distribute-lft-in100.0%
fma-def100.0%
Applied egg-rr100.0%
Taylor expanded in x around 0 83.5%
associate-+r+83.5%
mul-1-neg83.5%
*-commutative83.5%
sub-neg83.5%
associate-+l-83.5%
*-commutative83.5%
Applied egg-rr83.5%
Taylor expanded in x around 0 74.8%
distribute-lft-out--74.8%
Simplified74.8%
if -4.99999999999999965e-40 < y < -1.55000000000000006e-125 or -1.3999999999999999e-134 < y < 3.15000000000000008e-198 or 3.5999999999999999e-81 < y < 4.90000000000000021e-54Initial program 100.0%
Taylor expanded in x around inf 73.4%
mul-1-neg73.4%
unsub-neg73.4%
Simplified73.4%
Taylor expanded in y around 0 73.4%
+-commutative73.4%
Simplified73.4%
Final simplification76.8%
(FPCore (x y z t)
:precision binary64
(let* ((t_1 (* z (- t))))
(if (<= y -1.7e-12)
(* y t)
(if (<= y -1.4e-39)
t_1
(if (<= y -5.5e-53)
(* y t)
(if (<= y -1.2e-126)
x
(if (<= y 1.7e-80) t_1 (if (<= y 0.0018) x (* y (- x))))))))))
double code(double x, double y, double z, double t) {
double t_1 = z * -t;
double tmp;
if (y <= -1.7e-12) {
tmp = y * t;
} else if (y <= -1.4e-39) {
tmp = t_1;
} else if (y <= -5.5e-53) {
tmp = y * t;
} else if (y <= -1.2e-126) {
tmp = x;
} else if (y <= 1.7e-80) {
tmp = t_1;
} else if (y <= 0.0018) {
tmp = x;
} else {
tmp = y * -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) :: t_1
real(8) :: tmp
t_1 = z * -t
if (y <= (-1.7d-12)) then
tmp = y * t
else if (y <= (-1.4d-39)) then
tmp = t_1
else if (y <= (-5.5d-53)) then
tmp = y * t
else if (y <= (-1.2d-126)) then
tmp = x
else if (y <= 1.7d-80) then
tmp = t_1
else if (y <= 0.0018d0) then
tmp = x
else
tmp = y * -x
end if
code = tmp
end function
public static double code(double x, double y, double z, double t) {
double t_1 = z * -t;
double tmp;
if (y <= -1.7e-12) {
tmp = y * t;
} else if (y <= -1.4e-39) {
tmp = t_1;
} else if (y <= -5.5e-53) {
tmp = y * t;
} else if (y <= -1.2e-126) {
tmp = x;
} else if (y <= 1.7e-80) {
tmp = t_1;
} else if (y <= 0.0018) {
tmp = x;
} else {
tmp = y * -x;
}
return tmp;
}
def code(x, y, z, t): t_1 = z * -t tmp = 0 if y <= -1.7e-12: tmp = y * t elif y <= -1.4e-39: tmp = t_1 elif y <= -5.5e-53: tmp = y * t elif y <= -1.2e-126: tmp = x elif y <= 1.7e-80: tmp = t_1 elif y <= 0.0018: tmp = x else: tmp = y * -x return tmp
function code(x, y, z, t) t_1 = Float64(z * Float64(-t)) tmp = 0.0 if (y <= -1.7e-12) tmp = Float64(y * t); elseif (y <= -1.4e-39) tmp = t_1; elseif (y <= -5.5e-53) tmp = Float64(y * t); elseif (y <= -1.2e-126) tmp = x; elseif (y <= 1.7e-80) tmp = t_1; elseif (y <= 0.0018) tmp = x; else tmp = Float64(y * Float64(-x)); end return tmp end
function tmp_2 = code(x, y, z, t) t_1 = z * -t; tmp = 0.0; if (y <= -1.7e-12) tmp = y * t; elseif (y <= -1.4e-39) tmp = t_1; elseif (y <= -5.5e-53) tmp = y * t; elseif (y <= -1.2e-126) tmp = x; elseif (y <= 1.7e-80) tmp = t_1; elseif (y <= 0.0018) tmp = x; else tmp = y * -x; end tmp_2 = tmp; end
code[x_, y_, z_, t_] := Block[{t$95$1 = N[(z * (-t)), $MachinePrecision]}, If[LessEqual[y, -1.7e-12], N[(y * t), $MachinePrecision], If[LessEqual[y, -1.4e-39], t$95$1, If[LessEqual[y, -5.5e-53], N[(y * t), $MachinePrecision], If[LessEqual[y, -1.2e-126], x, If[LessEqual[y, 1.7e-80], t$95$1, If[LessEqual[y, 0.0018], x, N[(y * (-x)), $MachinePrecision]]]]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := z \cdot \left(-t\right)\\
\mathbf{if}\;y \leq -1.7 \cdot 10^{-12}:\\
\;\;\;\;y \cdot t\\
\mathbf{elif}\;y \leq -1.4 \cdot 10^{-39}:\\
\;\;\;\;t_1\\
\mathbf{elif}\;y \leq -5.5 \cdot 10^{-53}:\\
\;\;\;\;y \cdot t\\
\mathbf{elif}\;y \leq -1.2 \cdot 10^{-126}:\\
\;\;\;\;x\\
\mathbf{elif}\;y \leq 1.7 \cdot 10^{-80}:\\
\;\;\;\;t_1\\
\mathbf{elif}\;y \leq 0.0018:\\
\;\;\;\;x\\
\mathbf{else}:\\
\;\;\;\;y \cdot \left(-x\right)\\
\end{array}
\end{array}
if y < -1.7e-12 or -1.4000000000000001e-39 < y < -5.50000000000000023e-53Initial program 100.0%
*-commutative100.0%
sub-neg100.0%
distribute-lft-in89.7%
fma-def95.6%
Applied egg-rr95.6%
Taylor expanded in x around 0 50.4%
associate-+r+50.4%
mul-1-neg50.4%
*-commutative50.4%
sub-neg50.4%
associate-+l-50.4%
*-commutative50.4%
Applied egg-rr50.4%
Taylor expanded in y around inf 51.5%
if -1.7e-12 < y < -1.4000000000000001e-39 or -1.20000000000000003e-126 < y < 1.7e-80Initial program 100.0%
Taylor expanded in t around inf 80.1%
Taylor expanded in y around 0 76.9%
mul-1-neg76.9%
unsub-neg76.9%
*-commutative76.9%
Simplified76.9%
Taylor expanded in x around 0 51.1%
associate-*r*51.1%
neg-mul-151.1%
Simplified51.1%
if -5.50000000000000023e-53 < y < -1.20000000000000003e-126 or 1.7e-80 < y < 0.0018Initial program 99.9%
Taylor expanded in t around inf 78.6%
Taylor expanded in x around inf 47.3%
if 0.0018 < y Initial program 99.9%
Taylor expanded in x around inf 61.5%
mul-1-neg61.5%
unsub-neg61.5%
Simplified61.5%
Taylor expanded in y around inf 50.9%
mul-1-neg50.9%
distribute-lft-neg-out50.9%
*-commutative50.9%
Simplified50.9%
Final simplification50.7%
(FPCore (x y z t)
:precision binary64
(let* ((t_1 (* y (- t x))))
(if (<= y -1.9e-11)
t_1
(if (<= y 4.7e-79)
(- x (* z t))
(if (<= y 800000000.0)
(* x (+ z 1.0))
(if (<= y 4.8e+19) (* z (- t)) t_1))))))
double code(double x, double y, double z, double t) {
double t_1 = y * (t - x);
double tmp;
if (y <= -1.9e-11) {
tmp = t_1;
} else if (y <= 4.7e-79) {
tmp = x - (z * t);
} else if (y <= 800000000.0) {
tmp = x * (z + 1.0);
} else if (y <= 4.8e+19) {
tmp = 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 <= (-1.9d-11)) then
tmp = t_1
else if (y <= 4.7d-79) then
tmp = x - (z * t)
else if (y <= 800000000.0d0) then
tmp = x * (z + 1.0d0)
else if (y <= 4.8d+19) then
tmp = 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 <= -1.9e-11) {
tmp = t_1;
} else if (y <= 4.7e-79) {
tmp = x - (z * t);
} else if (y <= 800000000.0) {
tmp = x * (z + 1.0);
} else if (y <= 4.8e+19) {
tmp = z * -t;
} else {
tmp = t_1;
}
return tmp;
}
def code(x, y, z, t): t_1 = y * (t - x) tmp = 0 if y <= -1.9e-11: tmp = t_1 elif y <= 4.7e-79: tmp = x - (z * t) elif y <= 800000000.0: tmp = x * (z + 1.0) elif y <= 4.8e+19: tmp = 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 <= -1.9e-11) tmp = t_1; elseif (y <= 4.7e-79) tmp = Float64(x - Float64(z * t)); elseif (y <= 800000000.0) tmp = Float64(x * Float64(z + 1.0)); elseif (y <= 4.8e+19) tmp = Float64(z * Float64(-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.9e-11) tmp = t_1; elseif (y <= 4.7e-79) tmp = x - (z * t); elseif (y <= 800000000.0) tmp = x * (z + 1.0); elseif (y <= 4.8e+19) tmp = 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, -1.9e-11], t$95$1, If[LessEqual[y, 4.7e-79], N[(x - N[(z * t), $MachinePrecision]), $MachinePrecision], If[LessEqual[y, 800000000.0], N[(x * N[(z + 1.0), $MachinePrecision]), $MachinePrecision], If[LessEqual[y, 4.8e+19], N[(z * (-t)), $MachinePrecision], t$95$1]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := y \cdot \left(t - x\right)\\
\mathbf{if}\;y \leq -1.9 \cdot 10^{-11}:\\
\;\;\;\;t_1\\
\mathbf{elif}\;y \leq 4.7 \cdot 10^{-79}:\\
\;\;\;\;x - z \cdot t\\
\mathbf{elif}\;y \leq 800000000:\\
\;\;\;\;x \cdot \left(z + 1\right)\\
\mathbf{elif}\;y \leq 4.8 \cdot 10^{+19}:\\
\;\;\;\;z \cdot \left(-t\right)\\
\mathbf{else}:\\
\;\;\;\;t_1\\
\end{array}
\end{array}
if y < -1.8999999999999999e-11 or 4.8e19 < y Initial program 100.0%
Taylor expanded in y around inf 85.0%
*-commutative85.0%
Simplified85.0%
Taylor expanded in x around -inf 78.3%
+-commutative78.3%
mul-1-neg78.3%
unsub-neg78.3%
*-commutative78.3%
sub-neg78.3%
metadata-eval78.3%
+-commutative78.3%
Simplified78.3%
Taylor expanded in y around inf 85.0%
if -1.8999999999999999e-11 < y < 4.7000000000000002e-79Initial program 100.0%
Taylor expanded in t around inf 81.1%
Taylor expanded in y around 0 74.8%
mul-1-neg74.8%
unsub-neg74.8%
*-commutative74.8%
Simplified74.8%
if 4.7000000000000002e-79 < y < 8e8Initial program 99.9%
Taylor expanded in x around inf 67.8%
mul-1-neg67.8%
unsub-neg67.8%
Simplified67.8%
Taylor expanded in y around 0 65.6%
+-commutative65.6%
Simplified65.6%
if 8e8 < y < 4.8e19Initial program 100.0%
Taylor expanded in t around inf 75.7%
Taylor expanded in y around 0 75.7%
mul-1-neg75.7%
unsub-neg75.7%
*-commutative75.7%
Simplified75.7%
Taylor expanded in x around 0 76.1%
associate-*r*76.1%
neg-mul-176.1%
Simplified76.1%
Final simplification78.7%
(FPCore (x y z t)
:precision binary64
(let* ((t_1 (* y (- t x))))
(if (<= y -4.8e-12)
t_1
(if (<= y 2.9e-80)
(- x (* z t))
(if (<= y 9e+25) (* x (+ (- z y) 1.0)) t_1)))))
double code(double x, double y, double z, double t) {
double t_1 = y * (t - x);
double tmp;
if (y <= -4.8e-12) {
tmp = t_1;
} else if (y <= 2.9e-80) {
tmp = x - (z * t);
} else if (y <= 9e+25) {
tmp = x * ((z - y) + 1.0);
} 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 <= (-4.8d-12)) then
tmp = t_1
else if (y <= 2.9d-80) then
tmp = x - (z * t)
else if (y <= 9d+25) then
tmp = x * ((z - y) + 1.0d0)
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 <= -4.8e-12) {
tmp = t_1;
} else if (y <= 2.9e-80) {
tmp = x - (z * t);
} else if (y <= 9e+25) {
tmp = x * ((z - y) + 1.0);
} else {
tmp = t_1;
}
return tmp;
}
def code(x, y, z, t): t_1 = y * (t - x) tmp = 0 if y <= -4.8e-12: tmp = t_1 elif y <= 2.9e-80: tmp = x - (z * t) elif y <= 9e+25: tmp = x * ((z - y) + 1.0) else: tmp = t_1 return tmp
function code(x, y, z, t) t_1 = Float64(y * Float64(t - x)) tmp = 0.0 if (y <= -4.8e-12) tmp = t_1; elseif (y <= 2.9e-80) tmp = Float64(x - Float64(z * t)); elseif (y <= 9e+25) tmp = Float64(x * Float64(Float64(z - y) + 1.0)); 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 <= -4.8e-12) tmp = t_1; elseif (y <= 2.9e-80) tmp = x - (z * t); elseif (y <= 9e+25) tmp = x * ((z - y) + 1.0); 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, -4.8e-12], t$95$1, If[LessEqual[y, 2.9e-80], N[(x - N[(z * t), $MachinePrecision]), $MachinePrecision], If[LessEqual[y, 9e+25], N[(x * N[(N[(z - y), $MachinePrecision] + 1.0), $MachinePrecision]), $MachinePrecision], t$95$1]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := y \cdot \left(t - x\right)\\
\mathbf{if}\;y \leq -4.8 \cdot 10^{-12}:\\
\;\;\;\;t_1\\
\mathbf{elif}\;y \leq 2.9 \cdot 10^{-80}:\\
\;\;\;\;x - z \cdot t\\
\mathbf{elif}\;y \leq 9 \cdot 10^{+25}:\\
\;\;\;\;x \cdot \left(\left(z - y\right) + 1\right)\\
\mathbf{else}:\\
\;\;\;\;t_1\\
\end{array}
\end{array}
if y < -4.79999999999999974e-12 or 9.0000000000000006e25 < y Initial program 100.0%
Taylor expanded in y around inf 86.1%
*-commutative86.1%
Simplified86.1%
Taylor expanded in x around -inf 79.3%
+-commutative79.3%
mul-1-neg79.3%
unsub-neg79.3%
*-commutative79.3%
sub-neg79.3%
metadata-eval79.3%
+-commutative79.3%
Simplified79.3%
Taylor expanded in y around inf 86.1%
if -4.79999999999999974e-12 < y < 2.89999999999999998e-80Initial program 100.0%
Taylor expanded in t around inf 81.1%
Taylor expanded in y around 0 74.8%
mul-1-neg74.8%
unsub-neg74.8%
*-commutative74.8%
Simplified74.8%
if 2.89999999999999998e-80 < y < 9.0000000000000006e25Initial program 99.9%
Taylor expanded in x around inf 64.3%
mul-1-neg64.3%
unsub-neg64.3%
Simplified64.3%
Final simplification78.8%
(FPCore (x y z t) :precision binary64 (if (or (<= t -5.2e-131) (not (<= t 6.2e-142))) (- x (* t (- z y))) (* x (+ (- z y) 1.0))))
double code(double x, double y, double z, double t) {
double tmp;
if ((t <= -5.2e-131) || !(t <= 6.2e-142)) {
tmp = x - (t * (z - y));
} else {
tmp = x * ((z - y) + 1.0);
}
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 <= (-5.2d-131)) .or. (.not. (t <= 6.2d-142))) then
tmp = x - (t * (z - y))
else
tmp = x * ((z - y) + 1.0d0)
end if
code = tmp
end function
public static double code(double x, double y, double z, double t) {
double tmp;
if ((t <= -5.2e-131) || !(t <= 6.2e-142)) {
tmp = x - (t * (z - y));
} else {
tmp = x * ((z - y) + 1.0);
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if (t <= -5.2e-131) or not (t <= 6.2e-142): tmp = x - (t * (z - y)) else: tmp = x * ((z - y) + 1.0) return tmp
function code(x, y, z, t) tmp = 0.0 if ((t <= -5.2e-131) || !(t <= 6.2e-142)) tmp = Float64(x - Float64(t * Float64(z - y))); else tmp = Float64(x * Float64(Float64(z - y) + 1.0)); end return tmp end
function tmp_2 = code(x, y, z, t) tmp = 0.0; if ((t <= -5.2e-131) || ~((t <= 6.2e-142))) tmp = x - (t * (z - y)); else tmp = x * ((z - y) + 1.0); end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[Or[LessEqual[t, -5.2e-131], N[Not[LessEqual[t, 6.2e-142]], $MachinePrecision]], N[(x - N[(t * N[(z - y), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(x * N[(N[(z - y), $MachinePrecision] + 1.0), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;t \leq -5.2 \cdot 10^{-131} \lor \neg \left(t \leq 6.2 \cdot 10^{-142}\right):\\
\;\;\;\;x - t \cdot \left(z - y\right)\\
\mathbf{else}:\\
\;\;\;\;x \cdot \left(\left(z - y\right) + 1\right)\\
\end{array}
\end{array}
if t < -5.19999999999999993e-131 or 6.2e-142 < t Initial program 100.0%
Taylor expanded in t around inf 79.0%
if -5.19999999999999993e-131 < t < 6.2e-142Initial program 99.9%
Taylor expanded in x around inf 93.9%
mul-1-neg93.9%
unsub-neg93.9%
Simplified93.9%
Final simplification83.7%
(FPCore (x y z t) :precision binary64 (if (or (<= t -2.5e-156) (not (<= t 2.95e-195))) (* (- y z) t) (* y (- x))))
double code(double x, double y, double z, double t) {
double tmp;
if ((t <= -2.5e-156) || !(t <= 2.95e-195)) {
tmp = (y - z) * t;
} else {
tmp = y * -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 ((t <= (-2.5d-156)) .or. (.not. (t <= 2.95d-195))) then
tmp = (y - z) * t
else
tmp = y * -x
end if
code = tmp
end function
public static double code(double x, double y, double z, double t) {
double tmp;
if ((t <= -2.5e-156) || !(t <= 2.95e-195)) {
tmp = (y - z) * t;
} else {
tmp = y * -x;
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if (t <= -2.5e-156) or not (t <= 2.95e-195): tmp = (y - z) * t else: tmp = y * -x return tmp
function code(x, y, z, t) tmp = 0.0 if ((t <= -2.5e-156) || !(t <= 2.95e-195)) tmp = Float64(Float64(y - z) * t); else tmp = Float64(y * Float64(-x)); end return tmp end
function tmp_2 = code(x, y, z, t) tmp = 0.0; if ((t <= -2.5e-156) || ~((t <= 2.95e-195))) tmp = (y - z) * t; else tmp = y * -x; end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[Or[LessEqual[t, -2.5e-156], N[Not[LessEqual[t, 2.95e-195]], $MachinePrecision]], N[(N[(y - z), $MachinePrecision] * t), $MachinePrecision], N[(y * (-x)), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;t \leq -2.5 \cdot 10^{-156} \lor \neg \left(t \leq 2.95 \cdot 10^{-195}\right):\\
\;\;\;\;\left(y - z\right) \cdot t\\
\mathbf{else}:\\
\;\;\;\;y \cdot \left(-x\right)\\
\end{array}
\end{array}
if t < -2.50000000000000004e-156 or 2.95000000000000003e-195 < t Initial program 100.0%
*-commutative100.0%
sub-neg100.0%
distribute-lft-in95.7%
fma-def97.9%
Applied egg-rr97.9%
Taylor expanded in x around 0 75.4%
associate-+r+75.4%
mul-1-neg75.4%
*-commutative75.4%
sub-neg75.4%
associate-+l-75.4%
*-commutative75.4%
Applied egg-rr75.4%
Taylor expanded in x around 0 62.4%
distribute-lft-out--65.0%
Simplified65.0%
if -2.50000000000000004e-156 < t < 2.95000000000000003e-195Initial program 99.9%
Taylor expanded in x around inf 97.0%
mul-1-neg97.0%
unsub-neg97.0%
Simplified97.0%
Taylor expanded in y around inf 49.3%
mul-1-neg49.3%
distribute-lft-neg-out49.3%
*-commutative49.3%
Simplified49.3%
Final simplification60.8%
(FPCore (x y z t) :precision binary64 (if (or (<= t -2.35e-119) (not (<= t 4.6e-142))) (* (- y z) t) (* x (+ z 1.0))))
double code(double x, double y, double z, double t) {
double tmp;
if ((t <= -2.35e-119) || !(t <= 4.6e-142)) {
tmp = (y - z) * t;
} else {
tmp = x * (z + 1.0);
}
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.35d-119)) .or. (.not. (t <= 4.6d-142))) then
tmp = (y - z) * t
else
tmp = x * (z + 1.0d0)
end if
code = tmp
end function
public static double code(double x, double y, double z, double t) {
double tmp;
if ((t <= -2.35e-119) || !(t <= 4.6e-142)) {
tmp = (y - z) * t;
} else {
tmp = x * (z + 1.0);
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if (t <= -2.35e-119) or not (t <= 4.6e-142): tmp = (y - z) * t else: tmp = x * (z + 1.0) return tmp
function code(x, y, z, t) tmp = 0.0 if ((t <= -2.35e-119) || !(t <= 4.6e-142)) tmp = Float64(Float64(y - z) * t); else tmp = Float64(x * Float64(z + 1.0)); end return tmp end
function tmp_2 = code(x, y, z, t) tmp = 0.0; if ((t <= -2.35e-119) || ~((t <= 4.6e-142))) tmp = (y - z) * t; else tmp = x * (z + 1.0); end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[Or[LessEqual[t, -2.35e-119], N[Not[LessEqual[t, 4.6e-142]], $MachinePrecision]], N[(N[(y - z), $MachinePrecision] * t), $MachinePrecision], N[(x * N[(z + 1.0), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;t \leq -2.35 \cdot 10^{-119} \lor \neg \left(t \leq 4.6 \cdot 10^{-142}\right):\\
\;\;\;\;\left(y - z\right) \cdot t\\
\mathbf{else}:\\
\;\;\;\;x \cdot \left(z + 1\right)\\
\end{array}
\end{array}
if t < -2.35000000000000001e-119 or 4.60000000000000005e-142 < t Initial program 100.0%
*-commutative100.0%
sub-neg100.0%
distribute-lft-in95.3%
fma-def97.7%
Applied egg-rr97.7%
Taylor expanded in x around 0 76.3%
associate-+r+76.3%
mul-1-neg76.3%
*-commutative76.3%
sub-neg76.3%
associate-+l-76.3%
*-commutative76.3%
Applied egg-rr76.3%
Taylor expanded in x around 0 65.7%
distribute-lft-out--68.6%
Simplified68.6%
if -2.35000000000000001e-119 < t < 4.60000000000000005e-142Initial program 99.9%
Taylor expanded in x around inf 93.0%
mul-1-neg93.0%
unsub-neg93.0%
Simplified93.0%
Taylor expanded in y around 0 55.1%
+-commutative55.1%
Simplified55.1%
Final simplification64.2%
(FPCore (x y z t) :precision binary64 (if (or (<= t -6.2e-150) (not (<= t 9.6e-127))) (* (- y z) t) (* x (- 1.0 y))))
double code(double x, double y, double z, double t) {
double tmp;
if ((t <= -6.2e-150) || !(t <= 9.6e-127)) {
tmp = (y - z) * t;
} else {
tmp = x * (1.0 - 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 <= (-6.2d-150)) .or. (.not. (t <= 9.6d-127))) then
tmp = (y - z) * t
else
tmp = x * (1.0d0 - y)
end if
code = tmp
end function
public static double code(double x, double y, double z, double t) {
double tmp;
if ((t <= -6.2e-150) || !(t <= 9.6e-127)) {
tmp = (y - z) * t;
} else {
tmp = x * (1.0 - y);
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if (t <= -6.2e-150) or not (t <= 9.6e-127): tmp = (y - z) * t else: tmp = x * (1.0 - y) return tmp
function code(x, y, z, t) tmp = 0.0 if ((t <= -6.2e-150) || !(t <= 9.6e-127)) tmp = Float64(Float64(y - z) * t); else tmp = Float64(x * Float64(1.0 - y)); end return tmp end
function tmp_2 = code(x, y, z, t) tmp = 0.0; if ((t <= -6.2e-150) || ~((t <= 9.6e-127))) tmp = (y - z) * t; else tmp = x * (1.0 - y); end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[Or[LessEqual[t, -6.2e-150], N[Not[LessEqual[t, 9.6e-127]], $MachinePrecision]], N[(N[(y - z), $MachinePrecision] * t), $MachinePrecision], N[(x * N[(1.0 - y), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;t \leq -6.2 \cdot 10^{-150} \lor \neg \left(t \leq 9.6 \cdot 10^{-127}\right):\\
\;\;\;\;\left(y - z\right) \cdot t\\
\mathbf{else}:\\
\;\;\;\;x \cdot \left(1 - y\right)\\
\end{array}
\end{array}
if t < -6.19999999999999996e-150 or 9.59999999999999929e-127 < t Initial program 100.0%
*-commutative100.0%
sub-neg100.0%
distribute-lft-in95.4%
fma-def97.7%
Applied egg-rr97.7%
Taylor expanded in x around 0 76.1%
associate-+r+76.1%
mul-1-neg76.1%
*-commutative76.1%
sub-neg76.1%
associate-+l-76.1%
*-commutative76.1%
Applied egg-rr76.1%
Taylor expanded in x around 0 65.1%
distribute-lft-out--67.9%
Simplified67.9%
if -6.19999999999999996e-150 < t < 9.59999999999999929e-127Initial program 99.9%
Taylor expanded in x around inf 93.9%
mul-1-neg93.9%
unsub-neg93.9%
Simplified93.9%
Taylor expanded in z around 0 68.5%
Final simplification68.1%
(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 (if (<= y -1.3e-40) (* y t) (if (<= y 0.0017) x (* y (- x)))))
double code(double x, double y, double z, double t) {
double tmp;
if (y <= -1.3e-40) {
tmp = y * t;
} else if (y <= 0.0017) {
tmp = x;
} else {
tmp = y * -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 <= (-1.3d-40)) then
tmp = y * t
else if (y <= 0.0017d0) then
tmp = x
else
tmp = y * -x
end if
code = tmp
end function
public static double code(double x, double y, double z, double t) {
double tmp;
if (y <= -1.3e-40) {
tmp = y * t;
} else if (y <= 0.0017) {
tmp = x;
} else {
tmp = y * -x;
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if y <= -1.3e-40: tmp = y * t elif y <= 0.0017: tmp = x else: tmp = y * -x return tmp
function code(x, y, z, t) tmp = 0.0 if (y <= -1.3e-40) tmp = Float64(y * t); elseif (y <= 0.0017) tmp = x; else tmp = Float64(y * Float64(-x)); end return tmp end
function tmp_2 = code(x, y, z, t) tmp = 0.0; if (y <= -1.3e-40) tmp = y * t; elseif (y <= 0.0017) tmp = x; else tmp = y * -x; end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[LessEqual[y, -1.3e-40], N[(y * t), $MachinePrecision], If[LessEqual[y, 0.0017], x, N[(y * (-x)), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;y \leq -1.3 \cdot 10^{-40}:\\
\;\;\;\;y \cdot t\\
\mathbf{elif}\;y \leq 0.0017:\\
\;\;\;\;x\\
\mathbf{else}:\\
\;\;\;\;y \cdot \left(-x\right)\\
\end{array}
\end{array}
if y < -1.3000000000000001e-40Initial program 100.0%
*-commutative100.0%
sub-neg100.0%
distribute-lft-in90.8%
fma-def96.1%
Applied egg-rr96.1%
Taylor expanded in x around 0 54.3%
associate-+r+54.3%
mul-1-neg54.3%
*-commutative54.3%
sub-neg54.3%
associate-+l-54.3%
*-commutative54.3%
Applied egg-rr54.3%
Taylor expanded in y around inf 47.7%
if -1.3000000000000001e-40 < y < 0.00169999999999999991Initial program 100.0%
Taylor expanded in t around inf 79.1%
Taylor expanded in x around inf 35.7%
if 0.00169999999999999991 < y Initial program 99.9%
Taylor expanded in x around inf 61.5%
mul-1-neg61.5%
unsub-neg61.5%
Simplified61.5%
Taylor expanded in y around inf 50.9%
mul-1-neg50.9%
distribute-lft-neg-out50.9%
*-commutative50.9%
Simplified50.9%
Final simplification42.9%
(FPCore (x y z t) :precision binary64 (if (or (<= y -1.15e-48) (not (<= y 4.7e-55))) (* y t) x))
double code(double x, double y, double z, double t) {
double tmp;
if ((y <= -1.15e-48) || !(y <= 4.7e-55)) {
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 <= (-1.15d-48)) .or. (.not. (y <= 4.7d-55))) 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 <= -1.15e-48) || !(y <= 4.7e-55)) {
tmp = y * t;
} else {
tmp = x;
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if (y <= -1.15e-48) or not (y <= 4.7e-55): tmp = y * t else: tmp = x return tmp
function code(x, y, z, t) tmp = 0.0 if ((y <= -1.15e-48) || !(y <= 4.7e-55)) tmp = Float64(y * t); else tmp = x; end return tmp end
function tmp_2 = code(x, y, z, t) tmp = 0.0; if ((y <= -1.15e-48) || ~((y <= 4.7e-55))) tmp = y * t; else tmp = x; end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[Or[LessEqual[y, -1.15e-48], N[Not[LessEqual[y, 4.7e-55]], $MachinePrecision]], N[(y * t), $MachinePrecision], x]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;y \leq -1.15 \cdot 10^{-48} \lor \neg \left(y \leq 4.7 \cdot 10^{-55}\right):\\
\;\;\;\;y \cdot t\\
\mathbf{else}:\\
\;\;\;\;x\\
\end{array}
\end{array}
if y < -1.15e-48 or 4.7e-55 < y Initial program 100.0%
*-commutative100.0%
sub-neg100.0%
distribute-lft-in93.8%
fma-def96.6%
Applied egg-rr96.6%
Taylor expanded in x around 0 50.7%
associate-+r+50.7%
mul-1-neg50.7%
*-commutative50.7%
sub-neg50.7%
associate-+l-50.7%
*-commutative50.7%
Applied egg-rr50.7%
Taylor expanded in y around inf 41.8%
if -1.15e-48 < y < 4.7e-55Initial program 100.0%
Taylor expanded in t around inf 78.8%
Taylor expanded in x around inf 37.1%
Final simplification39.8%
(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.7%
Taylor expanded in x around inf 18.0%
Final simplification18.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 2023320
(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))))