
(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 (* (- t x) (- y z))))
double code(double x, double y, double z, double t) {
return x + ((t - 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 - x) * (y - z))
end function
public static double code(double x, double y, double z, double t) {
return x + ((t - x) * (y - z));
}
def code(x, y, z, t): return x + ((t - x) * (y - z))
function code(x, y, z, t) return Float64(x + Float64(Float64(t - x) * Float64(y - z))) end
function tmp = code(x, y, z, t) tmp = x + ((t - x) * (y - z)); end
code[x_, y_, z_, t_] := N[(x + N[(N[(t - x), $MachinePrecision] * N[(y - z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
x + \left(t - x\right) \cdot \left(y - z\right)
\end{array}
Initial program 100.0%
Final simplification100.0%
(FPCore (x y z t)
:precision binary64
(if (<= y -1.65e-15)
(* y t)
(if (<= y 5.4e-185)
(* t (- z))
(if (<= y 1.15e+22) (* x z) (if (<= y 1.3e+184) (* y t) (* x (- y)))))))
double code(double x, double y, double z, double t) {
double tmp;
if (y <= -1.65e-15) {
tmp = y * t;
} else if (y <= 5.4e-185) {
tmp = t * -z;
} else if (y <= 1.15e+22) {
tmp = x * z;
} else if (y <= 1.3e+184) {
tmp = y * t;
} 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) :: tmp
if (y <= (-1.65d-15)) then
tmp = y * t
else if (y <= 5.4d-185) then
tmp = t * -z
else if (y <= 1.15d+22) then
tmp = x * z
else if (y <= 1.3d+184) then
tmp = y * t
else
tmp = x * -y
end if
code = tmp
end function
public static double code(double x, double y, double z, double t) {
double tmp;
if (y <= -1.65e-15) {
tmp = y * t;
} else if (y <= 5.4e-185) {
tmp = t * -z;
} else if (y <= 1.15e+22) {
tmp = x * z;
} else if (y <= 1.3e+184) {
tmp = y * t;
} else {
tmp = x * -y;
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if y <= -1.65e-15: tmp = y * t elif y <= 5.4e-185: tmp = t * -z elif y <= 1.15e+22: tmp = x * z elif y <= 1.3e+184: tmp = y * t else: tmp = x * -y return tmp
function code(x, y, z, t) tmp = 0.0 if (y <= -1.65e-15) tmp = Float64(y * t); elseif (y <= 5.4e-185) tmp = Float64(t * Float64(-z)); elseif (y <= 1.15e+22) tmp = Float64(x * z); elseif (y <= 1.3e+184) tmp = Float64(y * t); else tmp = Float64(x * Float64(-y)); end return tmp end
function tmp_2 = code(x, y, z, t) tmp = 0.0; if (y <= -1.65e-15) tmp = y * t; elseif (y <= 5.4e-185) tmp = t * -z; elseif (y <= 1.15e+22) tmp = x * z; elseif (y <= 1.3e+184) tmp = y * t; else tmp = x * -y; end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[LessEqual[y, -1.65e-15], N[(y * t), $MachinePrecision], If[LessEqual[y, 5.4e-185], N[(t * (-z)), $MachinePrecision], If[LessEqual[y, 1.15e+22], N[(x * z), $MachinePrecision], If[LessEqual[y, 1.3e+184], N[(y * t), $MachinePrecision], N[(x * (-y)), $MachinePrecision]]]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;y \leq -1.65 \cdot 10^{-15}:\\
\;\;\;\;y \cdot t\\
\mathbf{elif}\;y \leq 5.4 \cdot 10^{-185}:\\
\;\;\;\;t \cdot \left(-z\right)\\
\mathbf{elif}\;y \leq 1.15 \cdot 10^{+22}:\\
\;\;\;\;x \cdot z\\
\mathbf{elif}\;y \leq 1.3 \cdot 10^{+184}:\\
\;\;\;\;y \cdot t\\
\mathbf{else}:\\
\;\;\;\;x \cdot \left(-y\right)\\
\end{array}
\end{array}
if y < -1.65e-15 or 1.1500000000000001e22 < y < 1.29999999999999997e184Initial program 99.9%
Taylor expanded in y around inf 84.4%
*-commutative84.4%
Simplified84.4%
Taylor expanded in x around 0 81.7%
Taylor expanded in y around inf 84.4%
mul-1-neg84.4%
unsub-neg84.4%
Simplified84.4%
Taylor expanded in t around inf 53.4%
if -1.65e-15 < y < 5.39999999999999976e-185Initial program 100.0%
Taylor expanded in y around 0 92.6%
mul-1-neg92.6%
unsub-neg92.6%
Simplified92.6%
Taylor expanded in t around inf 77.9%
Taylor expanded in x around 0 45.8%
mul-1-neg45.8%
*-commutative45.8%
distribute-rgt-neg-in45.8%
Simplified45.8%
if 5.39999999999999976e-185 < y < 1.1500000000000001e22Initial program 100.0%
Taylor expanded in t around 0 63.5%
mul-1-neg63.5%
distribute-rgt-neg-in63.5%
sub-neg63.5%
+-commutative63.5%
distribute-neg-in63.5%
remove-double-neg63.5%
sub-neg63.5%
Simplified63.5%
Taylor expanded in z around inf 63.5%
Taylor expanded in z around inf 42.5%
if 1.29999999999999997e184 < y Initial program 99.8%
Taylor expanded in y around inf 93.0%
*-commutative93.0%
Simplified93.0%
Taylor expanded in x around 0 85.7%
Taylor expanded in y around inf 93.0%
mul-1-neg93.0%
unsub-neg93.0%
Simplified93.0%
Taylor expanded in t around 0 53.1%
neg-mul-153.1%
Simplified53.1%
Final simplification49.2%
(FPCore (x y z t)
:precision binary64
(if (<= y -1.52e-49)
(* y t)
(if (<= y 9e-61)
x
(if (<= y 8.4e+21) (* x z) (if (<= y 1.12e+179) (* y t) (* x (- y)))))))
double code(double x, double y, double z, double t) {
double tmp;
if (y <= -1.52e-49) {
tmp = y * t;
} else if (y <= 9e-61) {
tmp = x;
} else if (y <= 8.4e+21) {
tmp = x * z;
} else if (y <= 1.12e+179) {
tmp = y * t;
} 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) :: tmp
if (y <= (-1.52d-49)) then
tmp = y * t
else if (y <= 9d-61) then
tmp = x
else if (y <= 8.4d+21) then
tmp = x * z
else if (y <= 1.12d+179) then
tmp = y * t
else
tmp = x * -y
end if
code = tmp
end function
public static double code(double x, double y, double z, double t) {
double tmp;
if (y <= -1.52e-49) {
tmp = y * t;
} else if (y <= 9e-61) {
tmp = x;
} else if (y <= 8.4e+21) {
tmp = x * z;
} else if (y <= 1.12e+179) {
tmp = y * t;
} else {
tmp = x * -y;
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if y <= -1.52e-49: tmp = y * t elif y <= 9e-61: tmp = x elif y <= 8.4e+21: tmp = x * z elif y <= 1.12e+179: tmp = y * t else: tmp = x * -y return tmp
function code(x, y, z, t) tmp = 0.0 if (y <= -1.52e-49) tmp = Float64(y * t); elseif (y <= 9e-61) tmp = x; elseif (y <= 8.4e+21) tmp = Float64(x * z); elseif (y <= 1.12e+179) tmp = Float64(y * t); else tmp = Float64(x * Float64(-y)); end return tmp end
function tmp_2 = code(x, y, z, t) tmp = 0.0; if (y <= -1.52e-49) tmp = y * t; elseif (y <= 9e-61) tmp = x; elseif (y <= 8.4e+21) tmp = x * z; elseif (y <= 1.12e+179) tmp = y * t; else tmp = x * -y; end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[LessEqual[y, -1.52e-49], N[(y * t), $MachinePrecision], If[LessEqual[y, 9e-61], x, If[LessEqual[y, 8.4e+21], N[(x * z), $MachinePrecision], If[LessEqual[y, 1.12e+179], N[(y * t), $MachinePrecision], N[(x * (-y)), $MachinePrecision]]]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;y \leq -1.52 \cdot 10^{-49}:\\
\;\;\;\;y \cdot t\\
\mathbf{elif}\;y \leq 9 \cdot 10^{-61}:\\
\;\;\;\;x\\
\mathbf{elif}\;y \leq 8.4 \cdot 10^{+21}:\\
\;\;\;\;x \cdot z\\
\mathbf{elif}\;y \leq 1.12 \cdot 10^{+179}:\\
\;\;\;\;y \cdot t\\
\mathbf{else}:\\
\;\;\;\;x \cdot \left(-y\right)\\
\end{array}
\end{array}
if y < -1.52e-49 or 8.4e21 < y < 1.11999999999999997e179Initial program 99.9%
Taylor expanded in y around inf 80.3%
*-commutative80.3%
Simplified80.3%
Taylor expanded in x around 0 77.8%
Taylor expanded in y around inf 79.5%
mul-1-neg79.5%
unsub-neg79.5%
Simplified79.5%
Taylor expanded in t around inf 51.0%
if -1.52e-49 < y < 9e-61Initial program 100.0%
Taylor expanded in y around inf 42.9%
*-commutative42.9%
Simplified42.9%
Taylor expanded in y around 0 37.3%
if 9e-61 < y < 8.4e21Initial program 100.0%
Taylor expanded in t around 0 58.8%
mul-1-neg58.8%
distribute-rgt-neg-in58.8%
sub-neg58.8%
+-commutative58.8%
distribute-neg-in58.8%
remove-double-neg58.8%
sub-neg58.8%
Simplified58.8%
Taylor expanded in z around inf 58.8%
Taylor expanded in z around inf 55.0%
if 1.11999999999999997e179 < y Initial program 99.8%
Taylor expanded in y around inf 93.0%
*-commutative93.0%
Simplified93.0%
Taylor expanded in x around 0 85.7%
Taylor expanded in y around inf 93.0%
mul-1-neg93.0%
unsub-neg93.0%
Simplified93.0%
Taylor expanded in t around 0 53.1%
neg-mul-153.1%
Simplified53.1%
Final simplification46.7%
(FPCore (x y z t)
:precision binary64
(let* ((t_1 (* y (- t x))))
(if (<= y -4e-11)
t_1
(if (<= y 4e-186) (- x (* z t)) (if (<= y 8.4e+21) (+ x (* x z)) t_1)))))
double code(double x, double y, double z, double t) {
double t_1 = y * (t - x);
double tmp;
if (y <= -4e-11) {
tmp = t_1;
} else if (y <= 4e-186) {
tmp = x - (z * t);
} else if (y <= 8.4e+21) {
tmp = x + (x * z);
} else {
tmp = t_1;
}
return tmp;
}
real(8) function code(x, y, z, t)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
real(8) :: t_1
real(8) :: tmp
t_1 = y * (t - x)
if (y <= (-4d-11)) then
tmp = t_1
else if (y <= 4d-186) then
tmp = x - (z * t)
else if (y <= 8.4d+21) then
tmp = x + (x * z)
else
tmp = t_1
end if
code = tmp
end function
public static double code(double x, double y, double z, double t) {
double t_1 = y * (t - x);
double tmp;
if (y <= -4e-11) {
tmp = t_1;
} else if (y <= 4e-186) {
tmp = x - (z * t);
} else if (y <= 8.4e+21) {
tmp = x + (x * z);
} else {
tmp = t_1;
}
return tmp;
}
def code(x, y, z, t): t_1 = y * (t - x) tmp = 0 if y <= -4e-11: tmp = t_1 elif y <= 4e-186: tmp = x - (z * t) elif y <= 8.4e+21: tmp = x + (x * z) else: tmp = t_1 return tmp
function code(x, y, z, t) t_1 = Float64(y * Float64(t - x)) tmp = 0.0 if (y <= -4e-11) tmp = t_1; elseif (y <= 4e-186) tmp = Float64(x - Float64(z * t)); elseif (y <= 8.4e+21) tmp = Float64(x + Float64(x * z)); 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 <= -4e-11) tmp = t_1; elseif (y <= 4e-186) tmp = x - (z * t); elseif (y <= 8.4e+21) tmp = x + (x * z); 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, -4e-11], t$95$1, If[LessEqual[y, 4e-186], N[(x - N[(z * t), $MachinePrecision]), $MachinePrecision], If[LessEqual[y, 8.4e+21], N[(x + N[(x * z), $MachinePrecision]), $MachinePrecision], t$95$1]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := y \cdot \left(t - x\right)\\
\mathbf{if}\;y \leq -4 \cdot 10^{-11}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;y \leq 4 \cdot 10^{-186}:\\
\;\;\;\;x - z \cdot t\\
\mathbf{elif}\;y \leq 8.4 \cdot 10^{+21}:\\
\;\;\;\;x + x \cdot z\\
\mathbf{else}:\\
\;\;\;\;t\_1\\
\end{array}
\end{array}
if y < -3.99999999999999976e-11 or 8.4e21 < y Initial program 99.9%
Taylor expanded in y around inf 86.1%
*-commutative86.1%
Simplified86.1%
Taylor expanded in x around 0 82.5%
Taylor expanded in y around inf 86.1%
mul-1-neg86.1%
unsub-neg86.1%
Simplified86.1%
if -3.99999999999999976e-11 < y < 3.9999999999999996e-186Initial program 100.0%
Taylor expanded in y around 0 92.5%
mul-1-neg92.5%
unsub-neg92.5%
Simplified92.5%
Taylor expanded in t around inf 77.6%
if 3.9999999999999996e-186 < y < 8.4e21Initial program 100.0%
Taylor expanded in t around 0 64.3%
mul-1-neg64.3%
distribute-rgt-neg-in64.3%
sub-neg64.3%
+-commutative64.3%
distribute-neg-in64.3%
remove-double-neg64.3%
sub-neg64.3%
Simplified64.3%
Taylor expanded in z around inf 64.3%
(FPCore (x y z t)
:precision binary64
(let* ((t_1 (* y (- t x))))
(if (<= y -2.55e-18)
t_1
(if (<= y 5.5e-185) (* t (- z)) (if (<= y 8.4e+21) (* x z) t_1)))))
double code(double x, double y, double z, double t) {
double t_1 = y * (t - x);
double tmp;
if (y <= -2.55e-18) {
tmp = t_1;
} else if (y <= 5.5e-185) {
tmp = t * -z;
} else if (y <= 8.4e+21) {
tmp = x * z;
} else {
tmp = t_1;
}
return tmp;
}
real(8) function code(x, y, z, t)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
real(8) :: t_1
real(8) :: tmp
t_1 = y * (t - x)
if (y <= (-2.55d-18)) then
tmp = t_1
else if (y <= 5.5d-185) then
tmp = t * -z
else if (y <= 8.4d+21) then
tmp = x * z
else
tmp = t_1
end if
code = tmp
end function
public static double code(double x, double y, double z, double t) {
double t_1 = y * (t - x);
double tmp;
if (y <= -2.55e-18) {
tmp = t_1;
} else if (y <= 5.5e-185) {
tmp = t * -z;
} else if (y <= 8.4e+21) {
tmp = x * z;
} else {
tmp = t_1;
}
return tmp;
}
def code(x, y, z, t): t_1 = y * (t - x) tmp = 0 if y <= -2.55e-18: tmp = t_1 elif y <= 5.5e-185: tmp = t * -z elif y <= 8.4e+21: tmp = x * z else: tmp = t_1 return tmp
function code(x, y, z, t) t_1 = Float64(y * Float64(t - x)) tmp = 0.0 if (y <= -2.55e-18) tmp = t_1; elseif (y <= 5.5e-185) tmp = Float64(t * Float64(-z)); elseif (y <= 8.4e+21) tmp = Float64(x * z); 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 <= -2.55e-18) tmp = t_1; elseif (y <= 5.5e-185) tmp = t * -z; elseif (y <= 8.4e+21) tmp = x * z; 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, -2.55e-18], t$95$1, If[LessEqual[y, 5.5e-185], N[(t * (-z)), $MachinePrecision], If[LessEqual[y, 8.4e+21], N[(x * z), $MachinePrecision], t$95$1]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := y \cdot \left(t - x\right)\\
\mathbf{if}\;y \leq -2.55 \cdot 10^{-18}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;y \leq 5.5 \cdot 10^{-185}:\\
\;\;\;\;t \cdot \left(-z\right)\\
\mathbf{elif}\;y \leq 8.4 \cdot 10^{+21}:\\
\;\;\;\;x \cdot z\\
\mathbf{else}:\\
\;\;\;\;t\_1\\
\end{array}
\end{array}
if y < -2.54999999999999991e-18 or 8.4e21 < y Initial program 99.9%
Taylor expanded in y around inf 85.5%
*-commutative85.5%
Simplified85.5%
Taylor expanded in x around 0 81.9%
Taylor expanded in y around inf 85.5%
mul-1-neg85.5%
unsub-neg85.5%
Simplified85.5%
if -2.54999999999999991e-18 < y < 5.4999999999999998e-185Initial program 100.0%
Taylor expanded in y around 0 92.5%
mul-1-neg92.5%
unsub-neg92.5%
Simplified92.5%
Taylor expanded in t around inf 79.0%
Taylor expanded in x around 0 46.4%
mul-1-neg46.4%
*-commutative46.4%
distribute-rgt-neg-in46.4%
Simplified46.4%
if 5.4999999999999998e-185 < y < 8.4e21Initial program 100.0%
Taylor expanded in t around 0 63.5%
mul-1-neg63.5%
distribute-rgt-neg-in63.5%
sub-neg63.5%
+-commutative63.5%
distribute-neg-in63.5%
remove-double-neg63.5%
sub-neg63.5%
Simplified63.5%
Taylor expanded in z around inf 63.5%
Taylor expanded in z around inf 42.5%
Final simplification66.6%
(FPCore (x y z t) :precision binary64 (if (<= y -1.45e-53) (* y t) (if (<= y 5.8e-60) x (if (<= y 2.2e+22) (* x z) (* y t)))))
double code(double x, double y, double z, double t) {
double tmp;
if (y <= -1.45e-53) {
tmp = y * t;
} else if (y <= 5.8e-60) {
tmp = x;
} else if (y <= 2.2e+22) {
tmp = x * z;
} 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.45d-53)) then
tmp = y * t
else if (y <= 5.8d-60) then
tmp = x
else if (y <= 2.2d+22) then
tmp = x * z
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.45e-53) {
tmp = y * t;
} else if (y <= 5.8e-60) {
tmp = x;
} else if (y <= 2.2e+22) {
tmp = x * z;
} else {
tmp = y * t;
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if y <= -1.45e-53: tmp = y * t elif y <= 5.8e-60: tmp = x elif y <= 2.2e+22: tmp = x * z else: tmp = y * t return tmp
function code(x, y, z, t) tmp = 0.0 if (y <= -1.45e-53) tmp = Float64(y * t); elseif (y <= 5.8e-60) tmp = x; elseif (y <= 2.2e+22) tmp = Float64(x * z); else tmp = Float64(y * t); end return tmp end
function tmp_2 = code(x, y, z, t) tmp = 0.0; if (y <= -1.45e-53) tmp = y * t; elseif (y <= 5.8e-60) tmp = x; elseif (y <= 2.2e+22) tmp = x * z; else tmp = y * t; end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[LessEqual[y, -1.45e-53], N[(y * t), $MachinePrecision], If[LessEqual[y, 5.8e-60], x, If[LessEqual[y, 2.2e+22], N[(x * z), $MachinePrecision], N[(y * t), $MachinePrecision]]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;y \leq -1.45 \cdot 10^{-53}:\\
\;\;\;\;y \cdot t\\
\mathbf{elif}\;y \leq 5.8 \cdot 10^{-60}:\\
\;\;\;\;x\\
\mathbf{elif}\;y \leq 2.2 \cdot 10^{+22}:\\
\;\;\;\;x \cdot z\\
\mathbf{else}:\\
\;\;\;\;y \cdot t\\
\end{array}
\end{array}
if y < -1.4499999999999999e-53 or 2.2e22 < y Initial program 99.9%
Taylor expanded in y around inf 82.7%
*-commutative82.7%
Simplified82.7%
Taylor expanded in x around 0 79.3%
Taylor expanded in y around inf 82.0%
mul-1-neg82.0%
unsub-neg82.0%
Simplified82.0%
Taylor expanded in t around inf 48.2%
if -1.4499999999999999e-53 < y < 5.7999999999999999e-60Initial program 100.0%
Taylor expanded in y around inf 42.9%
*-commutative42.9%
Simplified42.9%
Taylor expanded in y around 0 37.3%
if 5.7999999999999999e-60 < y < 2.2e22Initial program 100.0%
Taylor expanded in t around 0 58.8%
mul-1-neg58.8%
distribute-rgt-neg-in58.8%
sub-neg58.8%
+-commutative58.8%
distribute-neg-in58.8%
remove-double-neg58.8%
sub-neg58.8%
Simplified58.8%
Taylor expanded in z around inf 58.8%
Taylor expanded in z around inf 55.0%
(FPCore (x y z t) :precision binary64 (if (or (<= y -3.15e-7) (not (<= y 3e+22))) (* y (- t x)) (+ x (* z (- x t)))))
double code(double x, double y, double z, double t) {
double tmp;
if ((y <= -3.15e-7) || !(y <= 3e+22)) {
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 <= (-3.15d-7)) .or. (.not. (y <= 3d+22))) 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 <= -3.15e-7) || !(y <= 3e+22)) {
tmp = y * (t - x);
} else {
tmp = x + (z * (x - t));
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if (y <= -3.15e-7) or not (y <= 3e+22): tmp = y * (t - x) else: tmp = x + (z * (x - t)) return tmp
function code(x, y, z, t) tmp = 0.0 if ((y <= -3.15e-7) || !(y <= 3e+22)) 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 <= -3.15e-7) || ~((y <= 3e+22))) tmp = y * (t - x); else tmp = x + (z * (x - t)); end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[Or[LessEqual[y, -3.15e-7], N[Not[LessEqual[y, 3e+22]], $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 -3.15 \cdot 10^{-7} \lor \neg \left(y \leq 3 \cdot 10^{+22}\right):\\
\;\;\;\;y \cdot \left(t - x\right)\\
\mathbf{else}:\\
\;\;\;\;x + z \cdot \left(x - t\right)\\
\end{array}
\end{array}
if y < -3.15000000000000002e-7 or 3e22 < y Initial program 99.9%
Taylor expanded in y around inf 86.7%
*-commutative86.7%
Simplified86.7%
Taylor expanded in x around 0 83.1%
Taylor expanded in y around inf 86.7%
mul-1-neg86.7%
unsub-neg86.7%
Simplified86.7%
if -3.15000000000000002e-7 < y < 3e22Initial program 100.0%
Taylor expanded in y around 0 88.4%
mul-1-neg88.4%
unsub-neg88.4%
Simplified88.4%
Final simplification87.5%
(FPCore (x y z t) :precision binary64 (if (or (<= x -1.75e-40) (not (<= x 3.4e+21))) (+ x (* x (- z y))) (+ x (* t (- y z)))))
double code(double x, double y, double z, double t) {
double tmp;
if ((x <= -1.75e-40) || !(x <= 3.4e+21)) {
tmp = x + (x * (z - y));
} else {
tmp = x + (t * (y - z));
}
return tmp;
}
real(8) function code(x, y, z, t)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
real(8) :: tmp
if ((x <= (-1.75d-40)) .or. (.not. (x <= 3.4d+21))) then
tmp = x + (x * (z - y))
else
tmp = x + (t * (y - z))
end if
code = tmp
end function
public static double code(double x, double y, double z, double t) {
double tmp;
if ((x <= -1.75e-40) || !(x <= 3.4e+21)) {
tmp = x + (x * (z - y));
} else {
tmp = x + (t * (y - z));
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if (x <= -1.75e-40) or not (x <= 3.4e+21): tmp = x + (x * (z - y)) else: tmp = x + (t * (y - z)) return tmp
function code(x, y, z, t) tmp = 0.0 if ((x <= -1.75e-40) || !(x <= 3.4e+21)) tmp = Float64(x + Float64(x * Float64(z - y))); else tmp = Float64(x + Float64(t * Float64(y - z))); end return tmp end
function tmp_2 = code(x, y, z, t) tmp = 0.0; if ((x <= -1.75e-40) || ~((x <= 3.4e+21))) tmp = x + (x * (z - y)); else tmp = x + (t * (y - z)); end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[Or[LessEqual[x, -1.75e-40], N[Not[LessEqual[x, 3.4e+21]], $MachinePrecision]], N[(x + N[(x * N[(z - y), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(x + N[(t * N[(y - z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x \leq -1.75 \cdot 10^{-40} \lor \neg \left(x \leq 3.4 \cdot 10^{+21}\right):\\
\;\;\;\;x + x \cdot \left(z - y\right)\\
\mathbf{else}:\\
\;\;\;\;x + t \cdot \left(y - z\right)\\
\end{array}
\end{array}
if x < -1.7500000000000001e-40 or 3.4e21 < x Initial program 100.0%
Taylor expanded in t around 0 83.6%
mul-1-neg83.6%
distribute-rgt-neg-in83.6%
sub-neg83.6%
+-commutative83.6%
distribute-neg-in83.6%
remove-double-neg83.6%
sub-neg83.6%
Simplified83.6%
if -1.7500000000000001e-40 < x < 3.4e21Initial program 100.0%
Taylor expanded in t around inf 83.5%
Final simplification83.6%
(FPCore (x y z t) :precision binary64 (if (or (<= y -2e-7) (not (<= y 8.4e+21))) (* y (- t x)) (+ x (* x z))))
double code(double x, double y, double z, double t) {
double tmp;
if ((y <= -2e-7) || !(y <= 8.4e+21)) {
tmp = y * (t - x);
} else {
tmp = x + (x * z);
}
return tmp;
}
real(8) function code(x, y, z, t)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
real(8) :: tmp
if ((y <= (-2d-7)) .or. (.not. (y <= 8.4d+21))) then
tmp = y * (t - x)
else
tmp = x + (x * z)
end if
code = tmp
end function
public static double code(double x, double y, double z, double t) {
double tmp;
if ((y <= -2e-7) || !(y <= 8.4e+21)) {
tmp = y * (t - x);
} else {
tmp = x + (x * z);
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if (y <= -2e-7) or not (y <= 8.4e+21): tmp = y * (t - x) else: tmp = x + (x * z) return tmp
function code(x, y, z, t) tmp = 0.0 if ((y <= -2e-7) || !(y <= 8.4e+21)) tmp = Float64(y * Float64(t - x)); else tmp = Float64(x + Float64(x * z)); end return tmp end
function tmp_2 = code(x, y, z, t) tmp = 0.0; if ((y <= -2e-7) || ~((y <= 8.4e+21))) tmp = y * (t - x); else tmp = x + (x * z); end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[Or[LessEqual[y, -2e-7], N[Not[LessEqual[y, 8.4e+21]], $MachinePrecision]], N[(y * N[(t - x), $MachinePrecision]), $MachinePrecision], N[(x + N[(x * z), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;y \leq -2 \cdot 10^{-7} \lor \neg \left(y \leq 8.4 \cdot 10^{+21}\right):\\
\;\;\;\;y \cdot \left(t - x\right)\\
\mathbf{else}:\\
\;\;\;\;x + x \cdot z\\
\end{array}
\end{array}
if y < -1.9999999999999999e-7 or 8.4e21 < y Initial program 99.9%
Taylor expanded in y around inf 86.1%
*-commutative86.1%
Simplified86.1%
Taylor expanded in x around 0 82.5%
Taylor expanded in y around inf 86.1%
mul-1-neg86.1%
unsub-neg86.1%
Simplified86.1%
if -1.9999999999999999e-7 < y < 8.4e21Initial program 100.0%
Taylor expanded in t around 0 55.3%
mul-1-neg55.3%
distribute-rgt-neg-in55.3%
sub-neg55.3%
+-commutative55.3%
distribute-neg-in55.3%
remove-double-neg55.3%
sub-neg55.3%
Simplified55.3%
Taylor expanded in z around inf 55.3%
Final simplification71.7%
(FPCore (x y z t) :precision binary64 (if (or (<= x -5.5e-40) (not (<= x 3.6e-100))) (* x (- 1.0 y)) (* y t)))
double code(double x, double y, double z, double t) {
double tmp;
if ((x <= -5.5e-40) || !(x <= 3.6e-100)) {
tmp = x * (1.0 - y);
} 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 ((x <= (-5.5d-40)) .or. (.not. (x <= 3.6d-100))) then
tmp = x * (1.0d0 - y)
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 ((x <= -5.5e-40) || !(x <= 3.6e-100)) {
tmp = x * (1.0 - y);
} else {
tmp = y * t;
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if (x <= -5.5e-40) or not (x <= 3.6e-100): tmp = x * (1.0 - y) else: tmp = y * t return tmp
function code(x, y, z, t) tmp = 0.0 if ((x <= -5.5e-40) || !(x <= 3.6e-100)) tmp = Float64(x * Float64(1.0 - y)); else tmp = Float64(y * t); end return tmp end
function tmp_2 = code(x, y, z, t) tmp = 0.0; if ((x <= -5.5e-40) || ~((x <= 3.6e-100))) tmp = x * (1.0 - y); else tmp = y * t; end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[Or[LessEqual[x, -5.5e-40], N[Not[LessEqual[x, 3.6e-100]], $MachinePrecision]], N[(x * N[(1.0 - y), $MachinePrecision]), $MachinePrecision], N[(y * t), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x \leq -5.5 \cdot 10^{-40} \lor \neg \left(x \leq 3.6 \cdot 10^{-100}\right):\\
\;\;\;\;x \cdot \left(1 - y\right)\\
\mathbf{else}:\\
\;\;\;\;y \cdot t\\
\end{array}
\end{array}
if x < -5.50000000000000002e-40 or 3.5999999999999999e-100 < x Initial program 99.9%
Taylor expanded in t around 0 78.1%
mul-1-neg78.1%
distribute-rgt-neg-in78.1%
sub-neg78.1%
+-commutative78.1%
distribute-neg-in78.1%
remove-double-neg78.1%
sub-neg78.1%
Simplified78.1%
Taylor expanded in z around 0 53.6%
mul-1-neg53.6%
*-rgt-identity53.6%
distribute-rgt-neg-out53.6%
distribute-lft-in53.6%
unsub-neg53.6%
Simplified53.6%
if -5.50000000000000002e-40 < x < 3.5999999999999999e-100Initial program 100.0%
Taylor expanded in y around inf 63.0%
*-commutative63.0%
Simplified63.0%
Taylor expanded in x around 0 63.0%
Taylor expanded in y around inf 57.2%
mul-1-neg57.2%
unsub-neg57.2%
Simplified57.2%
Taylor expanded in t around inf 51.2%
Final simplification52.5%
(FPCore (x y z t) :precision binary64 (if (or (<= z -1.15) (not (<= z 1.0))) (* x z) x))
double code(double x, double y, double z, double t) {
double tmp;
if ((z <= -1.15) || !(z <= 1.0)) {
tmp = x * z;
} else {
tmp = x;
}
return tmp;
}
real(8) function code(x, y, z, t)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
real(8) :: tmp
if ((z <= (-1.15d0)) .or. (.not. (z <= 1.0d0))) then
tmp = x * z
else
tmp = x
end if
code = tmp
end function
public static double code(double x, double y, double z, double t) {
double tmp;
if ((z <= -1.15) || !(z <= 1.0)) {
tmp = x * z;
} else {
tmp = x;
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if (z <= -1.15) or not (z <= 1.0): tmp = x * z else: tmp = x return tmp
function code(x, y, z, t) tmp = 0.0 if ((z <= -1.15) || !(z <= 1.0)) tmp = Float64(x * z); else tmp = x; end return tmp end
function tmp_2 = code(x, y, z, t) tmp = 0.0; if ((z <= -1.15) || ~((z <= 1.0))) tmp = x * z; else tmp = x; end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[Or[LessEqual[z, -1.15], N[Not[LessEqual[z, 1.0]], $MachinePrecision]], N[(x * z), $MachinePrecision], x]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \leq -1.15 \lor \neg \left(z \leq 1\right):\\
\;\;\;\;x \cdot z\\
\mathbf{else}:\\
\;\;\;\;x\\
\end{array}
\end{array}
if z < -1.1499999999999999 or 1 < z Initial program 99.9%
Taylor expanded in t around 0 49.9%
mul-1-neg49.9%
distribute-rgt-neg-in49.9%
sub-neg49.9%
+-commutative49.9%
distribute-neg-in49.9%
remove-double-neg49.9%
sub-neg49.9%
Simplified49.9%
Taylor expanded in z around inf 38.8%
Taylor expanded in z around inf 38.2%
if -1.1499999999999999 < z < 1Initial program 100.0%
Taylor expanded in y around inf 91.8%
*-commutative91.8%
Simplified91.8%
Taylor expanded in y around 0 26.0%
Final simplification31.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 y around inf 64.5%
*-commutative64.5%
Simplified64.5%
Taylor expanded in y around 0 15.3%
(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 2024145
(FPCore (x y z t)
:name "Data.Metrics.Snapshot:quantile from metrics-0.3.0.2"
:precision binary64
:alt
(! :herbie-platform default (+ x (+ (* t (- y z)) (* (- x) (- y z)))))
(+ x (* (- y z) (- t x))))