
(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 (+ 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 (* t (- z y)))) (t_2 (+ x (* y (- t x)))))
(if (<= y -4.4e+101)
t_2
(if (<= y -2.2e-174)
t_1
(if (<= y -1.1e-199)
(+ x (* x z))
(if (<= y -3.6e-242)
t_1
(if (<= y -1.95e-275)
(* x (+ z 1.0))
(if (<= y 5.3e+133) t_1 t_2))))))))
double code(double x, double y, double z, double t) {
double t_1 = x - (t * (z - y));
double t_2 = x + (y * (t - x));
double tmp;
if (y <= -4.4e+101) {
tmp = t_2;
} else if (y <= -2.2e-174) {
tmp = t_1;
} else if (y <= -1.1e-199) {
tmp = x + (x * z);
} else if (y <= -3.6e-242) {
tmp = t_1;
} else if (y <= -1.95e-275) {
tmp = x * (z + 1.0);
} else if (y <= 5.3e+133) {
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 = x - (t * (z - y))
t_2 = x + (y * (t - x))
if (y <= (-4.4d+101)) then
tmp = t_2
else if (y <= (-2.2d-174)) then
tmp = t_1
else if (y <= (-1.1d-199)) then
tmp = x + (x * z)
else if (y <= (-3.6d-242)) then
tmp = t_1
else if (y <= (-1.95d-275)) then
tmp = x * (z + 1.0d0)
else if (y <= 5.3d+133) 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 = x - (t * (z - y));
double t_2 = x + (y * (t - x));
double tmp;
if (y <= -4.4e+101) {
tmp = t_2;
} else if (y <= -2.2e-174) {
tmp = t_1;
} else if (y <= -1.1e-199) {
tmp = x + (x * z);
} else if (y <= -3.6e-242) {
tmp = t_1;
} else if (y <= -1.95e-275) {
tmp = x * (z + 1.0);
} else if (y <= 5.3e+133) {
tmp = t_1;
} else {
tmp = t_2;
}
return tmp;
}
def code(x, y, z, t): t_1 = x - (t * (z - y)) t_2 = x + (y * (t - x)) tmp = 0 if y <= -4.4e+101: tmp = t_2 elif y <= -2.2e-174: tmp = t_1 elif y <= -1.1e-199: tmp = x + (x * z) elif y <= -3.6e-242: tmp = t_1 elif y <= -1.95e-275: tmp = x * (z + 1.0) elif y <= 5.3e+133: tmp = t_1 else: tmp = t_2 return tmp
function code(x, y, z, t) t_1 = Float64(x - Float64(t * Float64(z - y))) t_2 = Float64(x + Float64(y * Float64(t - x))) tmp = 0.0 if (y <= -4.4e+101) tmp = t_2; elseif (y <= -2.2e-174) tmp = t_1; elseif (y <= -1.1e-199) tmp = Float64(x + Float64(x * z)); elseif (y <= -3.6e-242) tmp = t_1; elseif (y <= -1.95e-275) tmp = Float64(x * Float64(z + 1.0)); elseif (y <= 5.3e+133) tmp = t_1; else tmp = t_2; end return tmp end
function tmp_2 = code(x, y, z, t) t_1 = x - (t * (z - y)); t_2 = x + (y * (t - x)); tmp = 0.0; if (y <= -4.4e+101) tmp = t_2; elseif (y <= -2.2e-174) tmp = t_1; elseif (y <= -1.1e-199) tmp = x + (x * z); elseif (y <= -3.6e-242) tmp = t_1; elseif (y <= -1.95e-275) tmp = x * (z + 1.0); elseif (y <= 5.3e+133) tmp = t_1; else tmp = t_2; end tmp_2 = tmp; end
code[x_, y_, z_, t_] := Block[{t$95$1 = N[(x - N[(t * N[(z - y), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$2 = N[(x + N[(y * N[(t - x), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[y, -4.4e+101], t$95$2, If[LessEqual[y, -2.2e-174], t$95$1, If[LessEqual[y, -1.1e-199], N[(x + N[(x * z), $MachinePrecision]), $MachinePrecision], If[LessEqual[y, -3.6e-242], t$95$1, If[LessEqual[y, -1.95e-275], N[(x * N[(z + 1.0), $MachinePrecision]), $MachinePrecision], If[LessEqual[y, 5.3e+133], t$95$1, t$95$2]]]]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := x - t \cdot \left(z - y\right)\\
t_2 := x + y \cdot \left(t - x\right)\\
\mathbf{if}\;y \leq -4.4 \cdot 10^{+101}:\\
\;\;\;\;t_2\\
\mathbf{elif}\;y \leq -2.2 \cdot 10^{-174}:\\
\;\;\;\;t_1\\
\mathbf{elif}\;y \leq -1.1 \cdot 10^{-199}:\\
\;\;\;\;x + x \cdot z\\
\mathbf{elif}\;y \leq -3.6 \cdot 10^{-242}:\\
\;\;\;\;t_1\\
\mathbf{elif}\;y \leq -1.95 \cdot 10^{-275}:\\
\;\;\;\;x \cdot \left(z + 1\right)\\
\mathbf{elif}\;y \leq 5.3 \cdot 10^{+133}:\\
\;\;\;\;t_1\\
\mathbf{else}:\\
\;\;\;\;t_2\\
\end{array}
\end{array}
if y < -4.4000000000000001e101 or 5.29999999999999997e133 < y Initial program 100.0%
Taylor expanded in z around 0 88.0%
if -4.4000000000000001e101 < y < -2.20000000000000022e-174 or -1.0999999999999999e-199 < y < -3.60000000000000014e-242 or -1.94999999999999986e-275 < y < 5.29999999999999997e133Initial program 100.0%
Taylor expanded in t around inf 83.3%
if -2.20000000000000022e-174 < y < -1.0999999999999999e-199Initial program 100.0%
*-commutative100.0%
flip--100.0%
associate-*r/85.2%
Applied egg-rr85.2%
associate-/l*99.5%
difference-of-squares99.5%
associate-/r*99.7%
*-inverses99.7%
Simplified99.7%
Taylor expanded in y around 0 99.7%
Taylor expanded in t around 0 100.0%
if -3.60000000000000014e-242 < y < -1.94999999999999986e-275Initial program 100.0%
Taylor expanded in y around 0 100.0%
+-commutative100.0%
mul-1-neg100.0%
unsub-neg100.0%
*-commutative100.0%
Simplified100.0%
Taylor expanded in x around -inf 89.4%
Final simplification85.4%
(FPCore (x y z t)
:precision binary64
(let* ((t_1 (- (* x y))))
(if (<= y -0.037)
t_1
(if (<= y -1.95e-227)
x
(if (<= y -1.95e-275) (* x z) (if (<= y 7.0) x t_1))))))
double code(double x, double y, double z, double t) {
double t_1 = -(x * y);
double tmp;
if (y <= -0.037) {
tmp = t_1;
} else if (y <= -1.95e-227) {
tmp = x;
} else if (y <= -1.95e-275) {
tmp = x * z;
} else if (y <= 7.0) {
tmp = x;
} else {
tmp = t_1;
}
return tmp;
}
real(8) function code(x, y, z, t)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
real(8) :: t_1
real(8) :: tmp
t_1 = -(x * y)
if (y <= (-0.037d0)) then
tmp = t_1
else if (y <= (-1.95d-227)) then
tmp = x
else if (y <= (-1.95d-275)) then
tmp = x * z
else if (y <= 7.0d0) then
tmp = x
else
tmp = t_1
end if
code = tmp
end function
public static double code(double x, double y, double z, double t) {
double t_1 = -(x * y);
double tmp;
if (y <= -0.037) {
tmp = t_1;
} else if (y <= -1.95e-227) {
tmp = x;
} else if (y <= -1.95e-275) {
tmp = x * z;
} else if (y <= 7.0) {
tmp = x;
} else {
tmp = t_1;
}
return tmp;
}
def code(x, y, z, t): t_1 = -(x * y) tmp = 0 if y <= -0.037: tmp = t_1 elif y <= -1.95e-227: tmp = x elif y <= -1.95e-275: tmp = x * z elif y <= 7.0: tmp = x else: tmp = t_1 return tmp
function code(x, y, z, t) t_1 = Float64(-Float64(x * y)) tmp = 0.0 if (y <= -0.037) tmp = t_1; elseif (y <= -1.95e-227) tmp = x; elseif (y <= -1.95e-275) tmp = Float64(x * z); elseif (y <= 7.0) tmp = x; else tmp = t_1; end return tmp end
function tmp_2 = code(x, y, z, t) t_1 = -(x * y); tmp = 0.0; if (y <= -0.037) tmp = t_1; elseif (y <= -1.95e-227) tmp = x; elseif (y <= -1.95e-275) tmp = x * z; elseif (y <= 7.0) tmp = x; else tmp = t_1; end tmp_2 = tmp; end
code[x_, y_, z_, t_] := Block[{t$95$1 = (-N[(x * y), $MachinePrecision])}, If[LessEqual[y, -0.037], t$95$1, If[LessEqual[y, -1.95e-227], x, If[LessEqual[y, -1.95e-275], N[(x * z), $MachinePrecision], If[LessEqual[y, 7.0], x, t$95$1]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := -x \cdot y\\
\mathbf{if}\;y \leq -0.037:\\
\;\;\;\;t_1\\
\mathbf{elif}\;y \leq -1.95 \cdot 10^{-227}:\\
\;\;\;\;x\\
\mathbf{elif}\;y \leq -1.95 \cdot 10^{-275}:\\
\;\;\;\;x \cdot z\\
\mathbf{elif}\;y \leq 7:\\
\;\;\;\;x\\
\mathbf{else}:\\
\;\;\;\;t_1\\
\end{array}
\end{array}
if y < -0.0369999999999999982 or 7 < y Initial program 100.0%
Taylor expanded in x around inf 46.7%
*-commutative46.7%
mul-1-neg46.7%
unsub-neg46.7%
distribute-lft-out--46.7%
*-rgt-identity46.7%
Simplified46.7%
Taylor expanded in z around 0 43.5%
Taylor expanded in y around inf 37.8%
mul-1-neg37.8%
distribute-rgt-neg-out37.8%
Simplified37.8%
if -0.0369999999999999982 < y < -1.95e-227 or -1.94999999999999986e-275 < y < 7Initial program 100.0%
Taylor expanded in y around 0 91.3%
+-commutative91.3%
mul-1-neg91.3%
unsub-neg91.3%
*-commutative91.3%
Simplified91.3%
Taylor expanded in z around 0 39.8%
if -1.95e-227 < y < -1.94999999999999986e-275Initial program 100.0%
Taylor expanded in x around inf 70.1%
*-commutative70.1%
mul-1-neg70.1%
unsub-neg70.1%
distribute-lft-out--70.1%
*-rgt-identity70.1%
Simplified70.1%
Taylor expanded in z around inf 55.5%
Final simplification39.6%
(FPCore (x y z t) :precision binary64 (if (or (<= x -1.32e+54) (not (<= x 4.45e+55))) (+ x (* x (- z y))) (- x (* t (- z y)))))
double code(double x, double y, double z, double t) {
double tmp;
if ((x <= -1.32e+54) || !(x <= 4.45e+55)) {
tmp = x + (x * (z - y));
} 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.32d+54)) .or. (.not. (x <= 4.45d+55))) then
tmp = x + (x * (z - y))
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.32e+54) || !(x <= 4.45e+55)) {
tmp = x + (x * (z - y));
} else {
tmp = x - (t * (z - y));
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if (x <= -1.32e+54) or not (x <= 4.45e+55): tmp = x + (x * (z - y)) else: tmp = x - (t * (z - y)) return tmp
function code(x, y, z, t) tmp = 0.0 if ((x <= -1.32e+54) || !(x <= 4.45e+55)) tmp = Float64(x + Float64(x * Float64(z - y))); 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.32e+54) || ~((x <= 4.45e+55))) tmp = x + (x * (z - y)); else tmp = x - (t * (z - y)); end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[Or[LessEqual[x, -1.32e+54], N[Not[LessEqual[x, 4.45e+55]], $MachinePrecision]], N[(x + N[(x * N[(z - y), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(x - N[(t * N[(z - y), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x \leq -1.32 \cdot 10^{+54} \lor \neg \left(x \leq 4.45 \cdot 10^{+55}\right):\\
\;\;\;\;x + x \cdot \left(z - y\right)\\
\mathbf{else}:\\
\;\;\;\;x - t \cdot \left(z - y\right)\\
\end{array}
\end{array}
if x < -1.3200000000000001e54 or 4.4500000000000001e55 < x Initial program 100.0%
Taylor expanded in x around inf 90.7%
*-commutative90.7%
mul-1-neg90.7%
unsub-neg90.7%
distribute-lft-out--90.7%
*-rgt-identity90.7%
Simplified90.7%
if -1.3200000000000001e54 < x < 4.4500000000000001e55Initial program 100.0%
Taylor expanded in t around inf 82.9%
Final simplification86.1%
(FPCore (x y z t) :precision binary64 (if (or (<= y -62000000000.0) (not (<= y 2e+18))) (+ x (* y (- t x))) (+ x (* z (- x t)))))
double code(double x, double y, double z, double t) {
double tmp;
if ((y <= -62000000000.0) || !(y <= 2e+18)) {
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 <= (-62000000000.0d0)) .or. (.not. (y <= 2d+18))) 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 <= -62000000000.0) || !(y <= 2e+18)) {
tmp = x + (y * (t - x));
} else {
tmp = x + (z * (x - t));
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if (y <= -62000000000.0) or not (y <= 2e+18): tmp = x + (y * (t - x)) else: tmp = x + (z * (x - t)) return tmp
function code(x, y, z, t) tmp = 0.0 if ((y <= -62000000000.0) || !(y <= 2e+18)) 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 <= -62000000000.0) || ~((y <= 2e+18))) 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, -62000000000.0], N[Not[LessEqual[y, 2e+18]], $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 -62000000000 \lor \neg \left(y \leq 2 \cdot 10^{+18}\right):\\
\;\;\;\;x + y \cdot \left(t - x\right)\\
\mathbf{else}:\\
\;\;\;\;x + z \cdot \left(x - t\right)\\
\end{array}
\end{array}
if y < -6.2e10 or 2e18 < y Initial program 100.0%
Taylor expanded in z around 0 82.7%
if -6.2e10 < y < 2e18Initial program 100.0%
Taylor expanded in y around 0 90.4%
+-commutative90.4%
mul-1-neg90.4%
unsub-neg90.4%
*-commutative90.4%
Simplified90.4%
Final simplification86.9%
(FPCore (x y z t) :precision binary64 (if (<= x -1.45e+244) (- x (* x y)) (if (<= x 1.3e+56) (- x (* t (- z y))) (* x (+ z 1.0)))))
double code(double x, double y, double z, double t) {
double tmp;
if (x <= -1.45e+244) {
tmp = x - (x * y);
} else if (x <= 1.3e+56) {
tmp = x - (t * (z - y));
} else {
tmp = x * (z + 1.0);
}
return tmp;
}
real(8) function code(x, y, z, t)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
real(8) :: tmp
if (x <= (-1.45d+244)) then
tmp = x - (x * y)
else if (x <= 1.3d+56) then
tmp = x - (t * (z - y))
else
tmp = x * (z + 1.0d0)
end if
code = tmp
end function
public static double code(double x, double y, double z, double t) {
double tmp;
if (x <= -1.45e+244) {
tmp = x - (x * y);
} else if (x <= 1.3e+56) {
tmp = x - (t * (z - y));
} else {
tmp = x * (z + 1.0);
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if x <= -1.45e+244: tmp = x - (x * y) elif x <= 1.3e+56: tmp = x - (t * (z - y)) else: tmp = x * (z + 1.0) return tmp
function code(x, y, z, t) tmp = 0.0 if (x <= -1.45e+244) tmp = Float64(x - Float64(x * y)); elseif (x <= 1.3e+56) tmp = Float64(x - Float64(t * Float64(z - y))); else tmp = Float64(x * Float64(z + 1.0)); end return tmp end
function tmp_2 = code(x, y, z, t) tmp = 0.0; if (x <= -1.45e+244) tmp = x - (x * y); elseif (x <= 1.3e+56) tmp = x - (t * (z - y)); else tmp = x * (z + 1.0); end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[LessEqual[x, -1.45e+244], N[(x - N[(x * y), $MachinePrecision]), $MachinePrecision], If[LessEqual[x, 1.3e+56], N[(x - N[(t * N[(z - y), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(x * N[(z + 1.0), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x \leq -1.45 \cdot 10^{+244}:\\
\;\;\;\;x - x \cdot y\\
\mathbf{elif}\;x \leq 1.3 \cdot 10^{+56}:\\
\;\;\;\;x - t \cdot \left(z - y\right)\\
\mathbf{else}:\\
\;\;\;\;x \cdot \left(z + 1\right)\\
\end{array}
\end{array}
if x < -1.4500000000000001e244Initial program 100.0%
Taylor expanded in x around inf 100.0%
*-commutative100.0%
mul-1-neg100.0%
unsub-neg100.0%
distribute-lft-out--100.0%
*-rgt-identity100.0%
Simplified100.0%
Taylor expanded in y around inf 83.3%
if -1.4500000000000001e244 < x < 1.30000000000000005e56Initial program 100.0%
Taylor expanded in t around inf 79.2%
if 1.30000000000000005e56 < x Initial program 100.0%
Taylor expanded in y around 0 72.3%
+-commutative72.3%
mul-1-neg72.3%
unsub-neg72.3%
*-commutative72.3%
Simplified72.3%
Taylor expanded in x around -inf 67.4%
Final simplification76.7%
(FPCore (x y z t) :precision binary64 (if (or (<= y -130.0) (not (<= y 130000000.0))) (- (* x y)) (* x (+ z 1.0))))
double code(double x, double y, double z, double t) {
double tmp;
if ((y <= -130.0) || !(y <= 130000000.0)) {
tmp = -(x * y);
} else {
tmp = x * (z + 1.0);
}
return tmp;
}
real(8) function code(x, y, z, t)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
real(8) :: tmp
if ((y <= (-130.0d0)) .or. (.not. (y <= 130000000.0d0))) then
tmp = -(x * y)
else
tmp = x * (z + 1.0d0)
end if
code = tmp
end function
public static double code(double x, double y, double z, double t) {
double tmp;
if ((y <= -130.0) || !(y <= 130000000.0)) {
tmp = -(x * y);
} else {
tmp = x * (z + 1.0);
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if (y <= -130.0) or not (y <= 130000000.0): tmp = -(x * y) else: tmp = x * (z + 1.0) return tmp
function code(x, y, z, t) tmp = 0.0 if ((y <= -130.0) || !(y <= 130000000.0)) tmp = Float64(-Float64(x * y)); else tmp = Float64(x * Float64(z + 1.0)); end return tmp end
function tmp_2 = code(x, y, z, t) tmp = 0.0; if ((y <= -130.0) || ~((y <= 130000000.0))) tmp = -(x * y); else tmp = x * (z + 1.0); end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[Or[LessEqual[y, -130.0], N[Not[LessEqual[y, 130000000.0]], $MachinePrecision]], (-N[(x * y), $MachinePrecision]), N[(x * N[(z + 1.0), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;y \leq -130 \lor \neg \left(y \leq 130000000\right):\\
\;\;\;\;-x \cdot y\\
\mathbf{else}:\\
\;\;\;\;x \cdot \left(z + 1\right)\\
\end{array}
\end{array}
if y < -130 or 1.3e8 < y Initial program 100.0%
Taylor expanded in x around inf 46.3%
*-commutative46.3%
mul-1-neg46.3%
unsub-neg46.3%
distribute-lft-out--46.3%
*-rgt-identity46.3%
Simplified46.3%
Taylor expanded in z around 0 43.0%
Taylor expanded in y around inf 38.1%
mul-1-neg38.1%
distribute-rgt-neg-out38.1%
Simplified38.1%
if -130 < y < 1.3e8Initial program 100.0%
Taylor expanded in y around 0 91.5%
+-commutative91.5%
mul-1-neg91.5%
unsub-neg91.5%
*-commutative91.5%
Simplified91.5%
Taylor expanded in x around -inf 58.8%
Final simplification48.9%
(FPCore (x y z t) :precision binary64 (if (or (<= x -4.2e+53) (not (<= x 7.1e+55))) (* x (+ z 1.0)) (+ x (* y t))))
double code(double x, double y, double z, double t) {
double tmp;
if ((x <= -4.2e+53) || !(x <= 7.1e+55)) {
tmp = x * (z + 1.0);
} else {
tmp = x + (y * t);
}
return tmp;
}
real(8) function code(x, y, z, t)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
real(8) :: tmp
if ((x <= (-4.2d+53)) .or. (.not. (x <= 7.1d+55))) then
tmp = x * (z + 1.0d0)
else
tmp = x + (y * t)
end if
code = tmp
end function
public static double code(double x, double y, double z, double t) {
double tmp;
if ((x <= -4.2e+53) || !(x <= 7.1e+55)) {
tmp = x * (z + 1.0);
} else {
tmp = x + (y * t);
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if (x <= -4.2e+53) or not (x <= 7.1e+55): tmp = x * (z + 1.0) else: tmp = x + (y * t) return tmp
function code(x, y, z, t) tmp = 0.0 if ((x <= -4.2e+53) || !(x <= 7.1e+55)) tmp = Float64(x * Float64(z + 1.0)); else tmp = Float64(x + Float64(y * t)); end return tmp end
function tmp_2 = code(x, y, z, t) tmp = 0.0; if ((x <= -4.2e+53) || ~((x <= 7.1e+55))) tmp = x * (z + 1.0); else tmp = x + (y * t); end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[Or[LessEqual[x, -4.2e+53], N[Not[LessEqual[x, 7.1e+55]], $MachinePrecision]], N[(x * N[(z + 1.0), $MachinePrecision]), $MachinePrecision], N[(x + N[(y * t), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x \leq -4.2 \cdot 10^{+53} \lor \neg \left(x \leq 7.1 \cdot 10^{+55}\right):\\
\;\;\;\;x \cdot \left(z + 1\right)\\
\mathbf{else}:\\
\;\;\;\;x + y \cdot t\\
\end{array}
\end{array}
if x < -4.2000000000000004e53 or 7.1e55 < x Initial program 100.0%
Taylor expanded in y around 0 72.4%
+-commutative72.4%
mul-1-neg72.4%
unsub-neg72.4%
*-commutative72.4%
Simplified72.4%
Taylor expanded in x around -inf 65.2%
if -4.2000000000000004e53 < x < 7.1e55Initial program 100.0%
Taylor expanded in t around inf 82.9%
Taylor expanded in y around inf 49.1%
Final simplification55.7%
(FPCore (x y z t) :precision binary64 (if (<= x -3.05e+53) (+ x (* x z)) (if (<= x 1.76e+55) (+ x (* y t)) (* x (+ z 1.0)))))
double code(double x, double y, double z, double t) {
double tmp;
if (x <= -3.05e+53) {
tmp = x + (x * z);
} else if (x <= 1.76e+55) {
tmp = x + (y * t);
} else {
tmp = x * (z + 1.0);
}
return tmp;
}
real(8) function code(x, y, z, t)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
real(8) :: tmp
if (x <= (-3.05d+53)) then
tmp = x + (x * z)
else if (x <= 1.76d+55) then
tmp = x + (y * t)
else
tmp = x * (z + 1.0d0)
end if
code = tmp
end function
public static double code(double x, double y, double z, double t) {
double tmp;
if (x <= -3.05e+53) {
tmp = x + (x * z);
} else if (x <= 1.76e+55) {
tmp = x + (y * t);
} else {
tmp = x * (z + 1.0);
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if x <= -3.05e+53: tmp = x + (x * z) elif x <= 1.76e+55: tmp = x + (y * t) else: tmp = x * (z + 1.0) return tmp
function code(x, y, z, t) tmp = 0.0 if (x <= -3.05e+53) tmp = Float64(x + Float64(x * z)); elseif (x <= 1.76e+55) tmp = Float64(x + Float64(y * t)); else tmp = Float64(x * Float64(z + 1.0)); end return tmp end
function tmp_2 = code(x, y, z, t) tmp = 0.0; if (x <= -3.05e+53) tmp = x + (x * z); elseif (x <= 1.76e+55) tmp = x + (y * t); else tmp = x * (z + 1.0); end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[LessEqual[x, -3.05e+53], N[(x + N[(x * z), $MachinePrecision]), $MachinePrecision], If[LessEqual[x, 1.76e+55], N[(x + N[(y * t), $MachinePrecision]), $MachinePrecision], N[(x * N[(z + 1.0), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x \leq -3.05 \cdot 10^{+53}:\\
\;\;\;\;x + x \cdot z\\
\mathbf{elif}\;x \leq 1.76 \cdot 10^{+55}:\\
\;\;\;\;x + y \cdot t\\
\mathbf{else}:\\
\;\;\;\;x \cdot \left(z + 1\right)\\
\end{array}
\end{array}
if x < -3.0500000000000001e53Initial program 100.0%
*-commutative100.0%
flip--91.4%
associate-*r/83.4%
Applied egg-rr83.4%
associate-/l*91.3%
difference-of-squares93.7%
associate-/r*99.9%
*-inverses99.9%
Simplified99.9%
Taylor expanded in y around 0 72.4%
Taylor expanded in t around 0 62.4%
if -3.0500000000000001e53 < x < 1.75999999999999992e55Initial program 100.0%
Taylor expanded in t around inf 82.9%
Taylor expanded in y around inf 49.1%
if 1.75999999999999992e55 < x Initial program 100.0%
Taylor expanded in y around 0 72.3%
+-commutative72.3%
mul-1-neg72.3%
unsub-neg72.3%
*-commutative72.3%
Simplified72.3%
Taylor expanded in x around -inf 67.4%
Final simplification55.8%
(FPCore (x y z t) :precision binary64 (if (<= x -1.15e+38) (- x (* x y)) (if (<= x 6.2e+55) (+ x (* y t)) (* x (+ z 1.0)))))
double code(double x, double y, double z, double t) {
double tmp;
if (x <= -1.15e+38) {
tmp = x - (x * y);
} else if (x <= 6.2e+55) {
tmp = x + (y * t);
} else {
tmp = x * (z + 1.0);
}
return tmp;
}
real(8) function code(x, y, z, t)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
real(8) :: tmp
if (x <= (-1.15d+38)) then
tmp = x - (x * y)
else if (x <= 6.2d+55) then
tmp = x + (y * t)
else
tmp = x * (z + 1.0d0)
end if
code = tmp
end function
public static double code(double x, double y, double z, double t) {
double tmp;
if (x <= -1.15e+38) {
tmp = x - (x * y);
} else if (x <= 6.2e+55) {
tmp = x + (y * t);
} else {
tmp = x * (z + 1.0);
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if x <= -1.15e+38: tmp = x - (x * y) elif x <= 6.2e+55: tmp = x + (y * t) else: tmp = x * (z + 1.0) return tmp
function code(x, y, z, t) tmp = 0.0 if (x <= -1.15e+38) tmp = Float64(x - Float64(x * y)); elseif (x <= 6.2e+55) tmp = Float64(x + Float64(y * t)); else tmp = Float64(x * Float64(z + 1.0)); end return tmp end
function tmp_2 = code(x, y, z, t) tmp = 0.0; if (x <= -1.15e+38) tmp = x - (x * y); elseif (x <= 6.2e+55) tmp = x + (y * t); else tmp = x * (z + 1.0); end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[LessEqual[x, -1.15e+38], N[(x - N[(x * y), $MachinePrecision]), $MachinePrecision], If[LessEqual[x, 6.2e+55], N[(x + N[(y * t), $MachinePrecision]), $MachinePrecision], N[(x * N[(z + 1.0), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x \leq -1.15 \cdot 10^{+38}:\\
\;\;\;\;x - x \cdot y\\
\mathbf{elif}\;x \leq 6.2 \cdot 10^{+55}:\\
\;\;\;\;x + y \cdot t\\
\mathbf{else}:\\
\;\;\;\;x \cdot \left(z + 1\right)\\
\end{array}
\end{array}
if x < -1.1500000000000001e38Initial program 100.0%
Taylor expanded in x around inf 85.4%
*-commutative85.4%
mul-1-neg85.4%
unsub-neg85.4%
distribute-lft-out--85.4%
*-rgt-identity85.4%
Simplified85.4%
Taylor expanded in y around inf 63.3%
if -1.1500000000000001e38 < x < 6.19999999999999987e55Initial program 100.0%
Taylor expanded in t around inf 83.3%
Taylor expanded in y around inf 49.8%
if 6.19999999999999987e55 < x Initial program 100.0%
Taylor expanded in y around 0 72.3%
+-commutative72.3%
mul-1-neg72.3%
unsub-neg72.3%
*-commutative72.3%
Simplified72.3%
Taylor expanded in x around -inf 67.4%
Final simplification56.4%
(FPCore (x y z t) :precision binary64 (if (<= z -1e+21) (* x z) (if (<= z 2.3e-9) (+ x (* y t)) (- x (* z t)))))
double code(double x, double y, double z, double t) {
double tmp;
if (z <= -1e+21) {
tmp = x * z;
} else if (z <= 2.3e-9) {
tmp = x + (y * t);
} 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 (z <= (-1d+21)) then
tmp = x * z
else if (z <= 2.3d-9) then
tmp = x + (y * t)
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 (z <= -1e+21) {
tmp = x * z;
} else if (z <= 2.3e-9) {
tmp = x + (y * t);
} else {
tmp = x - (z * t);
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if z <= -1e+21: tmp = x * z elif z <= 2.3e-9: tmp = x + (y * t) else: tmp = x - (z * t) return tmp
function code(x, y, z, t) tmp = 0.0 if (z <= -1e+21) tmp = Float64(x * z); elseif (z <= 2.3e-9) tmp = Float64(x + Float64(y * t)); else tmp = Float64(x - Float64(z * t)); end return tmp end
function tmp_2 = code(x, y, z, t) tmp = 0.0; if (z <= -1e+21) tmp = x * z; elseif (z <= 2.3e-9) tmp = x + (y * t); else tmp = x - (z * t); end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[LessEqual[z, -1e+21], N[(x * z), $MachinePrecision], If[LessEqual[z, 2.3e-9], N[(x + N[(y * t), $MachinePrecision]), $MachinePrecision], N[(x - N[(z * t), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \leq -1 \cdot 10^{+21}:\\
\;\;\;\;x \cdot z\\
\mathbf{elif}\;z \leq 2.3 \cdot 10^{-9}:\\
\;\;\;\;x + y \cdot t\\
\mathbf{else}:\\
\;\;\;\;x - z \cdot t\\
\end{array}
\end{array}
if z < -1e21Initial program 99.9%
Taylor expanded in x around inf 59.7%
*-commutative59.7%
mul-1-neg59.7%
unsub-neg59.7%
distribute-lft-out--59.7%
*-rgt-identity59.7%
Simplified59.7%
Taylor expanded in z around inf 44.0%
if -1e21 < z < 2.2999999999999999e-9Initial program 100.0%
Taylor expanded in t around inf 77.5%
Taylor expanded in y around inf 69.5%
if 2.2999999999999999e-9 < z Initial program 100.0%
Taylor expanded in y around 0 81.0%
+-commutative81.0%
mul-1-neg81.0%
unsub-neg81.0%
*-commutative81.0%
Simplified81.0%
Taylor expanded in t around inf 59.9%
*-commutative59.9%
Simplified59.9%
Final simplification61.7%
(FPCore (x y z t) :precision binary64 (if (<= z -1.0) (* x z) (if (<= z 2.15e-21) x (* x z))))
double code(double x, double y, double z, double t) {
double tmp;
if (z <= -1.0) {
tmp = x * z;
} else if (z <= 2.15e-21) {
tmp = x;
} else {
tmp = x * 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 (z <= (-1.0d0)) then
tmp = x * z
else if (z <= 2.15d-21) then
tmp = x
else
tmp = x * z
end if
code = tmp
end function
public static double code(double x, double y, double z, double t) {
double tmp;
if (z <= -1.0) {
tmp = x * z;
} else if (z <= 2.15e-21) {
tmp = x;
} else {
tmp = x * z;
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if z <= -1.0: tmp = x * z elif z <= 2.15e-21: tmp = x else: tmp = x * z return tmp
function code(x, y, z, t) tmp = 0.0 if (z <= -1.0) tmp = Float64(x * z); elseif (z <= 2.15e-21) tmp = x; else tmp = Float64(x * z); end return tmp end
function tmp_2 = code(x, y, z, t) tmp = 0.0; if (z <= -1.0) tmp = x * z; elseif (z <= 2.15e-21) tmp = x; else tmp = x * z; end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[LessEqual[z, -1.0], N[(x * z), $MachinePrecision], If[LessEqual[z, 2.15e-21], x, N[(x * z), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \leq -1:\\
\;\;\;\;x \cdot z\\
\mathbf{elif}\;z \leq 2.15 \cdot 10^{-21}:\\
\;\;\;\;x\\
\mathbf{else}:\\
\;\;\;\;x \cdot z\\
\end{array}
\end{array}
if z < -1 or 2.1499999999999999e-21 < z Initial program 99.9%
Taylor expanded in x around inf 44.2%
*-commutative44.2%
mul-1-neg44.2%
unsub-neg44.2%
distribute-lft-out--44.2%
*-rgt-identity44.2%
Simplified44.2%
Taylor expanded in z around inf 33.6%
if -1 < z < 2.1499999999999999e-21Initial program 100.0%
Taylor expanded in y around 0 47.6%
+-commutative47.6%
mul-1-neg47.6%
unsub-neg47.6%
*-commutative47.6%
Simplified47.6%
Taylor expanded in z around 0 39.2%
Final simplification36.4%
(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 0 60.8%
+-commutative60.8%
mul-1-neg60.8%
unsub-neg60.8%
*-commutative60.8%
Simplified60.8%
Taylor expanded in z around 0 20.7%
Final simplification20.7%
(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 2023215
(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))))