
(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 10 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 (* x (- 1.0 y))) (t_2 (+ x (* x z))) (t_3 (+ x (* (- y z) t))))
(if (<= x -1.6e+147)
t_2
(if (<= x -2e+51)
t_3
(if (<= x -5.4e-26)
t_1
(if (<= x 2.8e+52)
t_3
(if (or (<= x 4.6e+168) (not (<= x 4.8e+263))) t_2 t_1)))))))
double code(double x, double y, double z, double t) {
double t_1 = x * (1.0 - y);
double t_2 = x + (x * z);
double t_3 = x + ((y - z) * t);
double tmp;
if (x <= -1.6e+147) {
tmp = t_2;
} else if (x <= -2e+51) {
tmp = t_3;
} else if (x <= -5.4e-26) {
tmp = t_1;
} else if (x <= 2.8e+52) {
tmp = t_3;
} else if ((x <= 4.6e+168) || !(x <= 4.8e+263)) {
tmp = t_2;
} else {
tmp = t_1;
}
return tmp;
}
real(8) function code(x, y, z, t)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
real(8) :: t_1
real(8) :: t_2
real(8) :: t_3
real(8) :: tmp
t_1 = x * (1.0d0 - y)
t_2 = x + (x * z)
t_3 = x + ((y - z) * t)
if (x <= (-1.6d+147)) then
tmp = t_2
else if (x <= (-2d+51)) then
tmp = t_3
else if (x <= (-5.4d-26)) then
tmp = t_1
else if (x <= 2.8d+52) then
tmp = t_3
else if ((x <= 4.6d+168) .or. (.not. (x <= 4.8d+263))) then
tmp = t_2
else
tmp = t_1
end if
code = tmp
end function
public static double code(double x, double y, double z, double t) {
double t_1 = x * (1.0 - y);
double t_2 = x + (x * z);
double t_3 = x + ((y - z) * t);
double tmp;
if (x <= -1.6e+147) {
tmp = t_2;
} else if (x <= -2e+51) {
tmp = t_3;
} else if (x <= -5.4e-26) {
tmp = t_1;
} else if (x <= 2.8e+52) {
tmp = t_3;
} else if ((x <= 4.6e+168) || !(x <= 4.8e+263)) {
tmp = t_2;
} else {
tmp = t_1;
}
return tmp;
}
def code(x, y, z, t): t_1 = x * (1.0 - y) t_2 = x + (x * z) t_3 = x + ((y - z) * t) tmp = 0 if x <= -1.6e+147: tmp = t_2 elif x <= -2e+51: tmp = t_3 elif x <= -5.4e-26: tmp = t_1 elif x <= 2.8e+52: tmp = t_3 elif (x <= 4.6e+168) or not (x <= 4.8e+263): tmp = t_2 else: tmp = t_1 return tmp
function code(x, y, z, t) t_1 = Float64(x * Float64(1.0 - y)) t_2 = Float64(x + Float64(x * z)) t_3 = Float64(x + Float64(Float64(y - z) * t)) tmp = 0.0 if (x <= -1.6e+147) tmp = t_2; elseif (x <= -2e+51) tmp = t_3; elseif (x <= -5.4e-26) tmp = t_1; elseif (x <= 2.8e+52) tmp = t_3; elseif ((x <= 4.6e+168) || !(x <= 4.8e+263)) tmp = t_2; else tmp = t_1; end return tmp end
function tmp_2 = code(x, y, z, t) t_1 = x * (1.0 - y); t_2 = x + (x * z); t_3 = x + ((y - z) * t); tmp = 0.0; if (x <= -1.6e+147) tmp = t_2; elseif (x <= -2e+51) tmp = t_3; elseif (x <= -5.4e-26) tmp = t_1; elseif (x <= 2.8e+52) tmp = t_3; elseif ((x <= 4.6e+168) || ~((x <= 4.8e+263))) tmp = t_2; else tmp = t_1; end tmp_2 = tmp; end
code[x_, y_, z_, t_] := Block[{t$95$1 = N[(x * N[(1.0 - y), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$2 = N[(x + N[(x * z), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$3 = N[(x + N[(N[(y - z), $MachinePrecision] * t), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[x, -1.6e+147], t$95$2, If[LessEqual[x, -2e+51], t$95$3, If[LessEqual[x, -5.4e-26], t$95$1, If[LessEqual[x, 2.8e+52], t$95$3, If[Or[LessEqual[x, 4.6e+168], N[Not[LessEqual[x, 4.8e+263]], $MachinePrecision]], t$95$2, t$95$1]]]]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := x \cdot \left(1 - y\right)\\
t_2 := x + x \cdot z\\
t_3 := x + \left(y - z\right) \cdot t\\
\mathbf{if}\;x \leq -1.6 \cdot 10^{+147}:\\
\;\;\;\;t_2\\
\mathbf{elif}\;x \leq -2 \cdot 10^{+51}:\\
\;\;\;\;t_3\\
\mathbf{elif}\;x \leq -5.4 \cdot 10^{-26}:\\
\;\;\;\;t_1\\
\mathbf{elif}\;x \leq 2.8 \cdot 10^{+52}:\\
\;\;\;\;t_3\\
\mathbf{elif}\;x \leq 4.6 \cdot 10^{+168} \lor \neg \left(x \leq 4.8 \cdot 10^{+263}\right):\\
\;\;\;\;t_2\\
\mathbf{else}:\\
\;\;\;\;t_1\\
\end{array}
\end{array}
if x < -1.59999999999999989e147 or 2.8e52 < x < 4.5999999999999999e168 or 4.8000000000000001e263 < x Initial program 100.0%
Taylor expanded in y around 0 73.8%
mul-1-neg73.8%
distribute-lft-neg-out73.8%
*-commutative73.8%
Simplified73.8%
Taylor expanded in t around 0 63.7%
if -1.59999999999999989e147 < x < -2e51 or -5.39999999999999963e-26 < x < 2.8e52Initial program 99.9%
Taylor expanded in t around inf 82.4%
if -2e51 < x < -5.39999999999999963e-26 or 4.5999999999999999e168 < x < 4.8000000000000001e263Initial program 99.9%
*-commutative99.9%
sub-neg99.9%
distribute-lft-in96.2%
Applied egg-rr96.2%
Taylor expanded in t around 0 93.6%
mul-1-neg93.6%
distribute-rgt-neg-in93.6%
mul-1-neg93.6%
distribute-lft-in93.6%
+-commutative93.6%
mul-1-neg93.6%
unsub-neg93.6%
Simplified93.6%
Taylor expanded in z around 0 71.8%
*-rgt-identity71.8%
mul-1-neg71.8%
distribute-rgt-neg-out71.8%
distribute-lft-in71.8%
unsub-neg71.8%
Simplified71.8%
Final simplification74.8%
(FPCore (x y z t)
:precision binary64
(let* ((t_1 (* x (- 1.0 y))) (t_2 (+ x (* x z))) (t_3 (+ x (* y t))))
(if (<= z -3.1e+187)
t_2
(if (<= z -7.6e+110)
t_1
(if (<= z -2.4e-6)
t_2
(if (<= z -7e-111)
t_3
(if (<= z -1.35e-202) t_1 (if (<= z 1.36e+75) t_3 t_2))))))))
double code(double x, double y, double z, double t) {
double t_1 = x * (1.0 - y);
double t_2 = x + (x * z);
double t_3 = x + (y * t);
double tmp;
if (z <= -3.1e+187) {
tmp = t_2;
} else if (z <= -7.6e+110) {
tmp = t_1;
} else if (z <= -2.4e-6) {
tmp = t_2;
} else if (z <= -7e-111) {
tmp = t_3;
} else if (z <= -1.35e-202) {
tmp = t_1;
} else if (z <= 1.36e+75) {
tmp = t_3;
} 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) :: t_3
real(8) :: tmp
t_1 = x * (1.0d0 - y)
t_2 = x + (x * z)
t_3 = x + (y * t)
if (z <= (-3.1d+187)) then
tmp = t_2
else if (z <= (-7.6d+110)) then
tmp = t_1
else if (z <= (-2.4d-6)) then
tmp = t_2
else if (z <= (-7d-111)) then
tmp = t_3
else if (z <= (-1.35d-202)) then
tmp = t_1
else if (z <= 1.36d+75) then
tmp = t_3
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 = x * (1.0 - y);
double t_2 = x + (x * z);
double t_3 = x + (y * t);
double tmp;
if (z <= -3.1e+187) {
tmp = t_2;
} else if (z <= -7.6e+110) {
tmp = t_1;
} else if (z <= -2.4e-6) {
tmp = t_2;
} else if (z <= -7e-111) {
tmp = t_3;
} else if (z <= -1.35e-202) {
tmp = t_1;
} else if (z <= 1.36e+75) {
tmp = t_3;
} else {
tmp = t_2;
}
return tmp;
}
def code(x, y, z, t): t_1 = x * (1.0 - y) t_2 = x + (x * z) t_3 = x + (y * t) tmp = 0 if z <= -3.1e+187: tmp = t_2 elif z <= -7.6e+110: tmp = t_1 elif z <= -2.4e-6: tmp = t_2 elif z <= -7e-111: tmp = t_3 elif z <= -1.35e-202: tmp = t_1 elif z <= 1.36e+75: tmp = t_3 else: tmp = t_2 return tmp
function code(x, y, z, t) t_1 = Float64(x * Float64(1.0 - y)) t_2 = Float64(x + Float64(x * z)) t_3 = Float64(x + Float64(y * t)) tmp = 0.0 if (z <= -3.1e+187) tmp = t_2; elseif (z <= -7.6e+110) tmp = t_1; elseif (z <= -2.4e-6) tmp = t_2; elseif (z <= -7e-111) tmp = t_3; elseif (z <= -1.35e-202) tmp = t_1; elseif (z <= 1.36e+75) tmp = t_3; else tmp = t_2; end return tmp end
function tmp_2 = code(x, y, z, t) t_1 = x * (1.0 - y); t_2 = x + (x * z); t_3 = x + (y * t); tmp = 0.0; if (z <= -3.1e+187) tmp = t_2; elseif (z <= -7.6e+110) tmp = t_1; elseif (z <= -2.4e-6) tmp = t_2; elseif (z <= -7e-111) tmp = t_3; elseif (z <= -1.35e-202) tmp = t_1; elseif (z <= 1.36e+75) tmp = t_3; else tmp = t_2; end tmp_2 = tmp; end
code[x_, y_, z_, t_] := Block[{t$95$1 = N[(x * N[(1.0 - y), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$2 = N[(x + N[(x * z), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$3 = N[(x + N[(y * t), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[z, -3.1e+187], t$95$2, If[LessEqual[z, -7.6e+110], t$95$1, If[LessEqual[z, -2.4e-6], t$95$2, If[LessEqual[z, -7e-111], t$95$3, If[LessEqual[z, -1.35e-202], t$95$1, If[LessEqual[z, 1.36e+75], t$95$3, t$95$2]]]]]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := x \cdot \left(1 - y\right)\\
t_2 := x + x \cdot z\\
t_3 := x + y \cdot t\\
\mathbf{if}\;z \leq -3.1 \cdot 10^{+187}:\\
\;\;\;\;t_2\\
\mathbf{elif}\;z \leq -7.6 \cdot 10^{+110}:\\
\;\;\;\;t_1\\
\mathbf{elif}\;z \leq -2.4 \cdot 10^{-6}:\\
\;\;\;\;t_2\\
\mathbf{elif}\;z \leq -7 \cdot 10^{-111}:\\
\;\;\;\;t_3\\
\mathbf{elif}\;z \leq -1.35 \cdot 10^{-202}:\\
\;\;\;\;t_1\\
\mathbf{elif}\;z \leq 1.36 \cdot 10^{+75}:\\
\;\;\;\;t_3\\
\mathbf{else}:\\
\;\;\;\;t_2\\
\end{array}
\end{array}
if z < -3.10000000000000012e187 or -7.59999999999999978e110 < z < -2.3999999999999999e-6 or 1.36e75 < z Initial program 100.0%
Taylor expanded in y around 0 87.6%
mul-1-neg87.6%
distribute-lft-neg-out87.6%
*-commutative87.6%
Simplified87.6%
Taylor expanded in t around 0 53.4%
if -3.10000000000000012e187 < z < -7.59999999999999978e110 or -7.0000000000000001e-111 < z < -1.3499999999999999e-202Initial program 100.0%
*-commutative100.0%
sub-neg100.0%
distribute-lft-in90.2%
Applied egg-rr90.2%
Taylor expanded in t around 0 58.3%
mul-1-neg58.3%
distribute-rgt-neg-in58.3%
mul-1-neg58.3%
distribute-lft-in63.2%
+-commutative63.2%
mul-1-neg63.2%
unsub-neg63.2%
Simplified63.2%
Taylor expanded in z around 0 58.3%
*-rgt-identity58.3%
mul-1-neg58.3%
distribute-rgt-neg-out58.3%
distribute-lft-in58.3%
unsub-neg58.3%
Simplified58.3%
if -2.3999999999999999e-6 < z < -7.0000000000000001e-111 or -1.3499999999999999e-202 < z < 1.36e75Initial program 100.0%
Taylor expanded in y around inf 86.3%
*-commutative86.3%
Simplified86.3%
Taylor expanded in t around inf 68.5%
*-commutative68.5%
Simplified68.5%
Final simplification60.8%
(FPCore (x y z t)
:precision binary64
(let* ((t_1 (+ x (* x z))) (t_2 (+ x (* y t))) (t_3 (- x (* z t))))
(if (<= y -5.2e+73)
t_2
(if (<= y -5e-114)
t_3
(if (<= y 4.8e-255)
t_1
(if (<= y 3.25e-170)
t_3
(if (<= y 4e-96) t_1 (if (<= y 3.8e+153) t_2 (* x (- 1.0 y))))))))))
double code(double x, double y, double z, double t) {
double t_1 = x + (x * z);
double t_2 = x + (y * t);
double t_3 = x - (z * t);
double tmp;
if (y <= -5.2e+73) {
tmp = t_2;
} else if (y <= -5e-114) {
tmp = t_3;
} else if (y <= 4.8e-255) {
tmp = t_1;
} else if (y <= 3.25e-170) {
tmp = t_3;
} else if (y <= 4e-96) {
tmp = t_1;
} else if (y <= 3.8e+153) {
tmp = t_2;
} 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) :: t_1
real(8) :: t_2
real(8) :: t_3
real(8) :: tmp
t_1 = x + (x * z)
t_2 = x + (y * t)
t_3 = x - (z * t)
if (y <= (-5.2d+73)) then
tmp = t_2
else if (y <= (-5d-114)) then
tmp = t_3
else if (y <= 4.8d-255) then
tmp = t_1
else if (y <= 3.25d-170) then
tmp = t_3
else if (y <= 4d-96) then
tmp = t_1
else if (y <= 3.8d+153) then
tmp = t_2
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 t_1 = x + (x * z);
double t_2 = x + (y * t);
double t_3 = x - (z * t);
double tmp;
if (y <= -5.2e+73) {
tmp = t_2;
} else if (y <= -5e-114) {
tmp = t_3;
} else if (y <= 4.8e-255) {
tmp = t_1;
} else if (y <= 3.25e-170) {
tmp = t_3;
} else if (y <= 4e-96) {
tmp = t_1;
} else if (y <= 3.8e+153) {
tmp = t_2;
} else {
tmp = x * (1.0 - y);
}
return tmp;
}
def code(x, y, z, t): t_1 = x + (x * z) t_2 = x + (y * t) t_3 = x - (z * t) tmp = 0 if y <= -5.2e+73: tmp = t_2 elif y <= -5e-114: tmp = t_3 elif y <= 4.8e-255: tmp = t_1 elif y <= 3.25e-170: tmp = t_3 elif y <= 4e-96: tmp = t_1 elif y <= 3.8e+153: tmp = t_2 else: tmp = x * (1.0 - y) return tmp
function code(x, y, z, t) t_1 = Float64(x + Float64(x * z)) t_2 = Float64(x + Float64(y * t)) t_3 = Float64(x - Float64(z * t)) tmp = 0.0 if (y <= -5.2e+73) tmp = t_2; elseif (y <= -5e-114) tmp = t_3; elseif (y <= 4.8e-255) tmp = t_1; elseif (y <= 3.25e-170) tmp = t_3; elseif (y <= 4e-96) tmp = t_1; elseif (y <= 3.8e+153) tmp = t_2; else tmp = Float64(x * Float64(1.0 - y)); end return tmp end
function tmp_2 = code(x, y, z, t) t_1 = x + (x * z); t_2 = x + (y * t); t_3 = x - (z * t); tmp = 0.0; if (y <= -5.2e+73) tmp = t_2; elseif (y <= -5e-114) tmp = t_3; elseif (y <= 4.8e-255) tmp = t_1; elseif (y <= 3.25e-170) tmp = t_3; elseif (y <= 4e-96) tmp = t_1; elseif (y <= 3.8e+153) tmp = t_2; else tmp = x * (1.0 - y); end tmp_2 = tmp; end
code[x_, y_, z_, t_] := Block[{t$95$1 = N[(x + N[(x * z), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$2 = N[(x + N[(y * t), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$3 = N[(x - N[(z * t), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[y, -5.2e+73], t$95$2, If[LessEqual[y, -5e-114], t$95$3, If[LessEqual[y, 4.8e-255], t$95$1, If[LessEqual[y, 3.25e-170], t$95$3, If[LessEqual[y, 4e-96], t$95$1, If[LessEqual[y, 3.8e+153], t$95$2, N[(x * N[(1.0 - y), $MachinePrecision]), $MachinePrecision]]]]]]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := x + x \cdot z\\
t_2 := x + y \cdot t\\
t_3 := x - z \cdot t\\
\mathbf{if}\;y \leq -5.2 \cdot 10^{+73}:\\
\;\;\;\;t_2\\
\mathbf{elif}\;y \leq -5 \cdot 10^{-114}:\\
\;\;\;\;t_3\\
\mathbf{elif}\;y \leq 4.8 \cdot 10^{-255}:\\
\;\;\;\;t_1\\
\mathbf{elif}\;y \leq 3.25 \cdot 10^{-170}:\\
\;\;\;\;t_3\\
\mathbf{elif}\;y \leq 4 \cdot 10^{-96}:\\
\;\;\;\;t_1\\
\mathbf{elif}\;y \leq 3.8 \cdot 10^{+153}:\\
\;\;\;\;t_2\\
\mathbf{else}:\\
\;\;\;\;x \cdot \left(1 - y\right)\\
\end{array}
\end{array}
if y < -5.2000000000000001e73 or 3.9999999999999996e-96 < y < 3.79999999999999966e153Initial program 100.0%
Taylor expanded in y around inf 80.9%
*-commutative80.9%
Simplified80.9%
Taylor expanded in t around inf 55.2%
*-commutative55.2%
Simplified55.2%
if -5.2000000000000001e73 < y < -4.99999999999999989e-114 or 4.7999999999999997e-255 < y < 3.25000000000000018e-170Initial program 100.0%
Taylor expanded in y around 0 79.8%
mul-1-neg79.8%
distribute-lft-neg-out79.8%
*-commutative79.8%
Simplified79.8%
Taylor expanded in t around inf 66.5%
associate-*r*66.5%
mul-1-neg66.5%
Simplified66.5%
if -4.99999999999999989e-114 < y < 4.7999999999999997e-255 or 3.25000000000000018e-170 < y < 3.9999999999999996e-96Initial program 100.0%
Taylor expanded in y around 0 97.3%
mul-1-neg97.3%
distribute-lft-neg-out97.3%
*-commutative97.3%
Simplified97.3%
Taylor expanded in t around 0 72.4%
if 3.79999999999999966e153 < y Initial program 99.9%
*-commutative99.9%
sub-neg99.9%
distribute-lft-in97.1%
Applied egg-rr97.1%
Taylor expanded in t around 0 63.9%
mul-1-neg63.9%
distribute-rgt-neg-in63.9%
mul-1-neg63.9%
distribute-lft-in66.6%
+-commutative66.6%
mul-1-neg66.6%
unsub-neg66.6%
Simplified66.6%
Taylor expanded in z around 0 60.4%
*-rgt-identity60.4%
mul-1-neg60.4%
distribute-rgt-neg-out60.4%
distribute-lft-in60.4%
unsub-neg60.4%
Simplified60.4%
Final simplification62.8%
(FPCore (x y z t)
:precision binary64
(let* ((t_1 (* x (- 1.0 y))))
(if (<= y -5.5e+60)
(* y t)
(if (<= y -2e+17)
t_1
(if (<= y -3.25e-50)
(* y t)
(if (<= y 1.6e+16)
(+ x (* x z))
(if (<= y 4.6e+153) (* y t) t_1)))))))
double code(double x, double y, double z, double t) {
double t_1 = x * (1.0 - y);
double tmp;
if (y <= -5.5e+60) {
tmp = y * t;
} else if (y <= -2e+17) {
tmp = t_1;
} else if (y <= -3.25e-50) {
tmp = y * t;
} else if (y <= 1.6e+16) {
tmp = x + (x * z);
} else if (y <= 4.6e+153) {
tmp = y * 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 * (1.0d0 - y)
if (y <= (-5.5d+60)) then
tmp = y * t
else if (y <= (-2d+17)) then
tmp = t_1
else if (y <= (-3.25d-50)) then
tmp = y * t
else if (y <= 1.6d+16) then
tmp = x + (x * z)
else if (y <= 4.6d+153) then
tmp = y * 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 * (1.0 - y);
double tmp;
if (y <= -5.5e+60) {
tmp = y * t;
} else if (y <= -2e+17) {
tmp = t_1;
} else if (y <= -3.25e-50) {
tmp = y * t;
} else if (y <= 1.6e+16) {
tmp = x + (x * z);
} else if (y <= 4.6e+153) {
tmp = y * t;
} else {
tmp = t_1;
}
return tmp;
}
def code(x, y, z, t): t_1 = x * (1.0 - y) tmp = 0 if y <= -5.5e+60: tmp = y * t elif y <= -2e+17: tmp = t_1 elif y <= -3.25e-50: tmp = y * t elif y <= 1.6e+16: tmp = x + (x * z) elif y <= 4.6e+153: tmp = y * t else: tmp = t_1 return tmp
function code(x, y, z, t) t_1 = Float64(x * Float64(1.0 - y)) tmp = 0.0 if (y <= -5.5e+60) tmp = Float64(y * t); elseif (y <= -2e+17) tmp = t_1; elseif (y <= -3.25e-50) tmp = Float64(y * t); elseif (y <= 1.6e+16) tmp = Float64(x + Float64(x * z)); elseif (y <= 4.6e+153) tmp = Float64(y * t); else tmp = t_1; end return tmp end
function tmp_2 = code(x, y, z, t) t_1 = x * (1.0 - y); tmp = 0.0; if (y <= -5.5e+60) tmp = y * t; elseif (y <= -2e+17) tmp = t_1; elseif (y <= -3.25e-50) tmp = y * t; elseif (y <= 1.6e+16) tmp = x + (x * z); elseif (y <= 4.6e+153) tmp = y * t; else tmp = t_1; end tmp_2 = tmp; end
code[x_, y_, z_, t_] := Block[{t$95$1 = N[(x * N[(1.0 - y), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[y, -5.5e+60], N[(y * t), $MachinePrecision], If[LessEqual[y, -2e+17], t$95$1, If[LessEqual[y, -3.25e-50], N[(y * t), $MachinePrecision], If[LessEqual[y, 1.6e+16], N[(x + N[(x * z), $MachinePrecision]), $MachinePrecision], If[LessEqual[y, 4.6e+153], N[(y * t), $MachinePrecision], t$95$1]]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := x \cdot \left(1 - y\right)\\
\mathbf{if}\;y \leq -5.5 \cdot 10^{+60}:\\
\;\;\;\;y \cdot t\\
\mathbf{elif}\;y \leq -2 \cdot 10^{+17}:\\
\;\;\;\;t_1\\
\mathbf{elif}\;y \leq -3.25 \cdot 10^{-50}:\\
\;\;\;\;y \cdot t\\
\mathbf{elif}\;y \leq 1.6 \cdot 10^{+16}:\\
\;\;\;\;x + x \cdot z\\
\mathbf{elif}\;y \leq 4.6 \cdot 10^{+153}:\\
\;\;\;\;y \cdot t\\
\mathbf{else}:\\
\;\;\;\;t_1\\
\end{array}
\end{array}
if y < -5.5000000000000001e60 or -2e17 < y < -3.24999999999999994e-50 or 1.6e16 < y < 4.6000000000000003e153Initial program 100.0%
Taylor expanded in y around inf 80.2%
*-commutative80.2%
Simplified80.2%
Taylor expanded in x around 0 55.3%
*-commutative55.3%
Simplified55.3%
if -5.5000000000000001e60 < y < -2e17 or 4.6000000000000003e153 < y Initial program 99.9%
*-commutative99.9%
sub-neg99.9%
distribute-lft-in93.8%
Applied egg-rr93.8%
Taylor expanded in t around 0 57.4%
mul-1-neg57.4%
distribute-rgt-neg-in57.4%
mul-1-neg57.4%
distribute-lft-in61.5%
+-commutative61.5%
mul-1-neg61.5%
unsub-neg61.5%
Simplified61.5%
Taylor expanded in z around 0 54.8%
*-rgt-identity54.8%
mul-1-neg54.8%
distribute-rgt-neg-out54.8%
distribute-lft-in54.8%
unsub-neg54.8%
Simplified54.8%
if -3.24999999999999994e-50 < y < 1.6e16Initial program 100.0%
Taylor expanded in y around 0 91.7%
mul-1-neg91.7%
distribute-lft-neg-out91.7%
*-commutative91.7%
Simplified91.7%
Taylor expanded in t around 0 62.9%
Final simplification58.4%
(FPCore (x y z t)
:precision binary64
(if (or (<= x -1.35e+147)
(not
(or (<= x -4.3e+111) (and (not (<= x -3.5e-29)) (<= x 1.28e-23)))))
(+ x (* x (- z y)))
(+ x (* (- y z) t))))
double code(double x, double y, double z, double t) {
double tmp;
if ((x <= -1.35e+147) || !((x <= -4.3e+111) || (!(x <= -3.5e-29) && (x <= 1.28e-23)))) {
tmp = x + (x * (z - y));
} else {
tmp = x + ((y - z) * t);
}
return tmp;
}
real(8) function code(x, y, z, t)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
real(8) :: tmp
if ((x <= (-1.35d+147)) .or. (.not. (x <= (-4.3d+111)) .or. (.not. (x <= (-3.5d-29))) .and. (x <= 1.28d-23))) then
tmp = x + (x * (z - y))
else
tmp = x + ((y - z) * t)
end if
code = tmp
end function
public static double code(double x, double y, double z, double t) {
double tmp;
if ((x <= -1.35e+147) || !((x <= -4.3e+111) || (!(x <= -3.5e-29) && (x <= 1.28e-23)))) {
tmp = x + (x * (z - y));
} else {
tmp = x + ((y - z) * t);
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if (x <= -1.35e+147) or not ((x <= -4.3e+111) or (not (x <= -3.5e-29) and (x <= 1.28e-23))): tmp = x + (x * (z - y)) else: tmp = x + ((y - z) * t) return tmp
function code(x, y, z, t) tmp = 0.0 if ((x <= -1.35e+147) || !((x <= -4.3e+111) || (!(x <= -3.5e-29) && (x <= 1.28e-23)))) tmp = Float64(x + Float64(x * Float64(z - y))); else tmp = Float64(x + Float64(Float64(y - z) * t)); end return tmp end
function tmp_2 = code(x, y, z, t) tmp = 0.0; if ((x <= -1.35e+147) || ~(((x <= -4.3e+111) || (~((x <= -3.5e-29)) && (x <= 1.28e-23))))) tmp = x + (x * (z - y)); else tmp = x + ((y - z) * t); end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[Or[LessEqual[x, -1.35e+147], N[Not[Or[LessEqual[x, -4.3e+111], And[N[Not[LessEqual[x, -3.5e-29]], $MachinePrecision], LessEqual[x, 1.28e-23]]]], $MachinePrecision]], N[(x + N[(x * N[(z - y), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(x + N[(N[(y - z), $MachinePrecision] * t), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x \leq -1.35 \cdot 10^{+147} \lor \neg \left(x \leq -4.3 \cdot 10^{+111} \lor \neg \left(x \leq -3.5 \cdot 10^{-29}\right) \land x \leq 1.28 \cdot 10^{-23}\right):\\
\;\;\;\;x + x \cdot \left(z - y\right)\\
\mathbf{else}:\\
\;\;\;\;x + \left(y - z\right) \cdot t\\
\end{array}
\end{array}
if x < -1.34999999999999999e147 or -4.29999999999999993e111 < x < -3.4999999999999997e-29 or 1.28000000000000005e-23 < x Initial program 100.0%
*-commutative100.0%
sub-neg100.0%
distribute-lft-in95.7%
Applied egg-rr95.7%
Taylor expanded in t around 0 82.3%
mul-1-neg82.3%
distribute-rgt-neg-in82.3%
mul-1-neg82.3%
distribute-lft-in85.2%
+-commutative85.2%
mul-1-neg85.2%
unsub-neg85.2%
Simplified85.2%
if -1.34999999999999999e147 < x < -4.29999999999999993e111 or -3.4999999999999997e-29 < x < 1.28000000000000005e-23Initial program 99.9%
Taylor expanded in t around inf 87.4%
Final simplification86.2%
(FPCore (x y z t) :precision binary64 (if (or (<= z -8.5e+64) (not (<= z 0.00075))) (+ x (* z (- x t))) (+ x (* y (- t x)))))
double code(double x, double y, double z, double t) {
double tmp;
if ((z <= -8.5e+64) || !(z <= 0.00075)) {
tmp = x + (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 <= (-8.5d+64)) .or. (.not. (z <= 0.00075d0))) then
tmp = x + (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 <= -8.5e+64) || !(z <= 0.00075)) {
tmp = x + (z * (x - t));
} else {
tmp = x + (y * (t - x));
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if (z <= -8.5e+64) or not (z <= 0.00075): tmp = x + (z * (x - t)) else: tmp = x + (y * (t - x)) return tmp
function code(x, y, z, t) tmp = 0.0 if ((z <= -8.5e+64) || !(z <= 0.00075)) tmp = Float64(x + 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 <= -8.5e+64) || ~((z <= 0.00075))) tmp = x + (z * (x - t)); else tmp = x + (y * (t - x)); end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[Or[LessEqual[z, -8.5e+64], N[Not[LessEqual[z, 0.00075]], $MachinePrecision]], N[(x + N[(z * N[(x - t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(x + N[(y * N[(t - x), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \leq -8.5 \cdot 10^{+64} \lor \neg \left(z \leq 0.00075\right):\\
\;\;\;\;x + z \cdot \left(x - t\right)\\
\mathbf{else}:\\
\;\;\;\;x + y \cdot \left(t - x\right)\\
\end{array}
\end{array}
if z < -8.4999999999999998e64 or 7.5000000000000002e-4 < z Initial program 99.9%
Taylor expanded in y around 0 87.2%
mul-1-neg87.2%
distribute-lft-neg-out87.2%
*-commutative87.2%
Simplified87.2%
Taylor expanded in t around 0 80.5%
associate-*r*80.5%
distribute-rgt-in87.2%
+-commutative87.2%
mul-1-neg87.2%
sub-neg87.2%
Simplified87.2%
if -8.4999999999999998e64 < z < 7.5000000000000002e-4Initial program 100.0%
Taylor expanded in y around inf 88.0%
*-commutative88.0%
Simplified88.0%
Final simplification87.6%
(FPCore (x y z t) :precision binary64 (if (or (<= x -3.6e-28) (not (<= x 3.5e-25))) (* x (- 1.0 y)) (* y t)))
double code(double x, double y, double z, double t) {
double tmp;
if ((x <= -3.6e-28) || !(x <= 3.5e-25)) {
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 <= (-3.6d-28)) .or. (.not. (x <= 3.5d-25))) 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 <= -3.6e-28) || !(x <= 3.5e-25)) {
tmp = x * (1.0 - y);
} else {
tmp = y * t;
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if (x <= -3.6e-28) or not (x <= 3.5e-25): tmp = x * (1.0 - y) else: tmp = y * t return tmp
function code(x, y, z, t) tmp = 0.0 if ((x <= -3.6e-28) || !(x <= 3.5e-25)) 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 <= -3.6e-28) || ~((x <= 3.5e-25))) tmp = x * (1.0 - y); else tmp = y * t; end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[Or[LessEqual[x, -3.6e-28], N[Not[LessEqual[x, 3.5e-25]], $MachinePrecision]], N[(x * N[(1.0 - y), $MachinePrecision]), $MachinePrecision], N[(y * t), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x \leq -3.6 \cdot 10^{-28} \lor \neg \left(x \leq 3.5 \cdot 10^{-25}\right):\\
\;\;\;\;x \cdot \left(1 - y\right)\\
\mathbf{else}:\\
\;\;\;\;y \cdot t\\
\end{array}
\end{array}
if x < -3.5999999999999999e-28 or 3.5000000000000002e-25 < x Initial program 100.0%
*-commutative100.0%
sub-neg100.0%
distribute-lft-in95.2%
Applied egg-rr95.2%
Taylor expanded in t around 0 79.4%
mul-1-neg79.4%
distribute-rgt-neg-in79.4%
mul-1-neg79.4%
distribute-lft-in82.1%
+-commutative82.1%
mul-1-neg82.1%
unsub-neg82.1%
Simplified82.1%
Taylor expanded in z around 0 54.0%
*-rgt-identity54.0%
mul-1-neg54.0%
distribute-rgt-neg-out54.0%
distribute-lft-in54.0%
unsub-neg54.0%
Simplified54.0%
if -3.5999999999999999e-28 < x < 3.5000000000000002e-25Initial program 99.9%
Taylor expanded in y around inf 56.5%
*-commutative56.5%
Simplified56.5%
Taylor expanded in x around 0 46.6%
*-commutative46.6%
Simplified46.6%
Final simplification50.9%
(FPCore (x y z t) :precision binary64 (if (<= y -3.4e-53) (* y t) (if (<= y 1.6e-80) x (* y t))))
double code(double x, double y, double z, double t) {
double tmp;
if (y <= -3.4e-53) {
tmp = y * t;
} else if (y <= 1.6e-80) {
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 <= (-3.4d-53)) then
tmp = y * t
else if (y <= 1.6d-80) 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 <= -3.4e-53) {
tmp = y * t;
} else if (y <= 1.6e-80) {
tmp = x;
} else {
tmp = y * t;
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if y <= -3.4e-53: tmp = y * t elif y <= 1.6e-80: tmp = x else: tmp = y * t return tmp
function code(x, y, z, t) tmp = 0.0 if (y <= -3.4e-53) tmp = Float64(y * t); elseif (y <= 1.6e-80) tmp = x; else tmp = Float64(y * t); end return tmp end
function tmp_2 = code(x, y, z, t) tmp = 0.0; if (y <= -3.4e-53) tmp = y * t; elseif (y <= 1.6e-80) tmp = x; else tmp = y * t; end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[LessEqual[y, -3.4e-53], N[(y * t), $MachinePrecision], If[LessEqual[y, 1.6e-80], x, N[(y * t), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;y \leq -3.4 \cdot 10^{-53}:\\
\;\;\;\;y \cdot t\\
\mathbf{elif}\;y \leq 1.6 \cdot 10^{-80}:\\
\;\;\;\;x\\
\mathbf{else}:\\
\;\;\;\;y \cdot t\\
\end{array}
\end{array}
if y < -3.4e-53 or 1.5999999999999999e-80 < y Initial program 99.9%
Taylor expanded in y around inf 74.4%
*-commutative74.4%
Simplified74.4%
Taylor expanded in x around 0 45.4%
*-commutative45.4%
Simplified45.4%
if -3.4e-53 < y < 1.5999999999999999e-80Initial program 100.0%
Taylor expanded in y around inf 33.8%
*-commutative33.8%
Simplified33.8%
Taylor expanded in y around 0 30.7%
Final simplification40.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 59.5%
*-commutative59.5%
Simplified59.5%
Taylor expanded in y around 0 13.3%
Final simplification13.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 2023275
(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))))