
(FPCore (x y z t) :precision binary64 (+ x (* (- y z) (- t x))))
double code(double x, double y, double z, double t) {
return x + ((y - z) * (t - x));
}
real(8) function code(x, y, z, t)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
code = x + ((y - z) * (t - x))
end function
public static double code(double x, double y, double z, double t) {
return x + ((y - z) * (t - x));
}
def code(x, y, z, t): return x + ((y - z) * (t - x))
function code(x, y, z, t) return Float64(x + Float64(Float64(y - z) * Float64(t - x))) end
function tmp = code(x, y, z, t) tmp = x + ((y - z) * (t - x)); end
code[x_, y_, z_, t_] := N[(x + N[(N[(y - z), $MachinePrecision] * N[(t - x), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
x + \left(y - z\right) \cdot \left(t - x\right)
\end{array}
Sampling outcomes in binary64 precision:
Herbie found 12 alternatives:
| Alternative | Accuracy | Speedup |
|---|
(FPCore (x y z t) :precision binary64 (+ x (* (- y z) (- t x))))
double code(double x, double y, double z, double t) {
return x + ((y - z) * (t - x));
}
real(8) function code(x, y, z, t)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
code = x + ((y - z) * (t - x))
end function
public static double code(double x, double y, double z, double t) {
return x + ((y - z) * (t - x));
}
def code(x, y, z, t): return x + ((y - z) * (t - x))
function code(x, y, z, t) return Float64(x + Float64(Float64(y - z) * Float64(t - x))) end
function tmp = code(x, y, z, t) tmp = x + ((y - z) * (t - x)); end
code[x_, y_, z_, t_] := N[(x + N[(N[(y - z), $MachinePrecision] * N[(t - x), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
x + \left(y - z\right) \cdot \left(t - x\right)
\end{array}
(FPCore (x y z t) :precision binary64 (+ x (* (- t x) (- y z))))
double code(double x, double y, double z, double t) {
return x + ((t - x) * (y - z));
}
real(8) function code(x, y, z, t)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
code = x + ((t - x) * (y - z))
end function
public static double code(double x, double y, double z, double t) {
return x + ((t - x) * (y - z));
}
def code(x, y, z, t): return x + ((t - x) * (y - z))
function code(x, y, z, t) return Float64(x + Float64(Float64(t - x) * Float64(y - z))) end
function tmp = code(x, y, z, t) tmp = x + ((t - x) * (y - z)); end
code[x_, y_, z_, t_] := N[(x + N[(N[(t - x), $MachinePrecision] * N[(y - z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
x + \left(t - x\right) \cdot \left(y - z\right)
\end{array}
Initial program 100.0%
Final simplification100.0%
(FPCore (x y z t)
:precision binary64
(let* ((t_1 (* y (- t x))) (t_2 (+ x (* t (- y z)))))
(if (<= y -9.2e+108)
t_1
(if (<= y -1.2e-29)
t_2
(if (<= y 1.56e-34)
(+ x (* z (- x t)))
(if (<= y 1.9e+77)
t_2
(if (<= y 2.8e+122) (+ x (* x (- z y))) (+ x t_1))))))))
double code(double x, double y, double z, double t) {
double t_1 = y * (t - x);
double t_2 = x + (t * (y - z));
double tmp;
if (y <= -9.2e+108) {
tmp = t_1;
} else if (y <= -1.2e-29) {
tmp = t_2;
} else if (y <= 1.56e-34) {
tmp = x + (z * (x - t));
} else if (y <= 1.9e+77) {
tmp = t_2;
} else if (y <= 2.8e+122) {
tmp = x + (x * (z - y));
} 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) :: t_2
real(8) :: tmp
t_1 = y * (t - x)
t_2 = x + (t * (y - z))
if (y <= (-9.2d+108)) then
tmp = t_1
else if (y <= (-1.2d-29)) then
tmp = t_2
else if (y <= 1.56d-34) then
tmp = x + (z * (x - t))
else if (y <= 1.9d+77) then
tmp = t_2
else if (y <= 2.8d+122) then
tmp = x + (x * (z - y))
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 = y * (t - x);
double t_2 = x + (t * (y - z));
double tmp;
if (y <= -9.2e+108) {
tmp = t_1;
} else if (y <= -1.2e-29) {
tmp = t_2;
} else if (y <= 1.56e-34) {
tmp = x + (z * (x - t));
} else if (y <= 1.9e+77) {
tmp = t_2;
} else if (y <= 2.8e+122) {
tmp = x + (x * (z - y));
} else {
tmp = x + t_1;
}
return tmp;
}
def code(x, y, z, t): t_1 = y * (t - x) t_2 = x + (t * (y - z)) tmp = 0 if y <= -9.2e+108: tmp = t_1 elif y <= -1.2e-29: tmp = t_2 elif y <= 1.56e-34: tmp = x + (z * (x - t)) elif y <= 1.9e+77: tmp = t_2 elif y <= 2.8e+122: tmp = x + (x * (z - y)) else: tmp = x + t_1 return tmp
function code(x, y, z, t) t_1 = Float64(y * Float64(t - x)) t_2 = Float64(x + Float64(t * Float64(y - z))) tmp = 0.0 if (y <= -9.2e+108) tmp = t_1; elseif (y <= -1.2e-29) tmp = t_2; elseif (y <= 1.56e-34) tmp = Float64(x + Float64(z * Float64(x - t))); elseif (y <= 1.9e+77) tmp = t_2; elseif (y <= 2.8e+122) tmp = Float64(x + Float64(x * Float64(z - y))); else tmp = Float64(x + t_1); end return tmp end
function tmp_2 = code(x, y, z, t) t_1 = y * (t - x); t_2 = x + (t * (y - z)); tmp = 0.0; if (y <= -9.2e+108) tmp = t_1; elseif (y <= -1.2e-29) tmp = t_2; elseif (y <= 1.56e-34) tmp = x + (z * (x - t)); elseif (y <= 1.9e+77) tmp = t_2; elseif (y <= 2.8e+122) tmp = x + (x * (z - y)); else tmp = x + t_1; end tmp_2 = tmp; end
code[x_, y_, z_, t_] := Block[{t$95$1 = N[(y * N[(t - x), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$2 = N[(x + N[(t * N[(y - z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[y, -9.2e+108], t$95$1, If[LessEqual[y, -1.2e-29], t$95$2, If[LessEqual[y, 1.56e-34], N[(x + N[(z * N[(x - t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[y, 1.9e+77], t$95$2, If[LessEqual[y, 2.8e+122], N[(x + N[(x * N[(z - y), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(x + t$95$1), $MachinePrecision]]]]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := y \cdot \left(t - x\right)\\
t_2 := x + t \cdot \left(y - z\right)\\
\mathbf{if}\;y \leq -9.2 \cdot 10^{+108}:\\
\;\;\;\;t_1\\
\mathbf{elif}\;y \leq -1.2 \cdot 10^{-29}:\\
\;\;\;\;t_2\\
\mathbf{elif}\;y \leq 1.56 \cdot 10^{-34}:\\
\;\;\;\;x + z \cdot \left(x - t\right)\\
\mathbf{elif}\;y \leq 1.9 \cdot 10^{+77}:\\
\;\;\;\;t_2\\
\mathbf{elif}\;y \leq 2.8 \cdot 10^{+122}:\\
\;\;\;\;x + x \cdot \left(z - y\right)\\
\mathbf{else}:\\
\;\;\;\;x + t_1\\
\end{array}
\end{array}
if y < -9.1999999999999996e108Initial program 100.0%
Taylor expanded in y around inf 87.6%
*-commutative87.6%
Simplified87.6%
Taylor expanded in x around -inf 81.2%
+-commutative81.2%
mul-1-neg81.2%
unsub-neg81.2%
*-commutative81.2%
sub-neg81.2%
metadata-eval81.2%
+-commutative81.2%
Simplified81.2%
Taylor expanded in y around inf 87.6%
if -9.1999999999999996e108 < y < -1.19999999999999996e-29 or 1.55999999999999992e-34 < y < 1.9000000000000001e77Initial program 100.0%
Taylor expanded in t around inf 81.3%
if -1.19999999999999996e-29 < y < 1.55999999999999992e-34Initial program 100.0%
Taylor expanded in y around 0 98.5%
mul-1-neg98.5%
distribute-lft-neg-out98.5%
*-commutative98.5%
Simplified98.5%
Taylor expanded in z around 0 98.5%
mul-1-neg98.5%
unsub-neg98.5%
Simplified98.5%
if 1.9000000000000001e77 < y < 2.8e122Initial program 100.0%
*-commutative100.0%
sub-neg100.0%
distribute-lft-in100.0%
Applied egg-rr100.0%
Taylor expanded in t around 0 87.0%
mul-1-neg87.0%
distribute-rgt-neg-in87.0%
mul-1-neg87.0%
distribute-lft-in87.0%
+-commutative87.0%
mul-1-neg87.0%
sub-neg87.0%
Simplified87.0%
if 2.8e122 < y Initial program 99.9%
Taylor expanded in y around inf 91.8%
*-commutative91.8%
Simplified91.8%
Final simplification91.6%
(FPCore (x y z t)
:precision binary64
(let* ((t_1 (* y (- t x))) (t_2 (* z (- x t))) (t_3 (* x (- 1.0 y))))
(if (<= z -6.2e-5)
t_2
(if (<= z -5.1e-253)
t_3
(if (<= z 6e-286)
t_1
(if (<= z 5.5e-170) t_3 (if (<= z 6e+17) t_1 t_2)))))))
double code(double x, double y, double z, double t) {
double t_1 = y * (t - x);
double t_2 = z * (x - t);
double t_3 = x * (1.0 - y);
double tmp;
if (z <= -6.2e-5) {
tmp = t_2;
} else if (z <= -5.1e-253) {
tmp = t_3;
} else if (z <= 6e-286) {
tmp = t_1;
} else if (z <= 5.5e-170) {
tmp = t_3;
} else if (z <= 6e+17) {
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) :: t_3
real(8) :: tmp
t_1 = y * (t - x)
t_2 = z * (x - t)
t_3 = x * (1.0d0 - y)
if (z <= (-6.2d-5)) then
tmp = t_2
else if (z <= (-5.1d-253)) then
tmp = t_3
else if (z <= 6d-286) then
tmp = t_1
else if (z <= 5.5d-170) then
tmp = t_3
else if (z <= 6d+17) 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 = y * (t - x);
double t_2 = z * (x - t);
double t_3 = x * (1.0 - y);
double tmp;
if (z <= -6.2e-5) {
tmp = t_2;
} else if (z <= -5.1e-253) {
tmp = t_3;
} else if (z <= 6e-286) {
tmp = t_1;
} else if (z <= 5.5e-170) {
tmp = t_3;
} else if (z <= 6e+17) {
tmp = t_1;
} else {
tmp = t_2;
}
return tmp;
}
def code(x, y, z, t): t_1 = y * (t - x) t_2 = z * (x - t) t_3 = x * (1.0 - y) tmp = 0 if z <= -6.2e-5: tmp = t_2 elif z <= -5.1e-253: tmp = t_3 elif z <= 6e-286: tmp = t_1 elif z <= 5.5e-170: tmp = t_3 elif z <= 6e+17: tmp = t_1 else: tmp = t_2 return tmp
function code(x, y, z, t) t_1 = Float64(y * Float64(t - x)) t_2 = Float64(z * Float64(x - t)) t_3 = Float64(x * Float64(1.0 - y)) tmp = 0.0 if (z <= -6.2e-5) tmp = t_2; elseif (z <= -5.1e-253) tmp = t_3; elseif (z <= 6e-286) tmp = t_1; elseif (z <= 5.5e-170) tmp = t_3; elseif (z <= 6e+17) tmp = t_1; else tmp = t_2; end return tmp end
function tmp_2 = code(x, y, z, t) t_1 = y * (t - x); t_2 = z * (x - t); t_3 = x * (1.0 - y); tmp = 0.0; if (z <= -6.2e-5) tmp = t_2; elseif (z <= -5.1e-253) tmp = t_3; elseif (z <= 6e-286) tmp = t_1; elseif (z <= 5.5e-170) tmp = t_3; elseif (z <= 6e+17) tmp = t_1; else tmp = t_2; end tmp_2 = tmp; end
code[x_, y_, z_, t_] := Block[{t$95$1 = N[(y * N[(t - x), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$2 = N[(z * N[(x - t), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$3 = N[(x * N[(1.0 - y), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[z, -6.2e-5], t$95$2, If[LessEqual[z, -5.1e-253], t$95$3, If[LessEqual[z, 6e-286], t$95$1, If[LessEqual[z, 5.5e-170], t$95$3, If[LessEqual[z, 6e+17], t$95$1, t$95$2]]]]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := y \cdot \left(t - x\right)\\
t_2 := z \cdot \left(x - t\right)\\
t_3 := x \cdot \left(1 - y\right)\\
\mathbf{if}\;z \leq -6.2 \cdot 10^{-5}:\\
\;\;\;\;t_2\\
\mathbf{elif}\;z \leq -5.1 \cdot 10^{-253}:\\
\;\;\;\;t_3\\
\mathbf{elif}\;z \leq 6 \cdot 10^{-286}:\\
\;\;\;\;t_1\\
\mathbf{elif}\;z \leq 5.5 \cdot 10^{-170}:\\
\;\;\;\;t_3\\
\mathbf{elif}\;z \leq 6 \cdot 10^{+17}:\\
\;\;\;\;t_1\\
\mathbf{else}:\\
\;\;\;\;t_2\\
\end{array}
\end{array}
if z < -6.20000000000000027e-5 or 6e17 < z Initial program 100.0%
Taylor expanded in y around 0 77.3%
mul-1-neg77.3%
distribute-lft-neg-out77.3%
*-commutative77.3%
Simplified77.3%
Taylor expanded in z around 0 77.3%
mul-1-neg77.3%
unsub-neg77.3%
Simplified77.3%
Taylor expanded in z around inf 76.5%
if -6.20000000000000027e-5 < z < -5.10000000000000008e-253 or 6.0000000000000001e-286 < z < 5.50000000000000018e-170Initial program 100.0%
Taylor expanded in y around inf 94.7%
*-commutative94.7%
Simplified94.7%
Taylor expanded in x around inf 78.3%
mul-1-neg78.3%
unsub-neg78.3%
Simplified78.3%
if -5.10000000000000008e-253 < z < 6.0000000000000001e-286 or 5.50000000000000018e-170 < z < 6e17Initial program 99.9%
Taylor expanded in y around inf 95.4%
*-commutative95.4%
Simplified95.4%
Taylor expanded in x around -inf 93.6%
+-commutative93.6%
mul-1-neg93.6%
unsub-neg93.6%
*-commutative93.6%
sub-neg93.6%
metadata-eval93.6%
+-commutative93.6%
Simplified93.6%
Taylor expanded in y around inf 76.0%
Final simplification76.9%
(FPCore (x y z t)
:precision binary64
(let* ((t_1 (* z (- x t))) (t_2 (+ x (* y t))))
(if (<= z -70.0)
t_1
(if (<= z 7.6e-287)
t_2
(if (<= z 1.45e-186)
(* x (- 1.0 y))
(if (<= z 1.55e-102) t_2 (if (<= z 2.65e+17) (* y (- t x)) t_1)))))))
double code(double x, double y, double z, double t) {
double t_1 = z * (x - t);
double t_2 = x + (y * t);
double tmp;
if (z <= -70.0) {
tmp = t_1;
} else if (z <= 7.6e-287) {
tmp = t_2;
} else if (z <= 1.45e-186) {
tmp = x * (1.0 - y);
} else if (z <= 1.55e-102) {
tmp = t_2;
} else if (z <= 2.65e+17) {
tmp = y * (t - 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 = x + (y * t)
if (z <= (-70.0d0)) then
tmp = t_1
else if (z <= 7.6d-287) then
tmp = t_2
else if (z <= 1.45d-186) then
tmp = x * (1.0d0 - y)
else if (z <= 1.55d-102) then
tmp = t_2
else if (z <= 2.65d+17) then
tmp = y * (t - 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 = x + (y * t);
double tmp;
if (z <= -70.0) {
tmp = t_1;
} else if (z <= 7.6e-287) {
tmp = t_2;
} else if (z <= 1.45e-186) {
tmp = x * (1.0 - y);
} else if (z <= 1.55e-102) {
tmp = t_2;
} else if (z <= 2.65e+17) {
tmp = y * (t - x);
} else {
tmp = t_1;
}
return tmp;
}
def code(x, y, z, t): t_1 = z * (x - t) t_2 = x + (y * t) tmp = 0 if z <= -70.0: tmp = t_1 elif z <= 7.6e-287: tmp = t_2 elif z <= 1.45e-186: tmp = x * (1.0 - y) elif z <= 1.55e-102: tmp = t_2 elif z <= 2.65e+17: tmp = y * (t - x) else: tmp = t_1 return tmp
function code(x, y, z, t) t_1 = Float64(z * Float64(x - t)) t_2 = Float64(x + Float64(y * t)) tmp = 0.0 if (z <= -70.0) tmp = t_1; elseif (z <= 7.6e-287) tmp = t_2; elseif (z <= 1.45e-186) tmp = Float64(x * Float64(1.0 - y)); elseif (z <= 1.55e-102) tmp = t_2; elseif (z <= 2.65e+17) tmp = Float64(y * Float64(t - x)); else tmp = t_1; end return tmp end
function tmp_2 = code(x, y, z, t) t_1 = z * (x - t); t_2 = x + (y * t); tmp = 0.0; if (z <= -70.0) tmp = t_1; elseif (z <= 7.6e-287) tmp = t_2; elseif (z <= 1.45e-186) tmp = x * (1.0 - y); elseif (z <= 1.55e-102) tmp = t_2; elseif (z <= 2.65e+17) tmp = y * (t - 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[(x + N[(y * t), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[z, -70.0], t$95$1, If[LessEqual[z, 7.6e-287], t$95$2, If[LessEqual[z, 1.45e-186], N[(x * N[(1.0 - y), $MachinePrecision]), $MachinePrecision], If[LessEqual[z, 1.55e-102], t$95$2, If[LessEqual[z, 2.65e+17], N[(y * N[(t - x), $MachinePrecision]), $MachinePrecision], t$95$1]]]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := z \cdot \left(x - t\right)\\
t_2 := x + y \cdot t\\
\mathbf{if}\;z \leq -70:\\
\;\;\;\;t_1\\
\mathbf{elif}\;z \leq 7.6 \cdot 10^{-287}:\\
\;\;\;\;t_2\\
\mathbf{elif}\;z \leq 1.45 \cdot 10^{-186}:\\
\;\;\;\;x \cdot \left(1 - y\right)\\
\mathbf{elif}\;z \leq 1.55 \cdot 10^{-102}:\\
\;\;\;\;t_2\\
\mathbf{elif}\;z \leq 2.65 \cdot 10^{+17}:\\
\;\;\;\;y \cdot \left(t - x\right)\\
\mathbf{else}:\\
\;\;\;\;t_1\\
\end{array}
\end{array}
if z < -70 or 2.65e17 < z Initial program 100.0%
Taylor expanded in y around 0 77.5%
mul-1-neg77.5%
distribute-lft-neg-out77.5%
*-commutative77.5%
Simplified77.5%
Taylor expanded in z around 0 77.5%
mul-1-neg77.5%
unsub-neg77.5%
Simplified77.5%
Taylor expanded in z around inf 77.5%
if -70 < z < 7.59999999999999964e-287 or 1.4500000000000001e-186 < z < 1.55000000000000006e-102Initial program 100.0%
Taylor expanded in y around inf 95.0%
*-commutative95.0%
Simplified95.0%
Taylor expanded in t around inf 79.2%
*-commutative79.2%
Simplified79.2%
if 7.59999999999999964e-287 < z < 1.4500000000000001e-186Initial program 100.0%
Taylor expanded in y around inf 94.6%
*-commutative94.6%
Simplified94.6%
Taylor expanded in x around inf 83.3%
mul-1-neg83.3%
unsub-neg83.3%
Simplified83.3%
if 1.55000000000000006e-102 < z < 2.65e17Initial program 99.9%
Taylor expanded in y around inf 89.4%
*-commutative89.4%
Simplified89.4%
Taylor expanded in x around -inf 85.2%
+-commutative85.2%
mul-1-neg85.2%
unsub-neg85.2%
*-commutative85.2%
sub-neg85.2%
metadata-eval85.2%
+-commutative85.2%
Simplified85.2%
Taylor expanded in y around inf 77.9%
Final simplification78.5%
(FPCore (x y z t) :precision binary64 (if (or (<= y -9.2e+108) (not (<= y 2.2e+52))) (* y (- t x)) (+ x (* t (- y z)))))
double code(double x, double y, double z, double t) {
double tmp;
if ((y <= -9.2e+108) || !(y <= 2.2e+52)) {
tmp = y * (t - x);
} else {
tmp = x + (t * (y - z));
}
return tmp;
}
real(8) function code(x, y, z, t)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
real(8) :: tmp
if ((y <= (-9.2d+108)) .or. (.not. (y <= 2.2d+52))) then
tmp = y * (t - x)
else
tmp = x + (t * (y - z))
end if
code = tmp
end function
public static double code(double x, double y, double z, double t) {
double tmp;
if ((y <= -9.2e+108) || !(y <= 2.2e+52)) {
tmp = y * (t - x);
} else {
tmp = x + (t * (y - z));
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if (y <= -9.2e+108) or not (y <= 2.2e+52): tmp = y * (t - x) else: tmp = x + (t * (y - z)) return tmp
function code(x, y, z, t) tmp = 0.0 if ((y <= -9.2e+108) || !(y <= 2.2e+52)) tmp = Float64(y * Float64(t - x)); else tmp = Float64(x + Float64(t * Float64(y - z))); end return tmp end
function tmp_2 = code(x, y, z, t) tmp = 0.0; if ((y <= -9.2e+108) || ~((y <= 2.2e+52))) tmp = y * (t - x); else tmp = x + (t * (y - z)); end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[Or[LessEqual[y, -9.2e+108], N[Not[LessEqual[y, 2.2e+52]], $MachinePrecision]], N[(y * N[(t - x), $MachinePrecision]), $MachinePrecision], N[(x + N[(t * N[(y - z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;y \leq -9.2 \cdot 10^{+108} \lor \neg \left(y \leq 2.2 \cdot 10^{+52}\right):\\
\;\;\;\;y \cdot \left(t - x\right)\\
\mathbf{else}:\\
\;\;\;\;x + t \cdot \left(y - z\right)\\
\end{array}
\end{array}
if y < -9.1999999999999996e108 or 2.2e52 < y Initial program 100.0%
Taylor expanded in y around inf 87.7%
*-commutative87.7%
Simplified87.7%
Taylor expanded in x around -inf 82.5%
+-commutative82.5%
mul-1-neg82.5%
unsub-neg82.5%
*-commutative82.5%
sub-neg82.5%
metadata-eval82.5%
+-commutative82.5%
Simplified82.5%
Taylor expanded in y around inf 87.7%
if -9.1999999999999996e108 < y < 2.2e52Initial program 100.0%
Taylor expanded in t around inf 79.7%
Final simplification82.6%
(FPCore (x y z t) :precision binary64 (if (or (<= x -1.95e-14) (not (<= x 1.25e+66))) (+ x (* x (- z y))) (+ x (* t (- y z)))))
double code(double x, double y, double z, double t) {
double tmp;
if ((x <= -1.95e-14) || !(x <= 1.25e+66)) {
tmp = x + (x * (z - y));
} else {
tmp = x + (t * (y - z));
}
return tmp;
}
real(8) function code(x, y, z, t)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
real(8) :: tmp
if ((x <= (-1.95d-14)) .or. (.not. (x <= 1.25d+66))) then
tmp = x + (x * (z - y))
else
tmp = x + (t * (y - z))
end if
code = tmp
end function
public static double code(double x, double y, double z, double t) {
double tmp;
if ((x <= -1.95e-14) || !(x <= 1.25e+66)) {
tmp = x + (x * (z - y));
} else {
tmp = x + (t * (y - z));
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if (x <= -1.95e-14) or not (x <= 1.25e+66): tmp = x + (x * (z - y)) else: tmp = x + (t * (y - z)) return tmp
function code(x, y, z, t) tmp = 0.0 if ((x <= -1.95e-14) || !(x <= 1.25e+66)) tmp = Float64(x + Float64(x * Float64(z - y))); else tmp = Float64(x + Float64(t * Float64(y - z))); end return tmp end
function tmp_2 = code(x, y, z, t) tmp = 0.0; if ((x <= -1.95e-14) || ~((x <= 1.25e+66))) tmp = x + (x * (z - y)); else tmp = x + (t * (y - z)); end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[Or[LessEqual[x, -1.95e-14], N[Not[LessEqual[x, 1.25e+66]], $MachinePrecision]], N[(x + N[(x * N[(z - y), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(x + N[(t * N[(y - z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x \leq -1.95 \cdot 10^{-14} \lor \neg \left(x \leq 1.25 \cdot 10^{+66}\right):\\
\;\;\;\;x + x \cdot \left(z - y\right)\\
\mathbf{else}:\\
\;\;\;\;x + t \cdot \left(y - z\right)\\
\end{array}
\end{array}
if x < -1.9499999999999999e-14 or 1.24999999999999998e66 < x Initial program 100.0%
*-commutative100.0%
sub-neg100.0%
distribute-lft-in95.6%
Applied egg-rr95.6%
Taylor expanded in t around 0 83.5%
mul-1-neg83.5%
distribute-rgt-neg-in83.5%
mul-1-neg83.5%
distribute-lft-in86.1%
+-commutative86.1%
mul-1-neg86.1%
sub-neg86.1%
Simplified86.1%
if -1.9499999999999999e-14 < x < 1.24999999999999998e66Initial program 100.0%
Taylor expanded in t around inf 85.5%
Final simplification85.8%
(FPCore (x y z t) :precision binary64 (if (or (<= z -4400000.0) (not (<= z 1.7e+130))) (* z (- x t)) (+ x (* y (- t x)))))
double code(double x, double y, double z, double t) {
double tmp;
if ((z <= -4400000.0) || !(z <= 1.7e+130)) {
tmp = z * (x - t);
} else {
tmp = x + (y * (t - x));
}
return tmp;
}
real(8) function code(x, y, z, t)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
real(8) :: tmp
if ((z <= (-4400000.0d0)) .or. (.not. (z <= 1.7d+130))) then
tmp = z * (x - t)
else
tmp = x + (y * (t - x))
end if
code = tmp
end function
public static double code(double x, double y, double z, double t) {
double tmp;
if ((z <= -4400000.0) || !(z <= 1.7e+130)) {
tmp = z * (x - t);
} else {
tmp = x + (y * (t - x));
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if (z <= -4400000.0) or not (z <= 1.7e+130): tmp = z * (x - t) else: tmp = x + (y * (t - x)) return tmp
function code(x, y, z, t) tmp = 0.0 if ((z <= -4400000.0) || !(z <= 1.7e+130)) tmp = Float64(z * Float64(x - t)); else tmp = Float64(x + Float64(y * Float64(t - x))); end return tmp end
function tmp_2 = code(x, y, z, t) tmp = 0.0; if ((z <= -4400000.0) || ~((z <= 1.7e+130))) tmp = z * (x - t); else tmp = x + (y * (t - x)); end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[Or[LessEqual[z, -4400000.0], N[Not[LessEqual[z, 1.7e+130]], $MachinePrecision]], N[(z * N[(x - t), $MachinePrecision]), $MachinePrecision], N[(x + N[(y * N[(t - x), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \leq -4400000 \lor \neg \left(z \leq 1.7 \cdot 10^{+130}\right):\\
\;\;\;\;z \cdot \left(x - t\right)\\
\mathbf{else}:\\
\;\;\;\;x + y \cdot \left(t - x\right)\\
\end{array}
\end{array}
if z < -4.4e6 or 1.7e130 < z Initial program 100.0%
Taylor expanded in y around 0 81.7%
mul-1-neg81.7%
distribute-lft-neg-out81.7%
*-commutative81.7%
Simplified81.7%
Taylor expanded in z around 0 81.7%
mul-1-neg81.7%
unsub-neg81.7%
Simplified81.7%
Taylor expanded in z around inf 81.7%
if -4.4e6 < z < 1.7e130Initial program 100.0%
Taylor expanded in y around inf 88.9%
*-commutative88.9%
Simplified88.9%
Final simplification85.9%
(FPCore (x y z t) :precision binary64 (if (or (<= y -0.00048) (not (<= y 3000000.0))) (* y (- t x)) (* x (- 1.0 y))))
double code(double x, double y, double z, double t) {
double tmp;
if ((y <= -0.00048) || !(y <= 3000000.0)) {
tmp = y * (t - x);
} 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 ((y <= (-0.00048d0)) .or. (.not. (y <= 3000000.0d0))) then
tmp = y * (t - x)
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 ((y <= -0.00048) || !(y <= 3000000.0)) {
tmp = y * (t - x);
} else {
tmp = x * (1.0 - y);
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if (y <= -0.00048) or not (y <= 3000000.0): tmp = y * (t - x) else: tmp = x * (1.0 - y) return tmp
function code(x, y, z, t) tmp = 0.0 if ((y <= -0.00048) || !(y <= 3000000.0)) tmp = Float64(y * Float64(t - x)); else tmp = Float64(x * Float64(1.0 - y)); end return tmp end
function tmp_2 = code(x, y, z, t) tmp = 0.0; if ((y <= -0.00048) || ~((y <= 3000000.0))) tmp = y * (t - x); else tmp = x * (1.0 - y); end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[Or[LessEqual[y, -0.00048], N[Not[LessEqual[y, 3000000.0]], $MachinePrecision]], N[(y * N[(t - x), $MachinePrecision]), $MachinePrecision], N[(x * N[(1.0 - y), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;y \leq -0.00048 \lor \neg \left(y \leq 3000000\right):\\
\;\;\;\;y \cdot \left(t - x\right)\\
\mathbf{else}:\\
\;\;\;\;x \cdot \left(1 - y\right)\\
\end{array}
\end{array}
if y < -4.80000000000000012e-4 or 3e6 < y Initial program 100.0%
Taylor expanded in y around inf 79.6%
*-commutative79.6%
Simplified79.6%
Taylor expanded in x around -inf 75.8%
+-commutative75.8%
mul-1-neg75.8%
unsub-neg75.8%
*-commutative75.8%
sub-neg75.8%
metadata-eval75.8%
+-commutative75.8%
Simplified75.8%
Taylor expanded in y around inf 79.6%
if -4.80000000000000012e-4 < y < 3e6Initial program 100.0%
Taylor expanded in y around inf 46.8%
*-commutative46.8%
Simplified46.8%
Taylor expanded in x around inf 43.6%
mul-1-neg43.6%
unsub-neg43.6%
Simplified43.6%
Final simplification61.7%
(FPCore (x y z t) :precision binary64 (if (or (<= y -1960.0) (not (<= y 170000.0))) (* y (- t x)) (- x (* z t))))
double code(double x, double y, double z, double t) {
double tmp;
if ((y <= -1960.0) || !(y <= 170000.0)) {
tmp = y * (t - x);
} else {
tmp = x - (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 ((y <= (-1960.0d0)) .or. (.not. (y <= 170000.0d0))) then
tmp = y * (t - x)
else
tmp = x - (z * t)
end if
code = tmp
end function
public static double code(double x, double y, double z, double t) {
double tmp;
if ((y <= -1960.0) || !(y <= 170000.0)) {
tmp = y * (t - x);
} else {
tmp = x - (z * t);
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if (y <= -1960.0) or not (y <= 170000.0): tmp = y * (t - x) else: tmp = x - (z * t) return tmp
function code(x, y, z, t) tmp = 0.0 if ((y <= -1960.0) || !(y <= 170000.0)) tmp = Float64(y * Float64(t - x)); else tmp = Float64(x - Float64(z * t)); end return tmp end
function tmp_2 = code(x, y, z, t) tmp = 0.0; if ((y <= -1960.0) || ~((y <= 170000.0))) tmp = y * (t - x); else tmp = x - (z * t); end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[Or[LessEqual[y, -1960.0], N[Not[LessEqual[y, 170000.0]], $MachinePrecision]], N[(y * N[(t - x), $MachinePrecision]), $MachinePrecision], N[(x - N[(z * t), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;y \leq -1960 \lor \neg \left(y \leq 170000\right):\\
\;\;\;\;y \cdot \left(t - x\right)\\
\mathbf{else}:\\
\;\;\;\;x - z \cdot t\\
\end{array}
\end{array}
if y < -1960 or 1.7e5 < y Initial program 100.0%
Taylor expanded in y around inf 80.4%
*-commutative80.4%
Simplified80.4%
Taylor expanded in x around -inf 76.6%
+-commutative76.6%
mul-1-neg76.6%
unsub-neg76.6%
*-commutative76.6%
sub-neg76.6%
metadata-eval76.6%
+-commutative76.6%
Simplified76.6%
Taylor expanded in y around inf 80.0%
if -1960 < y < 1.7e5Initial program 100.0%
Taylor expanded in y around 0 95.5%
mul-1-neg95.5%
distribute-lft-neg-out95.5%
*-commutative95.5%
Simplified95.5%
Taylor expanded in t around inf 76.3%
mul-1-neg76.3%
distribute-rgt-neg-in76.3%
Simplified76.3%
Final simplification78.2%
(FPCore (x y z t) :precision binary64 (if (or (<= y -760.0) (not (<= y 0.66))) (* y (- x)) x))
double code(double x, double y, double z, double t) {
double tmp;
if ((y <= -760.0) || !(y <= 0.66)) {
tmp = y * -x;
} 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 <= (-760.0d0)) .or. (.not. (y <= 0.66d0))) then
tmp = y * -x
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 <= -760.0) || !(y <= 0.66)) {
tmp = y * -x;
} else {
tmp = x;
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if (y <= -760.0) or not (y <= 0.66): tmp = y * -x else: tmp = x return tmp
function code(x, y, z, t) tmp = 0.0 if ((y <= -760.0) || !(y <= 0.66)) tmp = Float64(y * Float64(-x)); else tmp = x; end return tmp end
function tmp_2 = code(x, y, z, t) tmp = 0.0; if ((y <= -760.0) || ~((y <= 0.66))) tmp = y * -x; else tmp = x; end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[Or[LessEqual[y, -760.0], N[Not[LessEqual[y, 0.66]], $MachinePrecision]], N[(y * (-x)), $MachinePrecision], x]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;y \leq -760 \lor \neg \left(y \leq 0.66\right):\\
\;\;\;\;y \cdot \left(-x\right)\\
\mathbf{else}:\\
\;\;\;\;x\\
\end{array}
\end{array}
if y < -760 or 0.660000000000000031 < y Initial program 100.0%
Taylor expanded in y around inf 79.8%
*-commutative79.8%
Simplified79.8%
Taylor expanded in x around inf 40.9%
mul-1-neg40.9%
unsub-neg40.9%
Simplified40.9%
Taylor expanded in y around inf 40.5%
mul-1-neg40.5%
distribute-rgt-neg-out40.5%
Simplified40.5%
if -760 < y < 0.660000000000000031Initial program 100.0%
Taylor expanded in y around inf 46.4%
*-commutative46.4%
Simplified46.4%
Taylor expanded in y around 0 42.5%
Final simplification41.5%
(FPCore (x y z t) :precision binary64 (* x (- 1.0 y)))
double code(double x, double y, double z, double t) {
return x * (1.0 - y);
}
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 * (1.0d0 - y)
end function
public static double code(double x, double y, double z, double t) {
return x * (1.0 - y);
}
def code(x, y, z, t): return x * (1.0 - y)
function code(x, y, z, t) return Float64(x * Float64(1.0 - y)) end
function tmp = code(x, y, z, t) tmp = x * (1.0 - y); end
code[x_, y_, z_, t_] := N[(x * N[(1.0 - y), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
x \cdot \left(1 - y\right)
\end{array}
Initial program 100.0%
Taylor expanded in y around inf 63.4%
*-commutative63.4%
Simplified63.4%
Taylor expanded in x around inf 42.0%
mul-1-neg42.0%
unsub-neg42.0%
Simplified42.0%
Final simplification42.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 63.4%
*-commutative63.4%
Simplified63.4%
Taylor expanded in y around 0 22.4%
Final simplification22.4%
(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 2023318
(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))))