
(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 (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 (* y x))) (t_2 (* x (+ z 1.0))) (t_3 (* (- y z) t)))
(if (<= x -3.8e+137)
t_1
(if (<= x -8e+116)
t_3
(if (<= x -3.6e-16)
t_1
(if (<= x 3.6e-94)
t_3
(if (<= x 1.15e+42)
t_2
(if (<= x 8e+99) t_3 (if (<= x 9.5e+158) t_2 t_1)))))))))
double code(double x, double y, double z, double t) {
double t_1 = x - (y * x);
double t_2 = x * (z + 1.0);
double t_3 = (y - z) * t;
double tmp;
if (x <= -3.8e+137) {
tmp = t_1;
} else if (x <= -8e+116) {
tmp = t_3;
} else if (x <= -3.6e-16) {
tmp = t_1;
} else if (x <= 3.6e-94) {
tmp = t_3;
} else if (x <= 1.15e+42) {
tmp = t_2;
} else if (x <= 8e+99) {
tmp = t_3;
} else if (x <= 9.5e+158) {
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) :: t_3
real(8) :: tmp
t_1 = x - (y * x)
t_2 = x * (z + 1.0d0)
t_3 = (y - z) * t
if (x <= (-3.8d+137)) then
tmp = t_1
else if (x <= (-8d+116)) then
tmp = t_3
else if (x <= (-3.6d-16)) then
tmp = t_1
else if (x <= 3.6d-94) then
tmp = t_3
else if (x <= 1.15d+42) then
tmp = t_2
else if (x <= 8d+99) then
tmp = t_3
else if (x <= 9.5d+158) 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 = x - (y * x);
double t_2 = x * (z + 1.0);
double t_3 = (y - z) * t;
double tmp;
if (x <= -3.8e+137) {
tmp = t_1;
} else if (x <= -8e+116) {
tmp = t_3;
} else if (x <= -3.6e-16) {
tmp = t_1;
} else if (x <= 3.6e-94) {
tmp = t_3;
} else if (x <= 1.15e+42) {
tmp = t_2;
} else if (x <= 8e+99) {
tmp = t_3;
} else if (x <= 9.5e+158) {
tmp = t_2;
} else {
tmp = t_1;
}
return tmp;
}
def code(x, y, z, t): t_1 = x - (y * x) t_2 = x * (z + 1.0) t_3 = (y - z) * t tmp = 0 if x <= -3.8e+137: tmp = t_1 elif x <= -8e+116: tmp = t_3 elif x <= -3.6e-16: tmp = t_1 elif x <= 3.6e-94: tmp = t_3 elif x <= 1.15e+42: tmp = t_2 elif x <= 8e+99: tmp = t_3 elif x <= 9.5e+158: tmp = t_2 else: tmp = t_1 return tmp
function code(x, y, z, t) t_1 = Float64(x - Float64(y * x)) t_2 = Float64(x * Float64(z + 1.0)) t_3 = Float64(Float64(y - z) * t) tmp = 0.0 if (x <= -3.8e+137) tmp = t_1; elseif (x <= -8e+116) tmp = t_3; elseif (x <= -3.6e-16) tmp = t_1; elseif (x <= 3.6e-94) tmp = t_3; elseif (x <= 1.15e+42) tmp = t_2; elseif (x <= 8e+99) tmp = t_3; elseif (x <= 9.5e+158) tmp = t_2; else tmp = t_1; end return tmp end
function tmp_2 = code(x, y, z, t) t_1 = x - (y * x); t_2 = x * (z + 1.0); t_3 = (y - z) * t; tmp = 0.0; if (x <= -3.8e+137) tmp = t_1; elseif (x <= -8e+116) tmp = t_3; elseif (x <= -3.6e-16) tmp = t_1; elseif (x <= 3.6e-94) tmp = t_3; elseif (x <= 1.15e+42) tmp = t_2; elseif (x <= 8e+99) tmp = t_3; elseif (x <= 9.5e+158) tmp = t_2; else tmp = t_1; end tmp_2 = tmp; end
code[x_, y_, z_, t_] := Block[{t$95$1 = N[(x - N[(y * x), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$2 = N[(x * N[(z + 1.0), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$3 = N[(N[(y - z), $MachinePrecision] * t), $MachinePrecision]}, If[LessEqual[x, -3.8e+137], t$95$1, If[LessEqual[x, -8e+116], t$95$3, If[LessEqual[x, -3.6e-16], t$95$1, If[LessEqual[x, 3.6e-94], t$95$3, If[LessEqual[x, 1.15e+42], t$95$2, If[LessEqual[x, 8e+99], t$95$3, If[LessEqual[x, 9.5e+158], t$95$2, t$95$1]]]]]]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := x - y \cdot x\\
t_2 := x \cdot \left(z + 1\right)\\
t_3 := \left(y - z\right) \cdot t\\
\mathbf{if}\;x \leq -3.8 \cdot 10^{+137}:\\
\;\;\;\;t_1\\
\mathbf{elif}\;x \leq -8 \cdot 10^{+116}:\\
\;\;\;\;t_3\\
\mathbf{elif}\;x \leq -3.6 \cdot 10^{-16}:\\
\;\;\;\;t_1\\
\mathbf{elif}\;x \leq 3.6 \cdot 10^{-94}:\\
\;\;\;\;t_3\\
\mathbf{elif}\;x \leq 1.15 \cdot 10^{+42}:\\
\;\;\;\;t_2\\
\mathbf{elif}\;x \leq 8 \cdot 10^{+99}:\\
\;\;\;\;t_3\\
\mathbf{elif}\;x \leq 9.5 \cdot 10^{+158}:\\
\;\;\;\;t_2\\
\mathbf{else}:\\
\;\;\;\;t_1\\
\end{array}
\end{array}
if x < -3.79999999999999963e137 or -8.00000000000000012e116 < x < -3.59999999999999983e-16 or 9.49999999999999913e158 < x Initial program 100.0%
Taylor expanded in z around 0 71.6%
Taylor expanded in t around 0 66.8%
mul-1-neg66.8%
unsub-neg66.8%
*-commutative66.8%
Simplified66.8%
if -3.79999999999999963e137 < x < -8.00000000000000012e116 or -3.59999999999999983e-16 < x < 3.6e-94 or 1.15e42 < x < 7.9999999999999997e99Initial program 100.0%
Taylor expanded in t around inf 88.3%
Taylor expanded in y around 0 86.8%
Taylor expanded in t around inf 82.2%
neg-mul-182.2%
+-commutative82.2%
unsub-neg82.2%
Simplified82.2%
if 3.6e-94 < x < 1.15e42 or 7.9999999999999997e99 < x < 9.49999999999999913e158Initial program 100.0%
Taylor expanded in y around 0 78.4%
+-commutative78.4%
mul-1-neg78.4%
unsub-neg78.4%
*-commutative78.4%
Simplified78.4%
Taylor expanded in x around -inf 65.4%
Final simplification74.6%
(FPCore (x y z t)
:precision binary64
(let* ((t_1 (* z (- t))))
(if (<= y -7e-8)
(* y t)
(if (<= y -4e-51)
(* z x)
(if (<= y -6.2e-86)
t_1
(if (<= y 1.22e-303) x (if (<= y 1.5e-50) t_1 (* y t))))))))
double code(double x, double y, double z, double t) {
double t_1 = z * -t;
double tmp;
if (y <= -7e-8) {
tmp = y * t;
} else if (y <= -4e-51) {
tmp = z * x;
} else if (y <= -6.2e-86) {
tmp = t_1;
} else if (y <= 1.22e-303) {
tmp = x;
} else if (y <= 1.5e-50) {
tmp = t_1;
} else {
tmp = 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) :: t_1
real(8) :: tmp
t_1 = z * -t
if (y <= (-7d-8)) then
tmp = y * t
else if (y <= (-4d-51)) then
tmp = z * x
else if (y <= (-6.2d-86)) then
tmp = t_1
else if (y <= 1.22d-303) then
tmp = x
else if (y <= 1.5d-50) then
tmp = t_1
else
tmp = y * t
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 <= -7e-8) {
tmp = y * t;
} else if (y <= -4e-51) {
tmp = z * x;
} else if (y <= -6.2e-86) {
tmp = t_1;
} else if (y <= 1.22e-303) {
tmp = x;
} else if (y <= 1.5e-50) {
tmp = t_1;
} else {
tmp = y * t;
}
return tmp;
}
def code(x, y, z, t): t_1 = z * -t tmp = 0 if y <= -7e-8: tmp = y * t elif y <= -4e-51: tmp = z * x elif y <= -6.2e-86: tmp = t_1 elif y <= 1.22e-303: tmp = x elif y <= 1.5e-50: tmp = t_1 else: tmp = y * t return tmp
function code(x, y, z, t) t_1 = Float64(z * Float64(-t)) tmp = 0.0 if (y <= -7e-8) tmp = Float64(y * t); elseif (y <= -4e-51) tmp = Float64(z * x); elseif (y <= -6.2e-86) tmp = t_1; elseif (y <= 1.22e-303) tmp = x; elseif (y <= 1.5e-50) tmp = t_1; else tmp = Float64(y * t); end return tmp end
function tmp_2 = code(x, y, z, t) t_1 = z * -t; tmp = 0.0; if (y <= -7e-8) tmp = y * t; elseif (y <= -4e-51) tmp = z * x; elseif (y <= -6.2e-86) tmp = t_1; elseif (y <= 1.22e-303) tmp = x; elseif (y <= 1.5e-50) tmp = t_1; else tmp = y * t; end tmp_2 = tmp; end
code[x_, y_, z_, t_] := Block[{t$95$1 = N[(z * (-t)), $MachinePrecision]}, If[LessEqual[y, -7e-8], N[(y * t), $MachinePrecision], If[LessEqual[y, -4e-51], N[(z * x), $MachinePrecision], If[LessEqual[y, -6.2e-86], t$95$1, If[LessEqual[y, 1.22e-303], x, If[LessEqual[y, 1.5e-50], t$95$1, N[(y * t), $MachinePrecision]]]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := z \cdot \left(-t\right)\\
\mathbf{if}\;y \leq -7 \cdot 10^{-8}:\\
\;\;\;\;y \cdot t\\
\mathbf{elif}\;y \leq -4 \cdot 10^{-51}:\\
\;\;\;\;z \cdot x\\
\mathbf{elif}\;y \leq -6.2 \cdot 10^{-86}:\\
\;\;\;\;t_1\\
\mathbf{elif}\;y \leq 1.22 \cdot 10^{-303}:\\
\;\;\;\;x\\
\mathbf{elif}\;y \leq 1.5 \cdot 10^{-50}:\\
\;\;\;\;t_1\\
\mathbf{else}:\\
\;\;\;\;y \cdot t\\
\end{array}
\end{array}
if y < -7.00000000000000048e-8 or 1.49999999999999995e-50 < y Initial program 100.0%
Taylor expanded in t around inf 60.7%
Taylor expanded in z around 0 45.9%
Taylor expanded in y around inf 43.7%
if -7.00000000000000048e-8 < y < -4e-51Initial program 100.0%
Taylor expanded in y around 0 98.7%
+-commutative98.7%
mul-1-neg98.7%
unsub-neg98.7%
*-commutative98.7%
Simplified98.7%
Taylor expanded in x around -inf 78.1%
Taylor expanded in z around inf 58.1%
if -4e-51 < y < -6.19999999999999977e-86 or 1.2200000000000001e-303 < y < 1.49999999999999995e-50Initial program 100.0%
Taylor expanded in t around inf 75.4%
Taylor expanded in y around 0 75.4%
Taylor expanded in z around inf 52.8%
associate-*r*52.8%
neg-mul-152.8%
Simplified52.8%
if -6.19999999999999977e-86 < y < 1.2200000000000001e-303Initial program 100.0%
Taylor expanded in t around inf 80.6%
Taylor expanded in x around inf 49.0%
Final simplification47.4%
(FPCore (x y z t)
:precision binary64
(if (<= y -1.15e-9)
(* y t)
(if (<= y -1.42e-61)
(* z x)
(if (<= y -8e-84)
(* y t)
(if (<= y 1.55e-194) x (if (<= y 6.5e-77) (* z x) (* y t)))))))
double code(double x, double y, double z, double t) {
double tmp;
if (y <= -1.15e-9) {
tmp = y * t;
} else if (y <= -1.42e-61) {
tmp = z * x;
} else if (y <= -8e-84) {
tmp = y * t;
} else if (y <= 1.55e-194) {
tmp = x;
} else if (y <= 6.5e-77) {
tmp = z * x;
} else {
tmp = 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 (y <= (-1.15d-9)) then
tmp = y * t
else if (y <= (-1.42d-61)) then
tmp = z * x
else if (y <= (-8d-84)) then
tmp = y * t
else if (y <= 1.55d-194) then
tmp = x
else if (y <= 6.5d-77) then
tmp = z * x
else
tmp = y * t
end if
code = tmp
end function
public static double code(double x, double y, double z, double t) {
double tmp;
if (y <= -1.15e-9) {
tmp = y * t;
} else if (y <= -1.42e-61) {
tmp = z * x;
} else if (y <= -8e-84) {
tmp = y * t;
} else if (y <= 1.55e-194) {
tmp = x;
} else if (y <= 6.5e-77) {
tmp = z * x;
} else {
tmp = y * t;
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if y <= -1.15e-9: tmp = y * t elif y <= -1.42e-61: tmp = z * x elif y <= -8e-84: tmp = y * t elif y <= 1.55e-194: tmp = x elif y <= 6.5e-77: tmp = z * x else: tmp = y * t return tmp
function code(x, y, z, t) tmp = 0.0 if (y <= -1.15e-9) tmp = Float64(y * t); elseif (y <= -1.42e-61) tmp = Float64(z * x); elseif (y <= -8e-84) tmp = Float64(y * t); elseif (y <= 1.55e-194) tmp = x; elseif (y <= 6.5e-77) tmp = Float64(z * x); else tmp = Float64(y * t); end return tmp end
function tmp_2 = code(x, y, z, t) tmp = 0.0; if (y <= -1.15e-9) tmp = y * t; elseif (y <= -1.42e-61) tmp = z * x; elseif (y <= -8e-84) tmp = y * t; elseif (y <= 1.55e-194) tmp = x; elseif (y <= 6.5e-77) tmp = z * x; else tmp = y * t; end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[LessEqual[y, -1.15e-9], N[(y * t), $MachinePrecision], If[LessEqual[y, -1.42e-61], N[(z * x), $MachinePrecision], If[LessEqual[y, -8e-84], N[(y * t), $MachinePrecision], If[LessEqual[y, 1.55e-194], x, If[LessEqual[y, 6.5e-77], N[(z * x), $MachinePrecision], N[(y * t), $MachinePrecision]]]]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;y \leq -1.15 \cdot 10^{-9}:\\
\;\;\;\;y \cdot t\\
\mathbf{elif}\;y \leq -1.42 \cdot 10^{-61}:\\
\;\;\;\;z \cdot x\\
\mathbf{elif}\;y \leq -8 \cdot 10^{-84}:\\
\;\;\;\;y \cdot t\\
\mathbf{elif}\;y \leq 1.55 \cdot 10^{-194}:\\
\;\;\;\;x\\
\mathbf{elif}\;y \leq 6.5 \cdot 10^{-77}:\\
\;\;\;\;z \cdot x\\
\mathbf{else}:\\
\;\;\;\;y \cdot t\\
\end{array}
\end{array}
if y < -1.15e-9 or -1.42e-61 < y < -8.0000000000000003e-84 or 6.4999999999999999e-77 < y Initial program 100.0%
Taylor expanded in t around inf 62.1%
Taylor expanded in z around 0 45.1%
Taylor expanded in y around inf 43.1%
if -1.15e-9 < y < -1.42e-61 or 1.55000000000000005e-194 < y < 6.4999999999999999e-77Initial program 100.0%
Taylor expanded in y around 0 96.1%
+-commutative96.1%
mul-1-neg96.1%
unsub-neg96.1%
*-commutative96.1%
Simplified96.1%
Taylor expanded in x around -inf 52.5%
Taylor expanded in z around inf 42.1%
if -8.0000000000000003e-84 < y < 1.55000000000000005e-194Initial program 100.0%
Taylor expanded in t around inf 81.4%
Taylor expanded in x around inf 42.5%
Final simplification42.8%
(FPCore (x y z t)
:precision binary64
(let* ((t_1 (- x (* y x))))
(if (<= x -1.9e+138)
t_1
(if (<= x 2.4e+99)
(+ x (* (- y z) t))
(if (<= x 1.52e+158) (* x (+ z 1.0)) t_1)))))
double code(double x, double y, double z, double t) {
double t_1 = x - (y * x);
double tmp;
if (x <= -1.9e+138) {
tmp = t_1;
} else if (x <= 2.4e+99) {
tmp = x + ((y - z) * t);
} else if (x <= 1.52e+158) {
tmp = x * (z + 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 = x - (y * x)
if (x <= (-1.9d+138)) then
tmp = t_1
else if (x <= 2.4d+99) then
tmp = x + ((y - z) * t)
else if (x <= 1.52d+158) then
tmp = x * (z + 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 = x - (y * x);
double tmp;
if (x <= -1.9e+138) {
tmp = t_1;
} else if (x <= 2.4e+99) {
tmp = x + ((y - z) * t);
} else if (x <= 1.52e+158) {
tmp = x * (z + 1.0);
} else {
tmp = t_1;
}
return tmp;
}
def code(x, y, z, t): t_1 = x - (y * x) tmp = 0 if x <= -1.9e+138: tmp = t_1 elif x <= 2.4e+99: tmp = x + ((y - z) * t) elif x <= 1.52e+158: tmp = x * (z + 1.0) else: tmp = t_1 return tmp
function code(x, y, z, t) t_1 = Float64(x - Float64(y * x)) tmp = 0.0 if (x <= -1.9e+138) tmp = t_1; elseif (x <= 2.4e+99) tmp = Float64(x + Float64(Float64(y - z) * t)); elseif (x <= 1.52e+158) tmp = Float64(x * Float64(z + 1.0)); else tmp = t_1; end return tmp end
function tmp_2 = code(x, y, z, t) t_1 = x - (y * x); tmp = 0.0; if (x <= -1.9e+138) tmp = t_1; elseif (x <= 2.4e+99) tmp = x + ((y - z) * t); elseif (x <= 1.52e+158) tmp = x * (z + 1.0); else tmp = t_1; end tmp_2 = tmp; end
code[x_, y_, z_, t_] := Block[{t$95$1 = N[(x - N[(y * x), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[x, -1.9e+138], t$95$1, If[LessEqual[x, 2.4e+99], N[(x + N[(N[(y - z), $MachinePrecision] * t), $MachinePrecision]), $MachinePrecision], If[LessEqual[x, 1.52e+158], N[(x * N[(z + 1.0), $MachinePrecision]), $MachinePrecision], t$95$1]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := x - y \cdot x\\
\mathbf{if}\;x \leq -1.9 \cdot 10^{+138}:\\
\;\;\;\;t_1\\
\mathbf{elif}\;x \leq 2.4 \cdot 10^{+99}:\\
\;\;\;\;x + \left(y - z\right) \cdot t\\
\mathbf{elif}\;x \leq 1.52 \cdot 10^{+158}:\\
\;\;\;\;x \cdot \left(z + 1\right)\\
\mathbf{else}:\\
\;\;\;\;t_1\\
\end{array}
\end{array}
if x < -1.90000000000000006e138 or 1.52e158 < x Initial program 100.0%
Taylor expanded in z around 0 73.7%
Taylor expanded in t around 0 72.1%
mul-1-neg72.1%
unsub-neg72.1%
*-commutative72.1%
Simplified72.1%
if -1.90000000000000006e138 < x < 2.4000000000000001e99Initial program 100.0%
Taylor expanded in t around inf 81.1%
if 2.4000000000000001e99 < x < 1.52e158Initial program 100.0%
Taylor expanded in y around 0 77.3%
+-commutative77.3%
mul-1-neg77.3%
unsub-neg77.3%
*-commutative77.3%
Simplified77.3%
Taylor expanded in x around -inf 65.6%
Final simplification77.8%
(FPCore (x y z t) :precision binary64 (if (or (<= y -1.15e+206) (not (<= y 4e-17))) (+ x (* y (- t x))) (+ x (* (- y z) t))))
double code(double x, double y, double z, double t) {
double tmp;
if ((y <= -1.15e+206) || !(y <= 4e-17)) {
tmp = x + (y * (t - x));
} else {
tmp = x + ((y - z) * t);
}
return tmp;
}
real(8) function code(x, y, z, t)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
real(8) :: tmp
if ((y <= (-1.15d+206)) .or. (.not. (y <= 4d-17))) then
tmp = x + (y * (t - x))
else
tmp = x + ((y - z) * t)
end if
code = tmp
end function
public static double code(double x, double y, double z, double t) {
double tmp;
if ((y <= -1.15e+206) || !(y <= 4e-17)) {
tmp = x + (y * (t - x));
} else {
tmp = x + ((y - z) * t);
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if (y <= -1.15e+206) or not (y <= 4e-17): tmp = x + (y * (t - x)) else: tmp = x + ((y - z) * t) return tmp
function code(x, y, z, t) tmp = 0.0 if ((y <= -1.15e+206) || !(y <= 4e-17)) tmp = Float64(x + Float64(y * Float64(t - x))); else tmp = Float64(x + Float64(Float64(y - z) * t)); end return tmp end
function tmp_2 = code(x, y, z, t) tmp = 0.0; if ((y <= -1.15e+206) || ~((y <= 4e-17))) tmp = x + (y * (t - x)); else tmp = x + ((y - z) * t); end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[Or[LessEqual[y, -1.15e+206], N[Not[LessEqual[y, 4e-17]], $MachinePrecision]], N[(x + N[(y * N[(t - x), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(x + N[(N[(y - z), $MachinePrecision] * t), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;y \leq -1.15 \cdot 10^{+206} \lor \neg \left(y \leq 4 \cdot 10^{-17}\right):\\
\;\;\;\;x + y \cdot \left(t - x\right)\\
\mathbf{else}:\\
\;\;\;\;x + \left(y - z\right) \cdot t\\
\end{array}
\end{array}
if y < -1.15000000000000008e206 or 4.00000000000000029e-17 < y Initial program 100.0%
Taylor expanded in z around 0 83.1%
if -1.15000000000000008e206 < y < 4.00000000000000029e-17Initial program 100.0%
Taylor expanded in t around inf 77.5%
Final simplification79.4%
(FPCore (x y z t) :precision binary64 (if (or (<= z -200.0) (not (<= z 1.85e-13))) (- x (* z (- t x))) (+ x (* y (- t x)))))
double code(double x, double y, double z, double t) {
double tmp;
if ((z <= -200.0) || !(z <= 1.85e-13)) {
tmp = x - (z * (t - x));
} 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 <= (-200.0d0)) .or. (.not. (z <= 1.85d-13))) then
tmp = x - (z * (t - x))
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 <= -200.0) || !(z <= 1.85e-13)) {
tmp = x - (z * (t - x));
} else {
tmp = x + (y * (t - x));
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if (z <= -200.0) or not (z <= 1.85e-13): tmp = x - (z * (t - x)) else: tmp = x + (y * (t - x)) return tmp
function code(x, y, z, t) tmp = 0.0 if ((z <= -200.0) || !(z <= 1.85e-13)) tmp = Float64(x - Float64(z * Float64(t - x))); 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 <= -200.0) || ~((z <= 1.85e-13))) tmp = x - (z * (t - x)); else tmp = x + (y * (t - x)); end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[Or[LessEqual[z, -200.0], N[Not[LessEqual[z, 1.85e-13]], $MachinePrecision]], N[(x - N[(z * N[(t - x), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(x + N[(y * N[(t - x), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \leq -200 \lor \neg \left(z \leq 1.85 \cdot 10^{-13}\right):\\
\;\;\;\;x - z \cdot \left(t - x\right)\\
\mathbf{else}:\\
\;\;\;\;x + y \cdot \left(t - x\right)\\
\end{array}
\end{array}
if z < -200 or 1.84999999999999994e-13 < z Initial program 100.0%
Taylor expanded in y around 0 81.1%
+-commutative81.1%
mul-1-neg81.1%
unsub-neg81.1%
*-commutative81.1%
Simplified81.1%
if -200 < z < 1.84999999999999994e-13Initial program 100.0%
Taylor expanded in z around 0 93.0%
Final simplification86.8%
(FPCore (x y z t) :precision binary64 (if (or (<= t -1.5e-59) (not (<= t 2.4e-125))) (* (- y z) t) (* z x)))
double code(double x, double y, double z, double t) {
double tmp;
if ((t <= -1.5e-59) || !(t <= 2.4e-125)) {
tmp = (y - z) * t;
} else {
tmp = z * 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 <= (-1.5d-59)) .or. (.not. (t <= 2.4d-125))) then
tmp = (y - z) * t
else
tmp = z * x
end if
code = tmp
end function
public static double code(double x, double y, double z, double t) {
double tmp;
if ((t <= -1.5e-59) || !(t <= 2.4e-125)) {
tmp = (y - z) * t;
} else {
tmp = z * x;
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if (t <= -1.5e-59) or not (t <= 2.4e-125): tmp = (y - z) * t else: tmp = z * x return tmp
function code(x, y, z, t) tmp = 0.0 if ((t <= -1.5e-59) || !(t <= 2.4e-125)) tmp = Float64(Float64(y - z) * t); else tmp = Float64(z * x); end return tmp end
function tmp_2 = code(x, y, z, t) tmp = 0.0; if ((t <= -1.5e-59) || ~((t <= 2.4e-125))) tmp = (y - z) * t; else tmp = z * x; end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[Or[LessEqual[t, -1.5e-59], N[Not[LessEqual[t, 2.4e-125]], $MachinePrecision]], N[(N[(y - z), $MachinePrecision] * t), $MachinePrecision], N[(z * x), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;t \leq -1.5 \cdot 10^{-59} \lor \neg \left(t \leq 2.4 \cdot 10^{-125}\right):\\
\;\;\;\;\left(y - z\right) \cdot t\\
\mathbf{else}:\\
\;\;\;\;z \cdot x\\
\end{array}
\end{array}
if t < -1.5e-59 or 2.4000000000000001e-125 < t Initial program 100.0%
Taylor expanded in t around inf 83.9%
Taylor expanded in y around 0 80.4%
Taylor expanded in t around inf 72.3%
neg-mul-172.3%
+-commutative72.3%
unsub-neg72.3%
Simplified72.3%
if -1.5e-59 < t < 2.4000000000000001e-125Initial program 100.0%
Taylor expanded in y around 0 65.4%
+-commutative65.4%
mul-1-neg65.4%
unsub-neg65.4%
*-commutative65.4%
Simplified65.4%
Taylor expanded in x around -inf 58.6%
Taylor expanded in z around inf 38.0%
Final simplification60.9%
(FPCore (x y z t) :precision binary64 (if (or (<= t -2.8e-59) (not (<= t 1.8e-124))) (* (- y z) t) (* x (+ z 1.0))))
double code(double x, double y, double z, double t) {
double tmp;
if ((t <= -2.8e-59) || !(t <= 1.8e-124)) {
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.8d-59)) .or. (.not. (t <= 1.8d-124))) 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.8e-59) || !(t <= 1.8e-124)) {
tmp = (y - z) * t;
} else {
tmp = x * (z + 1.0);
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if (t <= -2.8e-59) or not (t <= 1.8e-124): tmp = (y - z) * t else: tmp = x * (z + 1.0) return tmp
function code(x, y, z, t) tmp = 0.0 if ((t <= -2.8e-59) || !(t <= 1.8e-124)) 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.8e-59) || ~((t <= 1.8e-124))) 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.8e-59], N[Not[LessEqual[t, 1.8e-124]], $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.8 \cdot 10^{-59} \lor \neg \left(t \leq 1.8 \cdot 10^{-124}\right):\\
\;\;\;\;\left(y - z\right) \cdot t\\
\mathbf{else}:\\
\;\;\;\;x \cdot \left(z + 1\right)\\
\end{array}
\end{array}
if t < -2.79999999999999981e-59 or 1.80000000000000005e-124 < t Initial program 100.0%
Taylor expanded in t around inf 83.9%
Taylor expanded in y around 0 80.4%
Taylor expanded in t around inf 72.3%
neg-mul-172.3%
+-commutative72.3%
unsub-neg72.3%
Simplified72.3%
if -2.79999999999999981e-59 < t < 1.80000000000000005e-124Initial program 100.0%
Taylor expanded in y around 0 65.4%
+-commutative65.4%
mul-1-neg65.4%
unsub-neg65.4%
*-commutative65.4%
Simplified65.4%
Taylor expanded in x around -inf 58.6%
Final simplification67.8%
(FPCore (x y z t) :precision binary64 (- x (* (- y z) (- x t))))
double code(double x, double y, double z, double t) {
return x - ((y - z) * (x - t));
}
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) * (x - t))
end function
public static double code(double x, double y, double z, double t) {
return x - ((y - z) * (x - t));
}
def code(x, y, z, t): return x - ((y - z) * (x - t))
function code(x, y, z, t) return Float64(x - Float64(Float64(y - z) * Float64(x - t))) end
function tmp = code(x, y, z, t) tmp = x - ((y - z) * (x - t)); end
code[x_, y_, z_, t_] := N[(x - N[(N[(y - z), $MachinePrecision] * N[(x - t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
x - \left(y - z\right) \cdot \left(x - t\right)
\end{array}
Initial program 100.0%
Final simplification100.0%
(FPCore (x y z t) :precision binary64 (if (<= y -1.1e-83) (* y t) (if (<= y 2.4e-102) x (* y t))))
double code(double x, double y, double z, double t) {
double tmp;
if (y <= -1.1e-83) {
tmp = y * t;
} else if (y <= 2.4e-102) {
tmp = x;
} else {
tmp = 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 (y <= (-1.1d-83)) then
tmp = y * t
else if (y <= 2.4d-102) then
tmp = x
else
tmp = y * t
end if
code = tmp
end function
public static double code(double x, double y, double z, double t) {
double tmp;
if (y <= -1.1e-83) {
tmp = y * t;
} else if (y <= 2.4e-102) {
tmp = x;
} else {
tmp = y * t;
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if y <= -1.1e-83: tmp = y * t elif y <= 2.4e-102: tmp = x else: tmp = y * t return tmp
function code(x, y, z, t) tmp = 0.0 if (y <= -1.1e-83) tmp = Float64(y * t); elseif (y <= 2.4e-102) tmp = x; else tmp = Float64(y * t); end return tmp end
function tmp_2 = code(x, y, z, t) tmp = 0.0; if (y <= -1.1e-83) tmp = y * t; elseif (y <= 2.4e-102) tmp = x; else tmp = y * t; end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[LessEqual[y, -1.1e-83], N[(y * t), $MachinePrecision], If[LessEqual[y, 2.4e-102], x, N[(y * t), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;y \leq -1.1 \cdot 10^{-83}:\\
\;\;\;\;y \cdot t\\
\mathbf{elif}\;y \leq 2.4 \cdot 10^{-102}:\\
\;\;\;\;x\\
\mathbf{else}:\\
\;\;\;\;y \cdot t\\
\end{array}
\end{array}
if y < -1.10000000000000004e-83 or 2.4e-102 < y Initial program 100.0%
Taylor expanded in t around inf 61.5%
Taylor expanded in z around 0 42.7%
Taylor expanded in y around inf 39.7%
if -1.10000000000000004e-83 < y < 2.4e-102Initial program 100.0%
Taylor expanded in t around inf 78.0%
Taylor expanded in x around inf 36.6%
Final simplification38.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 67.6%
Taylor expanded in x around inf 16.8%
Final simplification16.8%
(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 2023199
(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))))