
(FPCore (x y z t) :precision binary64 (+ x (* (- y z) (- t x))))
double code(double x, double y, double z, double t) {
return x + ((y - z) * (t - x));
}
real(8) function code(x, y, z, t)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
code = x + ((y - z) * (t - x))
end function
public static double code(double x, double y, double z, double t) {
return x + ((y - z) * (t - x));
}
def code(x, y, z, t): return x + ((y - z) * (t - x))
function code(x, y, z, t) return Float64(x + Float64(Float64(y - z) * Float64(t - x))) end
function tmp = code(x, y, z, t) tmp = x + ((y - z) * (t - x)); end
code[x_, y_, z_, t_] := N[(x + N[(N[(y - z), $MachinePrecision] * N[(t - x), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
x + \left(y - z\right) \cdot \left(t - x\right)
\end{array}
Sampling outcomes in binary64 precision:
Herbie found 12 alternatives:
| Alternative | Accuracy | Speedup |
|---|
(FPCore (x y z t) :precision binary64 (+ x (* (- y z) (- t x))))
double code(double x, double y, double z, double t) {
return x + ((y - z) * (t - x));
}
real(8) function code(x, y, z, t)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
code = x + ((y - z) * (t - x))
end function
public static double code(double x, double y, double z, double t) {
return x + ((y - z) * (t - x));
}
def code(x, y, z, t): return x + ((y - z) * (t - x))
function code(x, y, z, t) return Float64(x + Float64(Float64(y - z) * Float64(t - x))) end
function tmp = code(x, y, z, t) tmp = x + ((y - z) * (t - x)); end
code[x_, y_, z_, t_] := N[(x + N[(N[(y - z), $MachinePrecision] * N[(t - x), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
x + \left(y - z\right) \cdot \left(t - x\right)
\end{array}
(FPCore (x y z t) :precision binary64 (+ x (* (- y z) (- t x))))
double code(double x, double y, double z, double t) {
return x + ((y - z) * (t - x));
}
real(8) function code(x, y, z, t)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
code = x + ((y - z) * (t - x))
end function
public static double code(double x, double y, double z, double t) {
return x + ((y - z) * (t - x));
}
def code(x, y, z, t): return x + ((y - z) * (t - x))
function code(x, y, z, t) return Float64(x + Float64(Float64(y - z) * Float64(t - x))) end
function tmp = code(x, y, z, t) tmp = x + ((y - z) * (t - x)); end
code[x_, y_, z_, t_] := N[(x + N[(N[(y - z), $MachinePrecision] * N[(t - x), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
x + \left(y - z\right) \cdot \left(t - x\right)
\end{array}
Initial program 100.0%
(FPCore (x y z t)
:precision binary64
(let* ((t_1 (* z (- x t))) (t_2 (* (- y z) t)))
(if (<= z -3e+186)
t_1
(if (<= z -3.3e-187)
t_2
(if (<= z 1.3e-270) (* x (- 1.0 y)) (if (<= z 3.6e+25) t_2 t_1))))))
double code(double x, double y, double z, double t) {
double t_1 = z * (x - t);
double t_2 = (y - z) * t;
double tmp;
if (z <= -3e+186) {
tmp = t_1;
} else if (z <= -3.3e-187) {
tmp = t_2;
} else if (z <= 1.3e-270) {
tmp = x * (1.0 - y);
} else if (z <= 3.6e+25) {
tmp = t_2;
} else {
tmp = t_1;
}
return tmp;
}
real(8) function code(x, y, z, t)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
real(8) :: t_1
real(8) :: t_2
real(8) :: tmp
t_1 = z * (x - t)
t_2 = (y - z) * t
if (z <= (-3d+186)) then
tmp = t_1
else if (z <= (-3.3d-187)) then
tmp = t_2
else if (z <= 1.3d-270) then
tmp = x * (1.0d0 - y)
else if (z <= 3.6d+25) then
tmp = t_2
else
tmp = t_1
end if
code = tmp
end function
public static double code(double x, double y, double z, double t) {
double t_1 = z * (x - t);
double t_2 = (y - z) * t;
double tmp;
if (z <= -3e+186) {
tmp = t_1;
} else if (z <= -3.3e-187) {
tmp = t_2;
} else if (z <= 1.3e-270) {
tmp = x * (1.0 - y);
} else if (z <= 3.6e+25) {
tmp = t_2;
} else {
tmp = t_1;
}
return tmp;
}
def code(x, y, z, t): t_1 = z * (x - t) t_2 = (y - z) * t tmp = 0 if z <= -3e+186: tmp = t_1 elif z <= -3.3e-187: tmp = t_2 elif z <= 1.3e-270: tmp = x * (1.0 - y) elif z <= 3.6e+25: tmp = t_2 else: tmp = t_1 return tmp
function code(x, y, z, t) t_1 = Float64(z * Float64(x - t)) t_2 = Float64(Float64(y - z) * t) tmp = 0.0 if (z <= -3e+186) tmp = t_1; elseif (z <= -3.3e-187) tmp = t_2; elseif (z <= 1.3e-270) tmp = Float64(x * Float64(1.0 - y)); elseif (z <= 3.6e+25) tmp = t_2; else tmp = t_1; end return tmp end
function tmp_2 = code(x, y, z, t) t_1 = z * (x - t); t_2 = (y - z) * t; tmp = 0.0; if (z <= -3e+186) tmp = t_1; elseif (z <= -3.3e-187) tmp = t_2; elseif (z <= 1.3e-270) tmp = x * (1.0 - y); elseif (z <= 3.6e+25) tmp = t_2; else tmp = t_1; end tmp_2 = tmp; end
code[x_, y_, z_, t_] := Block[{t$95$1 = N[(z * N[(x - t), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$2 = N[(N[(y - z), $MachinePrecision] * t), $MachinePrecision]}, If[LessEqual[z, -3e+186], t$95$1, If[LessEqual[z, -3.3e-187], t$95$2, If[LessEqual[z, 1.3e-270], N[(x * N[(1.0 - y), $MachinePrecision]), $MachinePrecision], If[LessEqual[z, 3.6e+25], t$95$2, t$95$1]]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := z \cdot \left(x - t\right)\\
t_2 := \left(y - z\right) \cdot t\\
\mathbf{if}\;z \leq -3 \cdot 10^{+186}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;z \leq -3.3 \cdot 10^{-187}:\\
\;\;\;\;t\_2\\
\mathbf{elif}\;z \leq 1.3 \cdot 10^{-270}:\\
\;\;\;\;x \cdot \left(1 - y\right)\\
\mathbf{elif}\;z \leq 3.6 \cdot 10^{+25}:\\
\;\;\;\;t\_2\\
\mathbf{else}:\\
\;\;\;\;t\_1\\
\end{array}
\end{array}
if z < -2.99999999999999982e186 or 3.60000000000000015e25 < z Initial program 100.0%
Taylor expanded in y around 0 79.5%
mul-1-neg79.5%
unsub-neg79.5%
Simplified79.5%
Taylor expanded in x around 0 72.8%
sub-neg72.8%
neg-mul-172.8%
remove-double-neg72.8%
+-commutative72.8%
Simplified72.8%
Taylor expanded in z around inf 79.5%
if -2.99999999999999982e186 < z < -3.3e-187 or 1.3000000000000001e-270 < z < 3.60000000000000015e25Initial program 100.0%
Taylor expanded in t around inf 74.6%
*-commutative74.6%
sub-neg74.6%
distribute-rgt-in72.3%
Applied egg-rr72.3%
associate-+r+72.3%
distribute-lft-neg-out72.3%
unsub-neg72.3%
+-commutative72.3%
*-commutative72.3%
Applied egg-rr72.3%
Taylor expanded in t around inf 63.3%
if -3.3e-187 < z < 1.3000000000000001e-270Initial program 100.0%
Taylor expanded in y around inf 100.0%
*-commutative100.0%
Simplified100.0%
Taylor expanded in x around inf 74.5%
neg-mul-174.5%
unsub-neg74.5%
Simplified74.5%
Final simplification70.6%
(FPCore (x y z t)
:precision binary64
(let* ((t_1 (* (- y z) t)))
(if (<= t -4.5e-30)
t_1
(if (<= t -1.55e-286)
(* x (- 1.0 y))
(if (<= t 1.35e-41) (* x (+ z 1.0)) t_1)))))
double code(double x, double y, double z, double t) {
double t_1 = (y - z) * t;
double tmp;
if (t <= -4.5e-30) {
tmp = t_1;
} else if (t <= -1.55e-286) {
tmp = x * (1.0 - y);
} else if (t <= 1.35e-41) {
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 = (y - z) * t
if (t <= (-4.5d-30)) then
tmp = t_1
else if (t <= (-1.55d-286)) then
tmp = x * (1.0d0 - y)
else if (t <= 1.35d-41) 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 = (y - z) * t;
double tmp;
if (t <= -4.5e-30) {
tmp = t_1;
} else if (t <= -1.55e-286) {
tmp = x * (1.0 - y);
} else if (t <= 1.35e-41) {
tmp = x * (z + 1.0);
} else {
tmp = t_1;
}
return tmp;
}
def code(x, y, z, t): t_1 = (y - z) * t tmp = 0 if t <= -4.5e-30: tmp = t_1 elif t <= -1.55e-286: tmp = x * (1.0 - y) elif t <= 1.35e-41: tmp = x * (z + 1.0) else: tmp = t_1 return tmp
function code(x, y, z, t) t_1 = Float64(Float64(y - z) * t) tmp = 0.0 if (t <= -4.5e-30) tmp = t_1; elseif (t <= -1.55e-286) tmp = Float64(x * Float64(1.0 - y)); elseif (t <= 1.35e-41) 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 = (y - z) * t; tmp = 0.0; if (t <= -4.5e-30) tmp = t_1; elseif (t <= -1.55e-286) tmp = x * (1.0 - y); elseif (t <= 1.35e-41) tmp = x * (z + 1.0); else tmp = t_1; end tmp_2 = tmp; end
code[x_, y_, z_, t_] := Block[{t$95$1 = N[(N[(y - z), $MachinePrecision] * t), $MachinePrecision]}, If[LessEqual[t, -4.5e-30], t$95$1, If[LessEqual[t, -1.55e-286], N[(x * N[(1.0 - y), $MachinePrecision]), $MachinePrecision], If[LessEqual[t, 1.35e-41], N[(x * N[(z + 1.0), $MachinePrecision]), $MachinePrecision], t$95$1]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := \left(y - z\right) \cdot t\\
\mathbf{if}\;t \leq -4.5 \cdot 10^{-30}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;t \leq -1.55 \cdot 10^{-286}:\\
\;\;\;\;x \cdot \left(1 - y\right)\\
\mathbf{elif}\;t \leq 1.35 \cdot 10^{-41}:\\
\;\;\;\;x \cdot \left(z + 1\right)\\
\mathbf{else}:\\
\;\;\;\;t\_1\\
\end{array}
\end{array}
if t < -4.49999999999999967e-30 or 1.35e-41 < t Initial program 100.0%
Taylor expanded in t around inf 86.8%
*-commutative86.8%
sub-neg86.8%
distribute-rgt-in80.9%
Applied egg-rr80.9%
associate-+r+80.9%
distribute-lft-neg-out80.9%
unsub-neg80.9%
+-commutative80.9%
*-commutative80.9%
Applied egg-rr80.9%
Taylor expanded in t around inf 76.0%
if -4.49999999999999967e-30 < t < -1.54999999999999991e-286Initial program 100.0%
Taylor expanded in y around inf 65.4%
*-commutative65.4%
Simplified65.4%
Taylor expanded in x around inf 53.5%
neg-mul-153.5%
unsub-neg53.5%
Simplified53.5%
if -1.54999999999999991e-286 < t < 1.35e-41Initial program 99.9%
Taylor expanded in y around 0 70.9%
mul-1-neg70.9%
unsub-neg70.9%
Simplified70.9%
Taylor expanded in x around inf 59.1%
sub-neg59.1%
neg-mul-159.1%
remove-double-neg59.1%
+-commutative59.1%
Simplified59.1%
Final simplification68.2%
(FPCore (x y z t)
:precision binary64
(let* ((t_1 (* (- y z) t)))
(if (<= t -1.85e-115)
t_1
(if (<= t -6.8e-286) (* y (- x)) (if (<= t 5.2e-146) (* x z) t_1)))))
double code(double x, double y, double z, double t) {
double t_1 = (y - z) * t;
double tmp;
if (t <= -1.85e-115) {
tmp = t_1;
} else if (t <= -6.8e-286) {
tmp = y * -x;
} else if (t <= 5.2e-146) {
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 - z) * t
if (t <= (-1.85d-115)) then
tmp = t_1
else if (t <= (-6.8d-286)) then
tmp = y * -x
else if (t <= 5.2d-146) 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 - z) * t;
double tmp;
if (t <= -1.85e-115) {
tmp = t_1;
} else if (t <= -6.8e-286) {
tmp = y * -x;
} else if (t <= 5.2e-146) {
tmp = x * z;
} else {
tmp = t_1;
}
return tmp;
}
def code(x, y, z, t): t_1 = (y - z) * t tmp = 0 if t <= -1.85e-115: tmp = t_1 elif t <= -6.8e-286: tmp = y * -x elif t <= 5.2e-146: tmp = x * z else: tmp = t_1 return tmp
function code(x, y, z, t) t_1 = Float64(Float64(y - z) * t) tmp = 0.0 if (t <= -1.85e-115) tmp = t_1; elseif (t <= -6.8e-286) tmp = Float64(y * Float64(-x)); elseif (t <= 5.2e-146) tmp = Float64(x * z); else tmp = t_1; end return tmp end
function tmp_2 = code(x, y, z, t) t_1 = (y - z) * t; tmp = 0.0; if (t <= -1.85e-115) tmp = t_1; elseif (t <= -6.8e-286) tmp = y * -x; elseif (t <= 5.2e-146) tmp = x * z; else tmp = t_1; end tmp_2 = tmp; end
code[x_, y_, z_, t_] := Block[{t$95$1 = N[(N[(y - z), $MachinePrecision] * t), $MachinePrecision]}, If[LessEqual[t, -1.85e-115], t$95$1, If[LessEqual[t, -6.8e-286], N[(y * (-x)), $MachinePrecision], If[LessEqual[t, 5.2e-146], N[(x * z), $MachinePrecision], t$95$1]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := \left(y - z\right) \cdot t\\
\mathbf{if}\;t \leq -1.85 \cdot 10^{-115}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;t \leq -6.8 \cdot 10^{-286}:\\
\;\;\;\;y \cdot \left(-x\right)\\
\mathbf{elif}\;t \leq 5.2 \cdot 10^{-146}:\\
\;\;\;\;x \cdot z\\
\mathbf{else}:\\
\;\;\;\;t\_1\\
\end{array}
\end{array}
if t < -1.85e-115 or 5.19999999999999974e-146 < t Initial program 100.0%
Taylor expanded in t around inf 80.8%
*-commutative80.8%
sub-neg80.8%
distribute-rgt-in76.0%
Applied egg-rr76.0%
associate-+r+76.0%
distribute-lft-neg-out76.0%
unsub-neg76.0%
+-commutative76.0%
*-commutative76.0%
Applied egg-rr76.0%
Taylor expanded in t around inf 69.3%
if -1.85e-115 < t < -6.8000000000000002e-286Initial program 100.0%
Taylor expanded in y around inf 67.5%
*-commutative67.5%
Simplified67.5%
Taylor expanded in x around inf 61.3%
neg-mul-161.3%
unsub-neg61.3%
Simplified61.3%
Taylor expanded in y around inf 51.6%
mul-1-neg51.6%
*-commutative51.6%
distribute-rgt-neg-in51.6%
Simplified51.6%
if -6.8000000000000002e-286 < t < 5.19999999999999974e-146Initial program 99.9%
Taylor expanded in y around 0 74.0%
mul-1-neg74.0%
unsub-neg74.0%
Simplified74.0%
Taylor expanded in x around inf 64.8%
sub-neg64.8%
neg-mul-164.8%
remove-double-neg64.8%
+-commutative64.8%
Simplified64.8%
Taylor expanded in z around inf 42.9%
*-commutative42.9%
Simplified42.9%
Final simplification63.3%
(FPCore (x y z t) :precision binary64 (if (<= y -1.72e+62) (* y t) (if (<= y 1.45e-136) (* t (- z)) (if (<= y 3e-39) x (* y t)))))
double code(double x, double y, double z, double t) {
double tmp;
if (y <= -1.72e+62) {
tmp = y * t;
} else if (y <= 1.45e-136) {
tmp = t * -z;
} else if (y <= 3e-39) {
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.72d+62)) then
tmp = y * t
else if (y <= 1.45d-136) then
tmp = t * -z
else if (y <= 3d-39) 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.72e+62) {
tmp = y * t;
} else if (y <= 1.45e-136) {
tmp = t * -z;
} else if (y <= 3e-39) {
tmp = x;
} else {
tmp = y * t;
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if y <= -1.72e+62: tmp = y * t elif y <= 1.45e-136: tmp = t * -z elif y <= 3e-39: tmp = x else: tmp = y * t return tmp
function code(x, y, z, t) tmp = 0.0 if (y <= -1.72e+62) tmp = Float64(y * t); elseif (y <= 1.45e-136) tmp = Float64(t * Float64(-z)); elseif (y <= 3e-39) 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.72e+62) tmp = y * t; elseif (y <= 1.45e-136) tmp = t * -z; elseif (y <= 3e-39) tmp = x; else tmp = y * t; end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[LessEqual[y, -1.72e+62], N[(y * t), $MachinePrecision], If[LessEqual[y, 1.45e-136], N[(t * (-z)), $MachinePrecision], If[LessEqual[y, 3e-39], x, N[(y * t), $MachinePrecision]]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;y \leq -1.72 \cdot 10^{+62}:\\
\;\;\;\;y \cdot t\\
\mathbf{elif}\;y \leq 1.45 \cdot 10^{-136}:\\
\;\;\;\;t \cdot \left(-z\right)\\
\mathbf{elif}\;y \leq 3 \cdot 10^{-39}:\\
\;\;\;\;x\\
\mathbf{else}:\\
\;\;\;\;y \cdot t\\
\end{array}
\end{array}
if y < -1.7200000000000001e62 or 3.00000000000000028e-39 < y Initial program 100.0%
Taylor expanded in t around inf 61.4%
*-commutative61.4%
sub-neg61.4%
distribute-rgt-in54.3%
Applied egg-rr54.3%
associate-+r+54.3%
distribute-lft-neg-out54.3%
unsub-neg54.3%
+-commutative54.3%
*-commutative54.3%
Applied egg-rr54.3%
Taylor expanded in y around inf 51.3%
if -1.7200000000000001e62 < y < 1.44999999999999997e-136Initial program 100.0%
Taylor expanded in t around inf 70.6%
*-commutative70.6%
sub-neg70.6%
distribute-rgt-in70.6%
Applied egg-rr70.6%
associate-+r+70.6%
distribute-lft-neg-out70.6%
unsub-neg70.6%
+-commutative70.6%
*-commutative70.6%
Applied egg-rr70.6%
Taylor expanded in z around inf 43.0%
associate-*r*43.0%
neg-mul-143.0%
Simplified43.0%
if 1.44999999999999997e-136 < y < 3.00000000000000028e-39Initial program 100.0%
Taylor expanded in y around inf 58.9%
*-commutative58.9%
Simplified58.9%
Taylor expanded in y around 0 50.9%
Final simplification47.8%
(FPCore (x y z t) :precision binary64 (if (<= y -1.32e+65) (* y t) (if (<= y 3.1e-255) (* x z) (if (<= y 1.05e-40) x (* y t)))))
double code(double x, double y, double z, double t) {
double tmp;
if (y <= -1.32e+65) {
tmp = y * t;
} else if (y <= 3.1e-255) {
tmp = x * z;
} else if (y <= 1.05e-40) {
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.32d+65)) then
tmp = y * t
else if (y <= 3.1d-255) then
tmp = x * z
else if (y <= 1.05d-40) 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.32e+65) {
tmp = y * t;
} else if (y <= 3.1e-255) {
tmp = x * z;
} else if (y <= 1.05e-40) {
tmp = x;
} else {
tmp = y * t;
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if y <= -1.32e+65: tmp = y * t elif y <= 3.1e-255: tmp = x * z elif y <= 1.05e-40: tmp = x else: tmp = y * t return tmp
function code(x, y, z, t) tmp = 0.0 if (y <= -1.32e+65) tmp = Float64(y * t); elseif (y <= 3.1e-255) tmp = Float64(x * z); elseif (y <= 1.05e-40) 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.32e+65) tmp = y * t; elseif (y <= 3.1e-255) tmp = x * z; elseif (y <= 1.05e-40) tmp = x; else tmp = y * t; end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[LessEqual[y, -1.32e+65], N[(y * t), $MachinePrecision], If[LessEqual[y, 3.1e-255], N[(x * z), $MachinePrecision], If[LessEqual[y, 1.05e-40], x, N[(y * t), $MachinePrecision]]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;y \leq -1.32 \cdot 10^{+65}:\\
\;\;\;\;y \cdot t\\
\mathbf{elif}\;y \leq 3.1 \cdot 10^{-255}:\\
\;\;\;\;x \cdot z\\
\mathbf{elif}\;y \leq 1.05 \cdot 10^{-40}:\\
\;\;\;\;x\\
\mathbf{else}:\\
\;\;\;\;y \cdot t\\
\end{array}
\end{array}
if y < -1.31999999999999995e65 or 1.05000000000000009e-40 < y Initial program 100.0%
Taylor expanded in t around inf 61.4%
*-commutative61.4%
sub-neg61.4%
distribute-rgt-in54.3%
Applied egg-rr54.3%
associate-+r+54.3%
distribute-lft-neg-out54.3%
unsub-neg54.3%
+-commutative54.3%
*-commutative54.3%
Applied egg-rr54.3%
Taylor expanded in y around inf 51.3%
if -1.31999999999999995e65 < y < 3.09999999999999997e-255Initial program 100.0%
Taylor expanded in y around 0 84.8%
mul-1-neg84.8%
unsub-neg84.8%
Simplified84.8%
Taylor expanded in x around inf 51.3%
sub-neg51.3%
neg-mul-151.3%
remove-double-neg51.3%
+-commutative51.3%
Simplified51.3%
Taylor expanded in z around inf 35.9%
*-commutative35.9%
Simplified35.9%
if 3.09999999999999997e-255 < y < 1.05000000000000009e-40Initial program 100.0%
Taylor expanded in y around inf 47.1%
*-commutative47.1%
Simplified47.1%
Taylor expanded in y around 0 43.1%
Final simplification44.8%
(FPCore (x y z t) :precision binary64 (if (or (<= y -6e+52) (not (<= y 2.1e+39))) (+ x (* y (- t x))) (+ x (* z (- x t)))))
double code(double x, double y, double z, double t) {
double tmp;
if ((y <= -6e+52) || !(y <= 2.1e+39)) {
tmp = x + (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 <= (-6d+52)) .or. (.not. (y <= 2.1d+39))) then
tmp = x + (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 <= -6e+52) || !(y <= 2.1e+39)) {
tmp = x + (y * (t - x));
} else {
tmp = x + (z * (x - t));
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if (y <= -6e+52) or not (y <= 2.1e+39): tmp = x + (y * (t - x)) else: tmp = x + (z * (x - t)) return tmp
function code(x, y, z, t) tmp = 0.0 if ((y <= -6e+52) || !(y <= 2.1e+39)) tmp = Float64(x + 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 <= -6e+52) || ~((y <= 2.1e+39))) tmp = x + (y * (t - x)); else tmp = x + (z * (x - t)); end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[Or[LessEqual[y, -6e+52], N[Not[LessEqual[y, 2.1e+39]], $MachinePrecision]], N[(x + N[(y * N[(t - x), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(x + N[(z * N[(x - t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;y \leq -6 \cdot 10^{+52} \lor \neg \left(y \leq 2.1 \cdot 10^{+39}\right):\\
\;\;\;\;x + y \cdot \left(t - x\right)\\
\mathbf{else}:\\
\;\;\;\;x + z \cdot \left(x - t\right)\\
\end{array}
\end{array}
if y < -6e52 or 2.0999999999999999e39 < y Initial program 100.0%
Taylor expanded in y around inf 87.5%
*-commutative87.5%
Simplified87.5%
if -6e52 < y < 2.0999999999999999e39Initial program 100.0%
Taylor expanded in y around 0 88.3%
mul-1-neg88.3%
unsub-neg88.3%
Simplified88.3%
Final simplification87.9%
(FPCore (x y z t) :precision binary64 (if (or (<= z -3.3e+28) (not (<= z 3.6e+30))) (* z (- x t)) (+ x (* y (- t x)))))
double code(double x, double y, double z, double t) {
double tmp;
if ((z <= -3.3e+28) || !(z <= 3.6e+30)) {
tmp = z * (x - t);
} else {
tmp = x + (y * (t - x));
}
return tmp;
}
real(8) function code(x, y, z, t)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
real(8) :: tmp
if ((z <= (-3.3d+28)) .or. (.not. (z <= 3.6d+30))) then
tmp = z * (x - t)
else
tmp = x + (y * (t - x))
end if
code = tmp
end function
public static double code(double x, double y, double z, double t) {
double tmp;
if ((z <= -3.3e+28) || !(z <= 3.6e+30)) {
tmp = z * (x - t);
} else {
tmp = x + (y * (t - x));
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if (z <= -3.3e+28) or not (z <= 3.6e+30): tmp = z * (x - t) else: tmp = x + (y * (t - x)) return tmp
function code(x, y, z, t) tmp = 0.0 if ((z <= -3.3e+28) || !(z <= 3.6e+30)) tmp = Float64(z * Float64(x - t)); else tmp = Float64(x + Float64(y * Float64(t - x))); end return tmp end
function tmp_2 = code(x, y, z, t) tmp = 0.0; if ((z <= -3.3e+28) || ~((z <= 3.6e+30))) tmp = z * (x - t); else tmp = x + (y * (t - x)); end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[Or[LessEqual[z, -3.3e+28], N[Not[LessEqual[z, 3.6e+30]], $MachinePrecision]], N[(z * N[(x - t), $MachinePrecision]), $MachinePrecision], N[(x + N[(y * N[(t - x), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \leq -3.3 \cdot 10^{+28} \lor \neg \left(z \leq 3.6 \cdot 10^{+30}\right):\\
\;\;\;\;z \cdot \left(x - t\right)\\
\mathbf{else}:\\
\;\;\;\;x + y \cdot \left(t - x\right)\\
\end{array}
\end{array}
if z < -3.3e28 or 3.6000000000000002e30 < z Initial program 100.0%
Taylor expanded in y around 0 76.4%
mul-1-neg76.4%
unsub-neg76.4%
Simplified76.4%
Taylor expanded in x around 0 71.5%
sub-neg71.5%
neg-mul-171.5%
remove-double-neg71.5%
+-commutative71.5%
Simplified71.5%
Taylor expanded in z around inf 76.4%
if -3.3e28 < z < 3.6000000000000002e30Initial program 100.0%
Taylor expanded in y around inf 87.0%
*-commutative87.0%
Simplified87.0%
Final simplification81.9%
(FPCore (x y z t) :precision binary64 (if (or (<= z -5.3e+17) (not (<= z 650000000000.0))) (* z (- x t)) (+ x (* y t))))
double code(double x, double y, double z, double t) {
double tmp;
if ((z <= -5.3e+17) || !(z <= 650000000000.0)) {
tmp = z * (x - t);
} else {
tmp = x + (y * t);
}
return tmp;
}
real(8) function code(x, y, z, t)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
real(8) :: tmp
if ((z <= (-5.3d+17)) .or. (.not. (z <= 650000000000.0d0))) then
tmp = z * (x - t)
else
tmp = x + (y * t)
end if
code = tmp
end function
public static double code(double x, double y, double z, double t) {
double tmp;
if ((z <= -5.3e+17) || !(z <= 650000000000.0)) {
tmp = z * (x - t);
} else {
tmp = x + (y * t);
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if (z <= -5.3e+17) or not (z <= 650000000000.0): tmp = z * (x - t) else: tmp = x + (y * t) return tmp
function code(x, y, z, t) tmp = 0.0 if ((z <= -5.3e+17) || !(z <= 650000000000.0)) tmp = Float64(z * Float64(x - t)); else tmp = Float64(x + Float64(y * t)); end return tmp end
function tmp_2 = code(x, y, z, t) tmp = 0.0; if ((z <= -5.3e+17) || ~((z <= 650000000000.0))) tmp = z * (x - t); else tmp = x + (y * t); end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[Or[LessEqual[z, -5.3e+17], N[Not[LessEqual[z, 650000000000.0]], $MachinePrecision]], N[(z * N[(x - t), $MachinePrecision]), $MachinePrecision], N[(x + N[(y * t), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \leq -5.3 \cdot 10^{+17} \lor \neg \left(z \leq 650000000000\right):\\
\;\;\;\;z \cdot \left(x - t\right)\\
\mathbf{else}:\\
\;\;\;\;x + y \cdot t\\
\end{array}
\end{array}
if z < -5.3e17 or 6.5e11 < z Initial program 100.0%
Taylor expanded in y around 0 74.1%
mul-1-neg74.1%
unsub-neg74.1%
Simplified74.1%
Taylor expanded in x around 0 69.5%
sub-neg69.5%
neg-mul-169.5%
remove-double-neg69.5%
+-commutative69.5%
Simplified69.5%
Taylor expanded in z around inf 74.1%
if -5.3e17 < z < 6.5e11Initial program 100.0%
Taylor expanded in t around inf 77.6%
Taylor expanded in y around inf 67.5%
Final simplification70.8%
(FPCore (x y z t) :precision binary64 (if (or (<= t -4.7e-91) (not (<= t 4.5e-42))) (* (- y z) t) (* x (+ z 1.0))))
double code(double x, double y, double z, double t) {
double tmp;
if ((t <= -4.7e-91) || !(t <= 4.5e-42)) {
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 <= (-4.7d-91)) .or. (.not. (t <= 4.5d-42))) 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 <= -4.7e-91) || !(t <= 4.5e-42)) {
tmp = (y - z) * t;
} else {
tmp = x * (z + 1.0);
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if (t <= -4.7e-91) or not (t <= 4.5e-42): tmp = (y - z) * t else: tmp = x * (z + 1.0) return tmp
function code(x, y, z, t) tmp = 0.0 if ((t <= -4.7e-91) || !(t <= 4.5e-42)) 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 <= -4.7e-91) || ~((t <= 4.5e-42))) tmp = (y - z) * t; else tmp = x * (z + 1.0); end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[Or[LessEqual[t, -4.7e-91], N[Not[LessEqual[t, 4.5e-42]], $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 -4.7 \cdot 10^{-91} \lor \neg \left(t \leq 4.5 \cdot 10^{-42}\right):\\
\;\;\;\;\left(y - z\right) \cdot t\\
\mathbf{else}:\\
\;\;\;\;x \cdot \left(z + 1\right)\\
\end{array}
\end{array}
if t < -4.70000000000000006e-91 or 4.5e-42 < t Initial program 100.0%
Taylor expanded in t around inf 84.1%
*-commutative84.1%
sub-neg84.1%
distribute-rgt-in78.7%
Applied egg-rr78.7%
associate-+r+78.7%
distribute-lft-neg-out78.7%
unsub-neg78.7%
+-commutative78.7%
*-commutative78.7%
Applied egg-rr78.7%
Taylor expanded in t around inf 73.5%
if -4.70000000000000006e-91 < t < 4.5e-42Initial program 100.0%
Taylor expanded in y around 0 60.8%
mul-1-neg60.8%
unsub-neg60.8%
Simplified60.8%
Taylor expanded in x around inf 52.7%
sub-neg52.7%
neg-mul-152.7%
remove-double-neg52.7%
+-commutative52.7%
Simplified52.7%
Final simplification66.1%
(FPCore (x y z t) :precision binary64 (if (or (<= y -1.5e-104) (not (<= y 1.55e-40))) (* y t) x))
double code(double x, double y, double z, double t) {
double tmp;
if ((y <= -1.5e-104) || !(y <= 1.55e-40)) {
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.5d-104)) .or. (.not. (y <= 1.55d-40))) 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.5e-104) || !(y <= 1.55e-40)) {
tmp = y * t;
} else {
tmp = x;
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if (y <= -1.5e-104) or not (y <= 1.55e-40): tmp = y * t else: tmp = x return tmp
function code(x, y, z, t) tmp = 0.0 if ((y <= -1.5e-104) || !(y <= 1.55e-40)) 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.5e-104) || ~((y <= 1.55e-40))) tmp = y * t; else tmp = x; end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[Or[LessEqual[y, -1.5e-104], N[Not[LessEqual[y, 1.55e-40]], $MachinePrecision]], N[(y * t), $MachinePrecision], x]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;y \leq -1.5 \cdot 10^{-104} \lor \neg \left(y \leq 1.55 \cdot 10^{-40}\right):\\
\;\;\;\;y \cdot t\\
\mathbf{else}:\\
\;\;\;\;x\\
\end{array}
\end{array}
if y < -1.5000000000000001e-104 or 1.55000000000000005e-40 < y Initial program 100.0%
Taylor expanded in t around inf 61.5%
*-commutative61.5%
sub-neg61.5%
distribute-rgt-in55.8%
Applied egg-rr55.8%
associate-+r+55.8%
distribute-lft-neg-out55.8%
unsub-neg55.8%
+-commutative55.8%
*-commutative55.8%
Applied egg-rr55.8%
Taylor expanded in y around inf 46.0%
if -1.5000000000000001e-104 < y < 1.55000000000000005e-40Initial program 100.0%
Taylor expanded in y around inf 37.9%
*-commutative37.9%
Simplified37.9%
Taylor expanded in y around 0 33.0%
Final simplification41.0%
(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 60.5%
*-commutative60.5%
Simplified60.5%
Taylor expanded in y around 0 15.6%
(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 2024163
(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))))