
(FPCore (x y z t) :precision binary64 (+ x (* (- y z) (- t x))))
double code(double x, double y, double z, double t) {
return x + ((y - z) * (t - x));
}
real(8) function code(x, y, z, t)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
code = x + ((y - z) * (t - x))
end function
public static double code(double x, double y, double z, double t) {
return x + ((y - z) * (t - x));
}
def code(x, y, z, t): return x + ((y - z) * (t - x))
function code(x, y, z, t) return Float64(x + Float64(Float64(y - z) * Float64(t - x))) end
function tmp = code(x, y, z, t) tmp = x + ((y - z) * (t - x)); end
code[x_, y_, z_, t_] := N[(x + N[(N[(y - z), $MachinePrecision] * N[(t - x), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
x + \left(y - z\right) \cdot \left(t - x\right)
\end{array}
Sampling outcomes in binary64 precision:
Herbie found 13 alternatives:
| Alternative | Accuracy | Speedup |
|---|
(FPCore (x y z t) :precision binary64 (+ x (* (- y z) (- t x))))
double code(double x, double y, double z, double t) {
return x + ((y - z) * (t - x));
}
real(8) function code(x, y, z, t)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
code = x + ((y - z) * (t - x))
end function
public static double code(double x, double y, double z, double t) {
return x + ((y - z) * (t - x));
}
def code(x, y, z, t): return x + ((y - z) * (t - x))
function code(x, y, z, t) return Float64(x + Float64(Float64(y - z) * Float64(t - x))) end
function tmp = code(x, y, z, t) tmp = x + ((y - z) * (t - x)); end
code[x_, y_, z_, t_] := N[(x + N[(N[(y - z), $MachinePrecision] * N[(t - x), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
x + \left(y - z\right) \cdot \left(t - x\right)
\end{array}
(FPCore (x y z t) :precision binary64 (fma (- y z) (- t x) x))
double code(double x, double y, double z, double t) {
return fma((y - z), (t - x), x);
}
function code(x, y, z, t) return fma(Float64(y - z), Float64(t - x), x) end
code[x_, y_, z_, t_] := N[(N[(y - z), $MachinePrecision] * N[(t - x), $MachinePrecision] + x), $MachinePrecision]
\begin{array}{l}
\\
\mathsf{fma}\left(y - z, t - x, x\right)
\end{array}
Initial program 100.0%
+-commutative100.0%
fma-define100.0%
Simplified100.0%
(FPCore (x y z t)
:precision binary64
(let* ((t_1 (* z (- t))) (t_2 (- (* y x))))
(if (<= y -3.6e+159)
t_2
(if (<= y -9.4e+52)
(* y t)
(if (<= y -7e-65)
t_1
(if (<= y -1.4e-283) x (if (<= y 1.05e+136) t_1 t_2)))))))
double code(double x, double y, double z, double t) {
double t_1 = z * -t;
double t_2 = -(y * x);
double tmp;
if (y <= -3.6e+159) {
tmp = t_2;
} else if (y <= -9.4e+52) {
tmp = y * t;
} else if (y <= -7e-65) {
tmp = t_1;
} else if (y <= -1.4e-283) {
tmp = x;
} else if (y <= 1.05e+136) {
tmp = t_1;
} else {
tmp = t_2;
}
return tmp;
}
real(8) function code(x, y, z, t)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
real(8) :: t_1
real(8) :: t_2
real(8) :: tmp
t_1 = z * -t
t_2 = -(y * x)
if (y <= (-3.6d+159)) then
tmp = t_2
else if (y <= (-9.4d+52)) then
tmp = y * t
else if (y <= (-7d-65)) then
tmp = t_1
else if (y <= (-1.4d-283)) then
tmp = x
else if (y <= 1.05d+136) then
tmp = t_1
else
tmp = t_2
end if
code = tmp
end function
public static double code(double x, double y, double z, double t) {
double t_1 = z * -t;
double t_2 = -(y * x);
double tmp;
if (y <= -3.6e+159) {
tmp = t_2;
} else if (y <= -9.4e+52) {
tmp = y * t;
} else if (y <= -7e-65) {
tmp = t_1;
} else if (y <= -1.4e-283) {
tmp = x;
} else if (y <= 1.05e+136) {
tmp = t_1;
} else {
tmp = t_2;
}
return tmp;
}
def code(x, y, z, t): t_1 = z * -t t_2 = -(y * x) tmp = 0 if y <= -3.6e+159: tmp = t_2 elif y <= -9.4e+52: tmp = y * t elif y <= -7e-65: tmp = t_1 elif y <= -1.4e-283: tmp = x elif y <= 1.05e+136: tmp = t_1 else: tmp = t_2 return tmp
function code(x, y, z, t) t_1 = Float64(z * Float64(-t)) t_2 = Float64(-Float64(y * x)) tmp = 0.0 if (y <= -3.6e+159) tmp = t_2; elseif (y <= -9.4e+52) tmp = Float64(y * t); elseif (y <= -7e-65) tmp = t_1; elseif (y <= -1.4e-283) tmp = x; elseif (y <= 1.05e+136) tmp = t_1; else tmp = t_2; end return tmp end
function tmp_2 = code(x, y, z, t) t_1 = z * -t; t_2 = -(y * x); tmp = 0.0; if (y <= -3.6e+159) tmp = t_2; elseif (y <= -9.4e+52) tmp = y * t; elseif (y <= -7e-65) tmp = t_1; elseif (y <= -1.4e-283) tmp = x; elseif (y <= 1.05e+136) tmp = t_1; else tmp = t_2; end tmp_2 = tmp; end
code[x_, y_, z_, t_] := Block[{t$95$1 = N[(z * (-t)), $MachinePrecision]}, Block[{t$95$2 = (-N[(y * x), $MachinePrecision])}, If[LessEqual[y, -3.6e+159], t$95$2, If[LessEqual[y, -9.4e+52], N[(y * t), $MachinePrecision], If[LessEqual[y, -7e-65], t$95$1, If[LessEqual[y, -1.4e-283], x, If[LessEqual[y, 1.05e+136], t$95$1, t$95$2]]]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := z \cdot \left(-t\right)\\
t_2 := -y \cdot x\\
\mathbf{if}\;y \leq -3.6 \cdot 10^{+159}:\\
\;\;\;\;t\_2\\
\mathbf{elif}\;y \leq -9.4 \cdot 10^{+52}:\\
\;\;\;\;y \cdot t\\
\mathbf{elif}\;y \leq -7 \cdot 10^{-65}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;y \leq -1.4 \cdot 10^{-283}:\\
\;\;\;\;x\\
\mathbf{elif}\;y \leq 1.05 \cdot 10^{+136}:\\
\;\;\;\;t\_1\\
\mathbf{else}:\\
\;\;\;\;t\_2\\
\end{array}
\end{array}
if y < -3.60000000000000037e159 or 1.05e136 < y Initial program 100.0%
Taylor expanded in x around inf 67.0%
mul-1-neg67.0%
unsub-neg67.0%
Simplified67.0%
Taylor expanded in y around inf 62.4%
neg-mul-162.4%
Simplified62.4%
if -3.60000000000000037e159 < y < -9.3999999999999999e52Initial program 99.9%
Taylor expanded in t around inf 61.7%
Taylor expanded in z around inf 51.7%
Taylor expanded in z around 0 61.7%
associate-+r+61.7%
mul-1-neg61.7%
sub-neg61.7%
Simplified61.7%
Taylor expanded in y around inf 56.1%
if -9.3999999999999999e52 < y < -7.00000000000000009e-65 or -1.3999999999999999e-283 < y < 1.05e136Initial program 100.0%
Taylor expanded in t around inf 69.5%
Taylor expanded in z around inf 69.5%
Taylor expanded in z around 0 68.6%
associate-+r+68.6%
mul-1-neg68.6%
sub-neg68.6%
Simplified68.6%
Taylor expanded in z around inf 39.7%
mul-1-neg39.7%
distribute-rgt-neg-out39.7%
Simplified39.7%
if -7.00000000000000009e-65 < y < -1.3999999999999999e-283Initial program 100.0%
Taylor expanded in y around inf 58.8%
*-commutative58.8%
Simplified58.8%
Taylor expanded in y around 0 49.3%
Final simplification49.5%
(FPCore (x y z t)
:precision binary64
(let* ((t_1 (* z (- t))))
(if (<= z -9e+72)
(* z x)
(if (<= z -4.6e-39)
t_1
(if (<= z 1.85e-45)
x
(if (<= z 2.1e+55) (* y t) (if (<= z 1.16e+191) (* z x) t_1)))))))
double code(double x, double y, double z, double t) {
double t_1 = z * -t;
double tmp;
if (z <= -9e+72) {
tmp = z * x;
} else if (z <= -4.6e-39) {
tmp = t_1;
} else if (z <= 1.85e-45) {
tmp = x;
} else if (z <= 2.1e+55) {
tmp = y * t;
} else if (z <= 1.16e+191) {
tmp = z * 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) :: tmp
t_1 = z * -t
if (z <= (-9d+72)) then
tmp = z * x
else if (z <= (-4.6d-39)) then
tmp = t_1
else if (z <= 1.85d-45) then
tmp = x
else if (z <= 2.1d+55) then
tmp = y * t
else if (z <= 1.16d+191) then
tmp = z * 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 * -t;
double tmp;
if (z <= -9e+72) {
tmp = z * x;
} else if (z <= -4.6e-39) {
tmp = t_1;
} else if (z <= 1.85e-45) {
tmp = x;
} else if (z <= 2.1e+55) {
tmp = y * t;
} else if (z <= 1.16e+191) {
tmp = z * x;
} else {
tmp = t_1;
}
return tmp;
}
def code(x, y, z, t): t_1 = z * -t tmp = 0 if z <= -9e+72: tmp = z * x elif z <= -4.6e-39: tmp = t_1 elif z <= 1.85e-45: tmp = x elif z <= 2.1e+55: tmp = y * t elif z <= 1.16e+191: tmp = z * x else: tmp = t_1 return tmp
function code(x, y, z, t) t_1 = Float64(z * Float64(-t)) tmp = 0.0 if (z <= -9e+72) tmp = Float64(z * x); elseif (z <= -4.6e-39) tmp = t_1; elseif (z <= 1.85e-45) tmp = x; elseif (z <= 2.1e+55) tmp = Float64(y * t); elseif (z <= 1.16e+191) tmp = Float64(z * x); else tmp = t_1; end return tmp end
function tmp_2 = code(x, y, z, t) t_1 = z * -t; tmp = 0.0; if (z <= -9e+72) tmp = z * x; elseif (z <= -4.6e-39) tmp = t_1; elseif (z <= 1.85e-45) tmp = x; elseif (z <= 2.1e+55) tmp = y * t; elseif (z <= 1.16e+191) tmp = z * x; else tmp = t_1; end tmp_2 = tmp; end
code[x_, y_, z_, t_] := Block[{t$95$1 = N[(z * (-t)), $MachinePrecision]}, If[LessEqual[z, -9e+72], N[(z * x), $MachinePrecision], If[LessEqual[z, -4.6e-39], t$95$1, If[LessEqual[z, 1.85e-45], x, If[LessEqual[z, 2.1e+55], N[(y * t), $MachinePrecision], If[LessEqual[z, 1.16e+191], N[(z * x), $MachinePrecision], t$95$1]]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := z \cdot \left(-t\right)\\
\mathbf{if}\;z \leq -9 \cdot 10^{+72}:\\
\;\;\;\;z \cdot x\\
\mathbf{elif}\;z \leq -4.6 \cdot 10^{-39}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;z \leq 1.85 \cdot 10^{-45}:\\
\;\;\;\;x\\
\mathbf{elif}\;z \leq 2.1 \cdot 10^{+55}:\\
\;\;\;\;y \cdot t\\
\mathbf{elif}\;z \leq 1.16 \cdot 10^{+191}:\\
\;\;\;\;z \cdot x\\
\mathbf{else}:\\
\;\;\;\;t\_1\\
\end{array}
\end{array}
if z < -8.9999999999999997e72 or 2.1000000000000001e55 < z < 1.15999999999999996e191Initial program 100.0%
Taylor expanded in x around inf 58.5%
mul-1-neg58.5%
unsub-neg58.5%
Simplified58.5%
Taylor expanded in z around inf 51.1%
if -8.9999999999999997e72 < z < -4.60000000000000016e-39 or 1.15999999999999996e191 < z Initial program 100.0%
Taylor expanded in t around inf 71.4%
Taylor expanded in z around inf 71.4%
Taylor expanded in z around 0 64.7%
associate-+r+64.7%
mul-1-neg64.7%
sub-neg64.7%
Simplified64.7%
Taylor expanded in z around inf 57.2%
mul-1-neg57.2%
distribute-rgt-neg-out57.2%
Simplified57.2%
if -4.60000000000000016e-39 < z < 1.85e-45Initial program 100.0%
Taylor expanded in y around inf 95.2%
*-commutative95.2%
Simplified95.2%
Taylor expanded in y around 0 39.4%
if 1.85e-45 < z < 2.1000000000000001e55Initial program 99.9%
Taylor expanded in t around inf 62.6%
Taylor expanded in z around inf 62.5%
Taylor expanded in z around 0 62.6%
associate-+r+62.6%
mul-1-neg62.6%
sub-neg62.6%
Simplified62.6%
Taylor expanded in y around inf 48.4%
Final simplification47.0%
(FPCore (x y z t) :precision binary64 (if (or (<= y -2.15e+51) (not (<= y 52000.0))) (+ x (* y (- t x))) (+ x (* z (- x t)))))
double code(double x, double y, double z, double t) {
double tmp;
if ((y <= -2.15e+51) || !(y <= 52000.0)) {
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 <= (-2.15d+51)) .or. (.not. (y <= 52000.0d0))) 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 <= -2.15e+51) || !(y <= 52000.0)) {
tmp = x + (y * (t - x));
} else {
tmp = x + (z * (x - t));
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if (y <= -2.15e+51) or not (y <= 52000.0): tmp = x + (y * (t - x)) else: tmp = x + (z * (x - t)) return tmp
function code(x, y, z, t) tmp = 0.0 if ((y <= -2.15e+51) || !(y <= 52000.0)) 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 <= -2.15e+51) || ~((y <= 52000.0))) 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, -2.15e+51], N[Not[LessEqual[y, 52000.0]], $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 -2.15 \cdot 10^{+51} \lor \neg \left(y \leq 52000\right):\\
\;\;\;\;x + y \cdot \left(t - x\right)\\
\mathbf{else}:\\
\;\;\;\;x + z \cdot \left(x - t\right)\\
\end{array}
\end{array}
if y < -2.1499999999999999e51 or 52000 < y Initial program 100.0%
Taylor expanded in y around inf 84.3%
*-commutative84.3%
Simplified84.3%
if -2.1499999999999999e51 < y < 52000Initial program 100.0%
Taylor expanded in y around 0 92.1%
mul-1-neg92.1%
unsub-neg92.1%
Simplified92.1%
Final simplification88.3%
(FPCore (x y z t) :precision binary64 (if (or (<= x -1.5e-97) (not (<= x 8000000000000.0))) (* x (+ (- z y) 1.0)) (- x (* t (- z y)))))
double code(double x, double y, double z, double t) {
double tmp;
if ((x <= -1.5e-97) || !(x <= 8000000000000.0)) {
tmp = x * ((z - y) + 1.0);
} 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 ((x <= (-1.5d-97)) .or. (.not. (x <= 8000000000000.0d0))) then
tmp = x * ((z - y) + 1.0d0)
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 ((x <= -1.5e-97) || !(x <= 8000000000000.0)) {
tmp = x * ((z - y) + 1.0);
} else {
tmp = x - (t * (z - y));
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if (x <= -1.5e-97) or not (x <= 8000000000000.0): tmp = x * ((z - y) + 1.0) else: tmp = x - (t * (z - y)) return tmp
function code(x, y, z, t) tmp = 0.0 if ((x <= -1.5e-97) || !(x <= 8000000000000.0)) tmp = Float64(x * Float64(Float64(z - y) + 1.0)); 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 ((x <= -1.5e-97) || ~((x <= 8000000000000.0))) tmp = x * ((z - y) + 1.0); else tmp = x - (t * (z - y)); end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[Or[LessEqual[x, -1.5e-97], N[Not[LessEqual[x, 8000000000000.0]], $MachinePrecision]], N[(x * N[(N[(z - y), $MachinePrecision] + 1.0), $MachinePrecision]), $MachinePrecision], N[(x - N[(t * N[(z - y), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x \leq -1.5 \cdot 10^{-97} \lor \neg \left(x \leq 8000000000000\right):\\
\;\;\;\;x \cdot \left(\left(z - y\right) + 1\right)\\
\mathbf{else}:\\
\;\;\;\;x - t \cdot \left(z - y\right)\\
\end{array}
\end{array}
if x < -1.50000000000000012e-97 or 8e12 < x Initial program 100.0%
Taylor expanded in x around inf 86.3%
mul-1-neg86.3%
unsub-neg86.3%
Simplified86.3%
if -1.50000000000000012e-97 < x < 8e12Initial program 100.0%
Taylor expanded in t around inf 86.3%
Final simplification86.3%
(FPCore (x y z t) :precision binary64 (if (or (<= x -1.4e-97) (not (<= x 5900000000000.0))) (* x (+ (- z y) 1.0)) (* (- y z) t)))
double code(double x, double y, double z, double t) {
double tmp;
if ((x <= -1.4e-97) || !(x <= 5900000000000.0)) {
tmp = x * ((z - y) + 1.0);
} else {
tmp = (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 ((x <= (-1.4d-97)) .or. (.not. (x <= 5900000000000.0d0))) then
tmp = x * ((z - y) + 1.0d0)
else
tmp = (y - z) * t
end if
code = tmp
end function
public static double code(double x, double y, double z, double t) {
double tmp;
if ((x <= -1.4e-97) || !(x <= 5900000000000.0)) {
tmp = x * ((z - y) + 1.0);
} else {
tmp = (y - z) * t;
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if (x <= -1.4e-97) or not (x <= 5900000000000.0): tmp = x * ((z - y) + 1.0) else: tmp = (y - z) * t return tmp
function code(x, y, z, t) tmp = 0.0 if ((x <= -1.4e-97) || !(x <= 5900000000000.0)) tmp = Float64(x * Float64(Float64(z - y) + 1.0)); else tmp = Float64(Float64(y - z) * t); end return tmp end
function tmp_2 = code(x, y, z, t) tmp = 0.0; if ((x <= -1.4e-97) || ~((x <= 5900000000000.0))) tmp = x * ((z - y) + 1.0); else tmp = (y - z) * t; end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[Or[LessEqual[x, -1.4e-97], N[Not[LessEqual[x, 5900000000000.0]], $MachinePrecision]], N[(x * N[(N[(z - y), $MachinePrecision] + 1.0), $MachinePrecision]), $MachinePrecision], N[(N[(y - z), $MachinePrecision] * t), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x \leq -1.4 \cdot 10^{-97} \lor \neg \left(x \leq 5900000000000\right):\\
\;\;\;\;x \cdot \left(\left(z - y\right) + 1\right)\\
\mathbf{else}:\\
\;\;\;\;\left(y - z\right) \cdot t\\
\end{array}
\end{array}
if x < -1.4000000000000001e-97 or 5.9e12 < x Initial program 100.0%
Taylor expanded in x around inf 86.3%
mul-1-neg86.3%
unsub-neg86.3%
Simplified86.3%
if -1.4000000000000001e-97 < x < 5.9e12Initial program 100.0%
Taylor expanded in t around inf 86.3%
Taylor expanded in z around inf 83.0%
Taylor expanded in z around 0 81.8%
associate-+r+81.8%
mul-1-neg81.8%
sub-neg81.8%
Simplified81.8%
Taylor expanded in x around 0 72.5%
distribute-lft-out--77.0%
Simplified77.0%
Final simplification82.2%
(FPCore (x y z t) :precision binary64 (if (or (<= x -3.3e-70) (not (<= x 9e+37))) (* x (- 1.0 y)) (* (- y z) t)))
double code(double x, double y, double z, double t) {
double tmp;
if ((x <= -3.3e-70) || !(x <= 9e+37)) {
tmp = x * (1.0 - y);
} else {
tmp = (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 ((x <= (-3.3d-70)) .or. (.not. (x <= 9d+37))) then
tmp = x * (1.0d0 - y)
else
tmp = (y - z) * t
end if
code = tmp
end function
public static double code(double x, double y, double z, double t) {
double tmp;
if ((x <= -3.3e-70) || !(x <= 9e+37)) {
tmp = x * (1.0 - y);
} else {
tmp = (y - z) * t;
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if (x <= -3.3e-70) or not (x <= 9e+37): tmp = x * (1.0 - y) else: tmp = (y - z) * t return tmp
function code(x, y, z, t) tmp = 0.0 if ((x <= -3.3e-70) || !(x <= 9e+37)) tmp = Float64(x * Float64(1.0 - y)); else tmp = Float64(Float64(y - z) * t); end return tmp end
function tmp_2 = code(x, y, z, t) tmp = 0.0; if ((x <= -3.3e-70) || ~((x <= 9e+37))) tmp = x * (1.0 - y); else tmp = (y - z) * t; end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[Or[LessEqual[x, -3.3e-70], N[Not[LessEqual[x, 9e+37]], $MachinePrecision]], N[(x * N[(1.0 - y), $MachinePrecision]), $MachinePrecision], N[(N[(y - z), $MachinePrecision] * t), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x \leq -3.3 \cdot 10^{-70} \lor \neg \left(x \leq 9 \cdot 10^{+37}\right):\\
\;\;\;\;x \cdot \left(1 - y\right)\\
\mathbf{else}:\\
\;\;\;\;\left(y - z\right) \cdot t\\
\end{array}
\end{array}
if x < -3.30000000000000016e-70 or 8.99999999999999923e37 < x Initial program 100.0%
Taylor expanded in x around inf 88.4%
mul-1-neg88.4%
unsub-neg88.4%
Simplified88.4%
Taylor expanded in z around 0 65.1%
if -3.30000000000000016e-70 < x < 8.99999999999999923e37Initial program 100.0%
Taylor expanded in t around inf 82.5%
Taylor expanded in z around inf 78.7%
Taylor expanded in z around 0 78.4%
associate-+r+78.4%
mul-1-neg78.4%
sub-neg78.4%
Simplified78.4%
Taylor expanded in x around 0 69.5%
distribute-lft-out--73.6%
Simplified73.6%
Final simplification69.1%
(FPCore (x y z t) :precision binary64 (if (or (<= x -470000.0) (not (<= x 650000000000.0))) (* x (+ z 1.0)) (* (- y z) t)))
double code(double x, double y, double z, double t) {
double tmp;
if ((x <= -470000.0) || !(x <= 650000000000.0)) {
tmp = x * (z + 1.0);
} else {
tmp = (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 ((x <= (-470000.0d0)) .or. (.not. (x <= 650000000000.0d0))) then
tmp = x * (z + 1.0d0)
else
tmp = (y - z) * t
end if
code = tmp
end function
public static double code(double x, double y, double z, double t) {
double tmp;
if ((x <= -470000.0) || !(x <= 650000000000.0)) {
tmp = x * (z + 1.0);
} else {
tmp = (y - z) * t;
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if (x <= -470000.0) or not (x <= 650000000000.0): tmp = x * (z + 1.0) else: tmp = (y - z) * t return tmp
function code(x, y, z, t) tmp = 0.0 if ((x <= -470000.0) || !(x <= 650000000000.0)) tmp = Float64(x * Float64(z + 1.0)); else tmp = Float64(Float64(y - z) * t); end return tmp end
function tmp_2 = code(x, y, z, t) tmp = 0.0; if ((x <= -470000.0) || ~((x <= 650000000000.0))) tmp = x * (z + 1.0); else tmp = (y - z) * t; end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[Or[LessEqual[x, -470000.0], N[Not[LessEqual[x, 650000000000.0]], $MachinePrecision]], N[(x * N[(z + 1.0), $MachinePrecision]), $MachinePrecision], N[(N[(y - z), $MachinePrecision] * t), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x \leq -470000 \lor \neg \left(x \leq 650000000000\right):\\
\;\;\;\;x \cdot \left(z + 1\right)\\
\mathbf{else}:\\
\;\;\;\;\left(y - z\right) \cdot t\\
\end{array}
\end{array}
if x < -4.7e5 or 6.5e11 < x Initial program 100.0%
Taylor expanded in x around inf 90.5%
mul-1-neg90.5%
unsub-neg90.5%
Simplified90.5%
Taylor expanded in y around 0 57.1%
+-commutative57.1%
Simplified57.1%
if -4.7e5 < x < 6.5e11Initial program 100.0%
Taylor expanded in t around inf 81.0%
Taylor expanded in z around inf 78.2%
Taylor expanded in z around 0 77.3%
associate-+r+77.3%
mul-1-neg77.3%
sub-neg77.3%
Simplified77.3%
Taylor expanded in x around 0 66.9%
distribute-lft-out--70.7%
Simplified70.7%
Final simplification64.2%
(FPCore (x y z t) :precision binary64 (if (or (<= x -5.9e+16) (not (<= x 3.2e+63))) (- (* y x)) (* (- y z) t)))
double code(double x, double y, double z, double t) {
double tmp;
if ((x <= -5.9e+16) || !(x <= 3.2e+63)) {
tmp = -(y * x);
} else {
tmp = (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 ((x <= (-5.9d+16)) .or. (.not. (x <= 3.2d+63))) then
tmp = -(y * x)
else
tmp = (y - z) * t
end if
code = tmp
end function
public static double code(double x, double y, double z, double t) {
double tmp;
if ((x <= -5.9e+16) || !(x <= 3.2e+63)) {
tmp = -(y * x);
} else {
tmp = (y - z) * t;
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if (x <= -5.9e+16) or not (x <= 3.2e+63): tmp = -(y * x) else: tmp = (y - z) * t return tmp
function code(x, y, z, t) tmp = 0.0 if ((x <= -5.9e+16) || !(x <= 3.2e+63)) tmp = Float64(-Float64(y * x)); else tmp = Float64(Float64(y - z) * t); end return tmp end
function tmp_2 = code(x, y, z, t) tmp = 0.0; if ((x <= -5.9e+16) || ~((x <= 3.2e+63))) tmp = -(y * x); else tmp = (y - z) * t; end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[Or[LessEqual[x, -5.9e+16], N[Not[LessEqual[x, 3.2e+63]], $MachinePrecision]], (-N[(y * x), $MachinePrecision]), N[(N[(y - z), $MachinePrecision] * t), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x \leq -5.9 \cdot 10^{+16} \lor \neg \left(x \leq 3.2 \cdot 10^{+63}\right):\\
\;\;\;\;-y \cdot x\\
\mathbf{else}:\\
\;\;\;\;\left(y - z\right) \cdot t\\
\end{array}
\end{array}
if x < -5.9e16 or 3.20000000000000011e63 < x Initial program 100.0%
Taylor expanded in x around inf 91.4%
mul-1-neg91.4%
unsub-neg91.4%
Simplified91.4%
Taylor expanded in y around inf 44.5%
neg-mul-144.5%
Simplified44.5%
if -5.9e16 < x < 3.20000000000000011e63Initial program 100.0%
Taylor expanded in t around inf 78.6%
Taylor expanded in z around inf 75.3%
Taylor expanded in z around 0 75.1%
associate-+r+75.1%
mul-1-neg75.1%
sub-neg75.1%
Simplified75.1%
Taylor expanded in x around 0 64.3%
distribute-lft-out--67.8%
Simplified67.8%
Final simplification57.5%
(FPCore (x y z t) :precision binary64 (if (<= x -4.8e-70) (- x (* y x)) (if (<= x 2.65e+39) (* (- y z) t) (* x (- 1.0 y)))))
double code(double x, double y, double z, double t) {
double tmp;
if (x <= -4.8e-70) {
tmp = x - (y * x);
} else if (x <= 2.65e+39) {
tmp = (y - z) * t;
} else {
tmp = x * (1.0 - y);
}
return tmp;
}
real(8) function code(x, y, z, t)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
real(8) :: tmp
if (x <= (-4.8d-70)) then
tmp = x - (y * x)
else if (x <= 2.65d+39) then
tmp = (y - z) * t
else
tmp = x * (1.0d0 - y)
end if
code = tmp
end function
public static double code(double x, double y, double z, double t) {
double tmp;
if (x <= -4.8e-70) {
tmp = x - (y * x);
} else if (x <= 2.65e+39) {
tmp = (y - z) * t;
} else {
tmp = x * (1.0 - y);
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if x <= -4.8e-70: tmp = x - (y * x) elif x <= 2.65e+39: tmp = (y - z) * t else: tmp = x * (1.0 - y) return tmp
function code(x, y, z, t) tmp = 0.0 if (x <= -4.8e-70) tmp = Float64(x - Float64(y * x)); elseif (x <= 2.65e+39) tmp = Float64(Float64(y - z) * t); else tmp = Float64(x * Float64(1.0 - y)); end return tmp end
function tmp_2 = code(x, y, z, t) tmp = 0.0; if (x <= -4.8e-70) tmp = x - (y * x); elseif (x <= 2.65e+39) tmp = (y - z) * t; else tmp = x * (1.0 - y); end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[LessEqual[x, -4.8e-70], N[(x - N[(y * x), $MachinePrecision]), $MachinePrecision], If[LessEqual[x, 2.65e+39], N[(N[(y - z), $MachinePrecision] * t), $MachinePrecision], N[(x * N[(1.0 - y), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x \leq -4.8 \cdot 10^{-70}:\\
\;\;\;\;x - y \cdot x\\
\mathbf{elif}\;x \leq 2.65 \cdot 10^{+39}:\\
\;\;\;\;\left(y - z\right) \cdot t\\
\mathbf{else}:\\
\;\;\;\;x \cdot \left(1 - y\right)\\
\end{array}
\end{array}
if x < -4.8000000000000002e-70Initial program 100.0%
Taylor expanded in y around inf 68.3%
*-commutative68.3%
Simplified68.3%
Taylor expanded in t around 0 62.3%
neg-mul-162.3%
Simplified62.3%
distribute-lft-neg-out62.3%
unsub-neg62.3%
*-commutative62.3%
Applied egg-rr62.3%
if -4.8000000000000002e-70 < x < 2.64999999999999989e39Initial program 100.0%
Taylor expanded in t around inf 82.5%
Taylor expanded in z around inf 78.7%
Taylor expanded in z around 0 78.4%
associate-+r+78.4%
mul-1-neg78.4%
sub-neg78.4%
Simplified78.4%
Taylor expanded in x around 0 69.5%
distribute-lft-out--73.6%
Simplified73.6%
if 2.64999999999999989e39 < x Initial program 99.9%
Taylor expanded in x around inf 92.4%
mul-1-neg92.4%
unsub-neg92.4%
Simplified92.4%
Taylor expanded in z around 0 69.5%
Final simplification69.1%
(FPCore (x y z t) :precision binary64 (if (or (<= y -2.6e-17) (not (<= y 6.6e-8))) (* y t) x))
double code(double x, double y, double z, double t) {
double tmp;
if ((y <= -2.6e-17) || !(y <= 6.6e-8)) {
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 <= (-2.6d-17)) .or. (.not. (y <= 6.6d-8))) 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 <= -2.6e-17) || !(y <= 6.6e-8)) {
tmp = y * t;
} else {
tmp = x;
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if (y <= -2.6e-17) or not (y <= 6.6e-8): tmp = y * t else: tmp = x return tmp
function code(x, y, z, t) tmp = 0.0 if ((y <= -2.6e-17) || !(y <= 6.6e-8)) tmp = Float64(y * t); else tmp = x; end return tmp end
function tmp_2 = code(x, y, z, t) tmp = 0.0; if ((y <= -2.6e-17) || ~((y <= 6.6e-8))) tmp = y * t; else tmp = x; end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[Or[LessEqual[y, -2.6e-17], N[Not[LessEqual[y, 6.6e-8]], $MachinePrecision]], N[(y * t), $MachinePrecision], x]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;y \leq -2.6 \cdot 10^{-17} \lor \neg \left(y \leq 6.6 \cdot 10^{-8}\right):\\
\;\;\;\;y \cdot t\\
\mathbf{else}:\\
\;\;\;\;x\\
\end{array}
\end{array}
if y < -2.60000000000000003e-17 or 6.59999999999999954e-8 < y Initial program 100.0%
Taylor expanded in t around inf 49.8%
Taylor expanded in z around inf 50.0%
Taylor expanded in z around 0 45.3%
associate-+r+45.3%
mul-1-neg45.3%
sub-neg45.3%
Simplified45.3%
Taylor expanded in y around inf 38.7%
if -2.60000000000000003e-17 < y < 6.59999999999999954e-8Initial program 100.0%
Taylor expanded in y around inf 43.7%
*-commutative43.7%
Simplified43.7%
Taylor expanded in y around 0 37.1%
Final simplification37.9%
(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 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 62.3%
*-commutative62.3%
Simplified62.3%
Taylor expanded in y around 0 19.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 2024180
(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))))