
(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 11 alternatives:
| Alternative | Accuracy | Speedup |
|---|
(FPCore (x y z t) :precision binary64 (+ x (* (- y z) (- t x))))
double code(double x, double y, double z, double t) {
return x + ((y - z) * (t - x));
}
real(8) function code(x, y, z, t)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
code = x + ((y - z) * (t - x))
end function
public static double code(double x, double y, double z, double t) {
return x + ((y - z) * (t - x));
}
def code(x, y, z, t): return x + ((y - z) * (t - x))
function code(x, y, z, t) return Float64(x + Float64(Float64(y - z) * Float64(t - x))) end
function tmp = code(x, y, z, t) tmp = x + ((y - z) * (t - x)); end
code[x_, y_, z_, t_] := N[(x + N[(N[(y - z), $MachinePrecision] * N[(t - x), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
x + \left(y - z\right) \cdot \left(t - x\right)
\end{array}
(FPCore (x y z t) :precision binary64 (+ x (* (- y z) (- t x))))
double code(double x, double y, double z, double t) {
return x + ((y - z) * (t - x));
}
real(8) function code(x, y, z, t)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
code = x + ((y - z) * (t - x))
end function
public static double code(double x, double y, double z, double t) {
return x + ((y - z) * (t - x));
}
def code(x, y, z, t): return x + ((y - z) * (t - x))
function code(x, y, z, t) return Float64(x + Float64(Float64(y - z) * Float64(t - x))) end
function tmp = code(x, y, z, t) tmp = x + ((y - z) * (t - x)); end
code[x_, y_, z_, t_] := N[(x + N[(N[(y - z), $MachinePrecision] * N[(t - x), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
x + \left(y - z\right) \cdot \left(t - x\right)
\end{array}
Initial program 100.0%
Final simplification100.0%
(FPCore (x y z t)
:precision binary64
(let* ((t_1 (* z (- x t))) (t_2 (* (- y z) t)))
(if (<= z -6.2e+56)
t_1
(if (<= z -4.5e-184)
t_2
(if (<= z 2.1e-236)
x
(if (<= z 7.5e-142) t_2 (if (<= z 3.5e-13) x 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 <= -6.2e+56) {
tmp = t_1;
} else if (z <= -4.5e-184) {
tmp = t_2;
} else if (z <= 2.1e-236) {
tmp = x;
} else if (z <= 7.5e-142) {
tmp = t_2;
} else if (z <= 3.5e-13) {
tmp = x;
} 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 <= (-6.2d+56)) then
tmp = t_1
else if (z <= (-4.5d-184)) then
tmp = t_2
else if (z <= 2.1d-236) then
tmp = x
else if (z <= 7.5d-142) then
tmp = t_2
else if (z <= 3.5d-13) then
tmp = x
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 <= -6.2e+56) {
tmp = t_1;
} else if (z <= -4.5e-184) {
tmp = t_2;
} else if (z <= 2.1e-236) {
tmp = x;
} else if (z <= 7.5e-142) {
tmp = t_2;
} else if (z <= 3.5e-13) {
tmp = x;
} 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 <= -6.2e+56: tmp = t_1 elif z <= -4.5e-184: tmp = t_2 elif z <= 2.1e-236: tmp = x elif z <= 7.5e-142: tmp = t_2 elif z <= 3.5e-13: tmp = x 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 <= -6.2e+56) tmp = t_1; elseif (z <= -4.5e-184) tmp = t_2; elseif (z <= 2.1e-236) tmp = x; elseif (z <= 7.5e-142) tmp = t_2; elseif (z <= 3.5e-13) tmp = x; 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 <= -6.2e+56) tmp = t_1; elseif (z <= -4.5e-184) tmp = t_2; elseif (z <= 2.1e-236) tmp = x; elseif (z <= 7.5e-142) tmp = t_2; elseif (z <= 3.5e-13) tmp = x; 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, -6.2e+56], t$95$1, If[LessEqual[z, -4.5e-184], t$95$2, If[LessEqual[z, 2.1e-236], x, If[LessEqual[z, 7.5e-142], t$95$2, If[LessEqual[z, 3.5e-13], x, 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 -6.2 \cdot 10^{+56}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;z \leq -4.5 \cdot 10^{-184}:\\
\;\;\;\;t\_2\\
\mathbf{elif}\;z \leq 2.1 \cdot 10^{-236}:\\
\;\;\;\;x\\
\mathbf{elif}\;z \leq 7.5 \cdot 10^{-142}:\\
\;\;\;\;t\_2\\
\mathbf{elif}\;z \leq 3.5 \cdot 10^{-13}:\\
\;\;\;\;x\\
\mathbf{else}:\\
\;\;\;\;t\_1\\
\end{array}
\end{array}
if z < -6.20000000000000009e56 or 3.5000000000000002e-13 < z Initial program 100.0%
sub-neg100.0%
distribute-lft-in91.8%
fma-define95.1%
Applied egg-rr95.1%
Taylor expanded in y around 0 91.8%
*-commutative91.8%
Simplified91.8%
Taylor expanded in x around 0 89.4%
Taylor expanded in z around inf 84.6%
neg-mul-184.6%
sub-neg84.6%
Simplified84.6%
if -6.20000000000000009e56 < z < -4.5000000000000001e-184 or 2.09999999999999979e-236 < z < 7.49999999999999958e-142Initial program 100.0%
sub-neg100.0%
distribute-lft-in98.6%
fma-define98.6%
Applied egg-rr98.6%
Taylor expanded in y around 0 82.0%
*-commutative82.0%
Simplified82.0%
Taylor expanded in x around 0 82.0%
Taylor expanded in t around inf 52.7%
if -4.5000000000000001e-184 < z < 2.09999999999999979e-236 or 7.49999999999999958e-142 < z < 3.5000000000000002e-13Initial program 100.0%
Taylor expanded in t around inf 81.7%
Taylor expanded in x around inf 56.7%
Final simplification68.9%
(FPCore (x y z t)
:precision binary64
(let* ((t_1 (* x (- y))))
(if (<= y -7.5e+79)
(* y t)
(if (<= y -2.7e+36)
t_1
(if (<= y -4800000000.0)
(* y t)
(if (<= y 2.5e-180) x (if (<= y 1.25e+106) (* z (- t)) t_1)))))))
double code(double x, double y, double z, double t) {
double t_1 = x * -y;
double tmp;
if (y <= -7.5e+79) {
tmp = y * t;
} else if (y <= -2.7e+36) {
tmp = t_1;
} else if (y <= -4800000000.0) {
tmp = y * t;
} else if (y <= 2.5e-180) {
tmp = x;
} else if (y <= 1.25e+106) {
tmp = z * -t;
} else {
tmp = t_1;
}
return tmp;
}
real(8) function code(x, y, z, t)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
real(8) :: t_1
real(8) :: tmp
t_1 = x * -y
if (y <= (-7.5d+79)) then
tmp = y * t
else if (y <= (-2.7d+36)) then
tmp = t_1
else if (y <= (-4800000000.0d0)) then
tmp = y * t
else if (y <= 2.5d-180) then
tmp = x
else if (y <= 1.25d+106) then
tmp = z * -t
else
tmp = t_1
end if
code = tmp
end function
public static double code(double x, double y, double z, double t) {
double t_1 = x * -y;
double tmp;
if (y <= -7.5e+79) {
tmp = y * t;
} else if (y <= -2.7e+36) {
tmp = t_1;
} else if (y <= -4800000000.0) {
tmp = y * t;
} else if (y <= 2.5e-180) {
tmp = x;
} else if (y <= 1.25e+106) {
tmp = z * -t;
} else {
tmp = t_1;
}
return tmp;
}
def code(x, y, z, t): t_1 = x * -y tmp = 0 if y <= -7.5e+79: tmp = y * t elif y <= -2.7e+36: tmp = t_1 elif y <= -4800000000.0: tmp = y * t elif y <= 2.5e-180: tmp = x elif y <= 1.25e+106: tmp = z * -t else: tmp = t_1 return tmp
function code(x, y, z, t) t_1 = Float64(x * Float64(-y)) tmp = 0.0 if (y <= -7.5e+79) tmp = Float64(y * t); elseif (y <= -2.7e+36) tmp = t_1; elseif (y <= -4800000000.0) tmp = Float64(y * t); elseif (y <= 2.5e-180) tmp = x; elseif (y <= 1.25e+106) tmp = Float64(z * Float64(-t)); else tmp = t_1; end return tmp end
function tmp_2 = code(x, y, z, t) t_1 = x * -y; tmp = 0.0; if (y <= -7.5e+79) tmp = y * t; elseif (y <= -2.7e+36) tmp = t_1; elseif (y <= -4800000000.0) tmp = y * t; elseif (y <= 2.5e-180) tmp = x; elseif (y <= 1.25e+106) tmp = z * -t; else tmp = t_1; end tmp_2 = tmp; end
code[x_, y_, z_, t_] := Block[{t$95$1 = N[(x * (-y)), $MachinePrecision]}, If[LessEqual[y, -7.5e+79], N[(y * t), $MachinePrecision], If[LessEqual[y, -2.7e+36], t$95$1, If[LessEqual[y, -4800000000.0], N[(y * t), $MachinePrecision], If[LessEqual[y, 2.5e-180], x, If[LessEqual[y, 1.25e+106], N[(z * (-t)), $MachinePrecision], t$95$1]]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := x \cdot \left(-y\right)\\
\mathbf{if}\;y \leq -7.5 \cdot 10^{+79}:\\
\;\;\;\;y \cdot t\\
\mathbf{elif}\;y \leq -2.7 \cdot 10^{+36}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;y \leq -4800000000:\\
\;\;\;\;y \cdot t\\
\mathbf{elif}\;y \leq 2.5 \cdot 10^{-180}:\\
\;\;\;\;x\\
\mathbf{elif}\;y \leq 1.25 \cdot 10^{+106}:\\
\;\;\;\;z \cdot \left(-t\right)\\
\mathbf{else}:\\
\;\;\;\;t\_1\\
\end{array}
\end{array}
if y < -7.49999999999999967e79 or -2.7000000000000001e36 < y < -4.8e9Initial program 100.0%
sub-neg100.0%
distribute-lft-in93.0%
fma-define95.3%
Applied egg-rr95.3%
Taylor expanded in y around 0 78.8%
*-commutative78.8%
Simplified78.8%
Taylor expanded in x around 0 76.5%
Taylor expanded in y around inf 56.2%
if -7.49999999999999967e79 < y < -2.7000000000000001e36 or 1.25e106 < y Initial program 100.0%
Taylor expanded in t around 0 65.8%
mul-1-neg65.8%
distribute-lft-neg-out65.8%
*-commutative65.8%
Simplified65.8%
Taylor expanded in y around inf 50.7%
associate-*r*50.7%
mul-1-neg50.7%
Simplified50.7%
if -4.8e9 < y < 2.5000000000000001e-180Initial program 100.0%
Taylor expanded in t around inf 69.3%
Taylor expanded in x around inf 43.0%
if 2.5000000000000001e-180 < y < 1.25e106Initial program 99.9%
Taylor expanded in t around inf 80.1%
Taylor expanded in y around 0 64.5%
mul-1-neg64.5%
unsub-neg64.5%
Simplified64.5%
Taylor expanded in x around 0 47.1%
associate-*r*47.1%
neg-mul-147.1%
Simplified47.1%
Final simplification47.7%
(FPCore (x y z t) :precision binary64 (if (<= y -2250000000.0) (* y t) (if (<= y 3.2e-183) x (if (<= y 1.96e+87) (* z (- t)) (* y t)))))
double code(double x, double y, double z, double t) {
double tmp;
if (y <= -2250000000.0) {
tmp = y * t;
} else if (y <= 3.2e-183) {
tmp = x;
} else if (y <= 1.96e+87) {
tmp = z * -t;
} 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 <= (-2250000000.0d0)) then
tmp = y * t
else if (y <= 3.2d-183) then
tmp = x
else if (y <= 1.96d+87) then
tmp = z * -t
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 <= -2250000000.0) {
tmp = y * t;
} else if (y <= 3.2e-183) {
tmp = x;
} else if (y <= 1.96e+87) {
tmp = z * -t;
} else {
tmp = y * t;
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if y <= -2250000000.0: tmp = y * t elif y <= 3.2e-183: tmp = x elif y <= 1.96e+87: tmp = z * -t else: tmp = y * t return tmp
function code(x, y, z, t) tmp = 0.0 if (y <= -2250000000.0) tmp = Float64(y * t); elseif (y <= 3.2e-183) tmp = x; elseif (y <= 1.96e+87) tmp = Float64(z * Float64(-t)); else tmp = Float64(y * t); end return tmp end
function tmp_2 = code(x, y, z, t) tmp = 0.0; if (y <= -2250000000.0) tmp = y * t; elseif (y <= 3.2e-183) tmp = x; elseif (y <= 1.96e+87) tmp = z * -t; else tmp = y * t; end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[LessEqual[y, -2250000000.0], N[(y * t), $MachinePrecision], If[LessEqual[y, 3.2e-183], x, If[LessEqual[y, 1.96e+87], N[(z * (-t)), $MachinePrecision], N[(y * t), $MachinePrecision]]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;y \leq -2250000000:\\
\;\;\;\;y \cdot t\\
\mathbf{elif}\;y \leq 3.2 \cdot 10^{-183}:\\
\;\;\;\;x\\
\mathbf{elif}\;y \leq 1.96 \cdot 10^{+87}:\\
\;\;\;\;z \cdot \left(-t\right)\\
\mathbf{else}:\\
\;\;\;\;y \cdot t\\
\end{array}
\end{array}
if y < -2.25e9 or 1.96e87 < y Initial program 100.0%
sub-neg100.0%
distribute-lft-in93.8%
fma-define95.9%
Applied egg-rr95.9%
Taylor expanded in y around 0 70.3%
*-commutative70.3%
Simplified70.3%
Taylor expanded in x around 0 69.2%
Taylor expanded in y around inf 44.3%
if -2.25e9 < y < 3.2000000000000002e-183Initial program 100.0%
Taylor expanded in t around inf 69.3%
Taylor expanded in x around inf 43.0%
if 3.2000000000000002e-183 < y < 1.96e87Initial program 99.9%
Taylor expanded in t around inf 80.4%
Taylor expanded in y around 0 67.2%
mul-1-neg67.2%
unsub-neg67.2%
Simplified67.2%
Taylor expanded in x around 0 48.6%
associate-*r*48.6%
neg-mul-148.6%
Simplified48.6%
Final simplification44.7%
(FPCore (x y z t) :precision binary64 (if (or (<= (- y z) -5e-7) (not (<= (- y z) 1.3e-23))) (* (- y z) t) x))
double code(double x, double y, double z, double t) {
double tmp;
if (((y - z) <= -5e-7) || !((y - z) <= 1.3e-23)) {
tmp = (y - z) * 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 - z) <= (-5d-7)) .or. (.not. ((y - z) <= 1.3d-23))) then
tmp = (y - z) * 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 - z) <= -5e-7) || !((y - z) <= 1.3e-23)) {
tmp = (y - z) * t;
} else {
tmp = x;
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if ((y - z) <= -5e-7) or not ((y - z) <= 1.3e-23): tmp = (y - z) * t else: tmp = x return tmp
function code(x, y, z, t) tmp = 0.0 if ((Float64(y - z) <= -5e-7) || !(Float64(y - z) <= 1.3e-23)) tmp = Float64(Float64(y - z) * t); else tmp = x; end return tmp end
function tmp_2 = code(x, y, z, t) tmp = 0.0; if (((y - z) <= -5e-7) || ~(((y - z) <= 1.3e-23))) tmp = (y - z) * t; else tmp = x; end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[Or[LessEqual[N[(y - z), $MachinePrecision], -5e-7], N[Not[LessEqual[N[(y - z), $MachinePrecision], 1.3e-23]], $MachinePrecision]], N[(N[(y - z), $MachinePrecision] * t), $MachinePrecision], x]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;y - z \leq -5 \cdot 10^{-7} \lor \neg \left(y - z \leq 1.3 \cdot 10^{-23}\right):\\
\;\;\;\;\left(y - z\right) \cdot t\\
\mathbf{else}:\\
\;\;\;\;x\\
\end{array}
\end{array}
if (-.f64 y z) < -4.99999999999999977e-7 or 1.3e-23 < (-.f64 y z) Initial program 100.0%
sub-neg100.0%
distribute-lft-in94.0%
fma-define96.2%
Applied egg-rr96.2%
Taylor expanded in y around 0 81.6%
*-commutative81.6%
Simplified81.6%
Taylor expanded in x around 0 80.0%
Taylor expanded in t around inf 51.5%
if -4.99999999999999977e-7 < (-.f64 y z) < 1.3e-23Initial program 100.0%
Taylor expanded in t around inf 99.8%
Taylor expanded in x around inf 72.5%
Final simplification57.3%
(FPCore (x y z t) :precision binary64 (if (or (<= z -1.65e+56) (not (<= z 1.05e+24))) (* z (- x t)) (- x (* t (- z y)))))
double code(double x, double y, double z, double t) {
double tmp;
if ((z <= -1.65e+56) || !(z <= 1.05e+24)) {
tmp = z * (x - t);
} else {
tmp = x - (t * (z - 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 ((z <= (-1.65d+56)) .or. (.not. (z <= 1.05d+24))) then
tmp = z * (x - t)
else
tmp = x - (t * (z - y))
end if
code = tmp
end function
public static double code(double x, double y, double z, double t) {
double tmp;
if ((z <= -1.65e+56) || !(z <= 1.05e+24)) {
tmp = z * (x - t);
} else {
tmp = x - (t * (z - y));
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if (z <= -1.65e+56) or not (z <= 1.05e+24): tmp = z * (x - t) else: tmp = x - (t * (z - y)) return tmp
function code(x, y, z, t) tmp = 0.0 if ((z <= -1.65e+56) || !(z <= 1.05e+24)) tmp = Float64(z * Float64(x - t)); else tmp = Float64(x - Float64(t * Float64(z - y))); end return tmp end
function tmp_2 = code(x, y, z, t) tmp = 0.0; if ((z <= -1.65e+56) || ~((z <= 1.05e+24))) tmp = z * (x - t); else tmp = x - (t * (z - y)); end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[Or[LessEqual[z, -1.65e+56], N[Not[LessEqual[z, 1.05e+24]], $MachinePrecision]], N[(z * N[(x - t), $MachinePrecision]), $MachinePrecision], N[(x - N[(t * N[(z - y), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \leq -1.65 \cdot 10^{+56} \lor \neg \left(z \leq 1.05 \cdot 10^{+24}\right):\\
\;\;\;\;z \cdot \left(x - t\right)\\
\mathbf{else}:\\
\;\;\;\;x - t \cdot \left(z - y\right)\\
\end{array}
\end{array}
if z < -1.65000000000000001e56 or 1.0500000000000001e24 < z Initial program 100.0%
sub-neg100.0%
distribute-lft-in93.0%
fma-define96.5%
Applied egg-rr96.5%
Taylor expanded in y around 0 92.1%
*-commutative92.1%
Simplified92.1%
Taylor expanded in x around 0 89.5%
Taylor expanded in z around inf 89.0%
neg-mul-189.0%
sub-neg89.0%
Simplified89.0%
if -1.65000000000000001e56 < z < 1.0500000000000001e24Initial program 100.0%
Taylor expanded in t around inf 79.7%
Final simplification83.9%
(FPCore (x y z t) :precision binary64 (if (or (<= z -5.8e+51) (not (<= z 9e+23))) (* z (- x t)) (- x (* y (- x t)))))
double code(double x, double y, double z, double t) {
double tmp;
if ((z <= -5.8e+51) || !(z <= 9e+23)) {
tmp = z * (x - t);
} else {
tmp = x - (y * (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 ((z <= (-5.8d+51)) .or. (.not. (z <= 9d+23))) then
tmp = z * (x - t)
else
tmp = x - (y * (x - t))
end if
code = tmp
end function
public static double code(double x, double y, double z, double t) {
double tmp;
if ((z <= -5.8e+51) || !(z <= 9e+23)) {
tmp = z * (x - t);
} else {
tmp = x - (y * (x - t));
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if (z <= -5.8e+51) or not (z <= 9e+23): tmp = z * (x - t) else: tmp = x - (y * (x - t)) return tmp
function code(x, y, z, t) tmp = 0.0 if ((z <= -5.8e+51) || !(z <= 9e+23)) tmp = Float64(z * Float64(x - t)); else tmp = Float64(x - Float64(y * Float64(x - t))); end return tmp end
function tmp_2 = code(x, y, z, t) tmp = 0.0; if ((z <= -5.8e+51) || ~((z <= 9e+23))) tmp = z * (x - t); else tmp = x - (y * (x - t)); end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[Or[LessEqual[z, -5.8e+51], N[Not[LessEqual[z, 9e+23]], $MachinePrecision]], N[(z * N[(x - t), $MachinePrecision]), $MachinePrecision], N[(x - N[(y * N[(x - t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \leq -5.8 \cdot 10^{+51} \lor \neg \left(z \leq 9 \cdot 10^{+23}\right):\\
\;\;\;\;z \cdot \left(x - t\right)\\
\mathbf{else}:\\
\;\;\;\;x - y \cdot \left(x - t\right)\\
\end{array}
\end{array}
if z < -5.7999999999999997e51 or 8.99999999999999958e23 < z Initial program 100.0%
sub-neg100.0%
distribute-lft-in93.1%
fma-define96.6%
Applied egg-rr96.6%
Taylor expanded in y around 0 92.2%
*-commutative92.2%
Simplified92.2%
Taylor expanded in x around 0 89.7%
Taylor expanded in z around inf 88.4%
neg-mul-188.4%
sub-neg88.4%
Simplified88.4%
if -5.7999999999999997e51 < z < 8.99999999999999958e23Initial program 100.0%
Taylor expanded in y around inf 88.1%
*-commutative88.1%
Simplified88.1%
Final simplification88.2%
(FPCore (x y z t) :precision binary64 (let* ((t_1 (* z (- x t)))) (if (<= z -9.8e+51) t_1 (if (<= z 9e+23) (- x (* y (- x t))) (+ x t_1)))))
double code(double x, double y, double z, double t) {
double t_1 = z * (x - t);
double tmp;
if (z <= -9.8e+51) {
tmp = t_1;
} else if (z <= 9e+23) {
tmp = x - (y * (x - t));
} else {
tmp = x + 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 = z * (x - t)
if (z <= (-9.8d+51)) then
tmp = t_1
else if (z <= 9d+23) then
tmp = x - (y * (x - t))
else
tmp = x + 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 tmp;
if (z <= -9.8e+51) {
tmp = t_1;
} else if (z <= 9e+23) {
tmp = x - (y * (x - t));
} else {
tmp = x + t_1;
}
return tmp;
}
def code(x, y, z, t): t_1 = z * (x - t) tmp = 0 if z <= -9.8e+51: tmp = t_1 elif z <= 9e+23: tmp = x - (y * (x - t)) else: tmp = x + t_1 return tmp
function code(x, y, z, t) t_1 = Float64(z * Float64(x - t)) tmp = 0.0 if (z <= -9.8e+51) tmp = t_1; elseif (z <= 9e+23) tmp = Float64(x - Float64(y * Float64(x - t))); else tmp = Float64(x + t_1); end return tmp end
function tmp_2 = code(x, y, z, t) t_1 = z * (x - t); tmp = 0.0; if (z <= -9.8e+51) tmp = t_1; elseif (z <= 9e+23) tmp = x - (y * (x - t)); else tmp = x + t_1; end tmp_2 = tmp; end
code[x_, y_, z_, t_] := Block[{t$95$1 = N[(z * N[(x - t), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[z, -9.8e+51], t$95$1, If[LessEqual[z, 9e+23], N[(x - N[(y * N[(x - t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(x + t$95$1), $MachinePrecision]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := z \cdot \left(x - t\right)\\
\mathbf{if}\;z \leq -9.8 \cdot 10^{+51}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;z \leq 9 \cdot 10^{+23}:\\
\;\;\;\;x - y \cdot \left(x - t\right)\\
\mathbf{else}:\\
\;\;\;\;x + t\_1\\
\end{array}
\end{array}
if z < -9.79999999999999967e51Initial program 100.0%
sub-neg100.0%
distribute-lft-in92.5%
fma-define96.2%
Applied egg-rr96.2%
Taylor expanded in y around 0 92.6%
*-commutative92.6%
Simplified92.6%
Taylor expanded in x around 0 88.8%
Taylor expanded in z around inf 90.9%
neg-mul-190.9%
sub-neg90.9%
Simplified90.9%
if -9.79999999999999967e51 < z < 8.99999999999999958e23Initial program 100.0%
Taylor expanded in y around inf 88.1%
*-commutative88.1%
Simplified88.1%
if 8.99999999999999958e23 < z Initial program 99.9%
Taylor expanded in y around 0 86.3%
mul-1-neg86.3%
distribute-lft-neg-out86.3%
*-commutative86.3%
Simplified86.3%
Taylor expanded in z around 0 86.3%
mul-1-neg86.3%
unsub-neg86.3%
Simplified86.3%
Final simplification88.2%
(FPCore (x y z t) :precision binary64 (if (or (<= z -6.2e-16) (not (<= z 9e+23))) (* z (- x t)) (+ x (* y t))))
double code(double x, double y, double z, double t) {
double tmp;
if ((z <= -6.2e-16) || !(z <= 9e+23)) {
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 <= (-6.2d-16)) .or. (.not. (z <= 9d+23))) 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 <= -6.2e-16) || !(z <= 9e+23)) {
tmp = z * (x - t);
} else {
tmp = x + (y * t);
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if (z <= -6.2e-16) or not (z <= 9e+23): tmp = z * (x - t) else: tmp = x + (y * t) return tmp
function code(x, y, z, t) tmp = 0.0 if ((z <= -6.2e-16) || !(z <= 9e+23)) 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 <= -6.2e-16) || ~((z <= 9e+23))) tmp = z * (x - t); else tmp = x + (y * t); end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[Or[LessEqual[z, -6.2e-16], N[Not[LessEqual[z, 9e+23]], $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 -6.2 \cdot 10^{-16} \lor \neg \left(z \leq 9 \cdot 10^{+23}\right):\\
\;\;\;\;z \cdot \left(x - t\right)\\
\mathbf{else}:\\
\;\;\;\;x + y \cdot t\\
\end{array}
\end{array}
if z < -6.2000000000000002e-16 or 8.99999999999999958e23 < z Initial program 100.0%
sub-neg100.0%
distribute-lft-in93.1%
fma-define96.1%
Applied egg-rr96.1%
Taylor expanded in y around 0 89.4%
*-commutative89.4%
Simplified89.4%
Taylor expanded in x around 0 87.1%
Taylor expanded in z around inf 83.1%
neg-mul-183.1%
sub-neg83.1%
Simplified83.1%
if -6.2000000000000002e-16 < z < 8.99999999999999958e23Initial program 100.0%
Taylor expanded in t around inf 82.3%
Taylor expanded in y around inf 74.6%
Final simplification79.0%
(FPCore (x y z t) :precision binary64 (if (or (<= y -2250000000.0) (not (<= y 1.3e-23))) (* y t) x))
double code(double x, double y, double z, double t) {
double tmp;
if ((y <= -2250000000.0) || !(y <= 1.3e-23)) {
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 <= (-2250000000.0d0)) .or. (.not. (y <= 1.3d-23))) 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 <= -2250000000.0) || !(y <= 1.3e-23)) {
tmp = y * t;
} else {
tmp = x;
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if (y <= -2250000000.0) or not (y <= 1.3e-23): tmp = y * t else: tmp = x return tmp
function code(x, y, z, t) tmp = 0.0 if ((y <= -2250000000.0) || !(y <= 1.3e-23)) tmp = Float64(y * t); else tmp = x; end return tmp end
function tmp_2 = code(x, y, z, t) tmp = 0.0; if ((y <= -2250000000.0) || ~((y <= 1.3e-23))) tmp = y * t; else tmp = x; end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[Or[LessEqual[y, -2250000000.0], N[Not[LessEqual[y, 1.3e-23]], $MachinePrecision]], N[(y * t), $MachinePrecision], x]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;y \leq -2250000000 \lor \neg \left(y \leq 1.3 \cdot 10^{-23}\right):\\
\;\;\;\;y \cdot t\\
\mathbf{else}:\\
\;\;\;\;x\\
\end{array}
\end{array}
if y < -2.25e9 or 1.3e-23 < y Initial program 100.0%
sub-neg100.0%
distribute-lft-in94.6%
fma-define96.4%
Applied egg-rr96.4%
Taylor expanded in y around 0 73.1%
*-commutative73.1%
Simplified73.1%
Taylor expanded in x around 0 72.2%
Taylor expanded in y around inf 42.8%
if -2.25e9 < y < 1.3e-23Initial program 100.0%
Taylor expanded in t around inf 73.4%
Taylor expanded in x around inf 38.2%
Final simplification40.3%
(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 65.7%
Taylor expanded in x around inf 22.8%
Final simplification22.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 2024059
(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))))