
(FPCore (x y z t) :precision binary64 (+ x (* (- y z) (- t x))))
double code(double x, double y, double z, double t) {
return x + ((y - z) * (t - x));
}
real(8) function code(x, y, z, t)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
code = x + ((y - z) * (t - x))
end function
public static double code(double x, double y, double z, double t) {
return x + ((y - z) * (t - x));
}
def code(x, y, z, t): return x + ((y - z) * (t - x))
function code(x, y, z, t) return Float64(x + Float64(Float64(y - z) * Float64(t - x))) end
function tmp = code(x, y, z, t) tmp = x + ((y - z) * (t - x)); end
code[x_, y_, z_, t_] := N[(x + N[(N[(y - z), $MachinePrecision] * N[(t - x), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
x + \left(y - z\right) \cdot \left(t - x\right)
\end{array}
Sampling outcomes in binary64 precision:
Herbie found 13 alternatives:
| Alternative | Accuracy | Speedup |
|---|
(FPCore (x y z t) :precision binary64 (+ x (* (- y z) (- t x))))
double code(double x, double y, double z, double t) {
return x + ((y - z) * (t - x));
}
real(8) function code(x, y, z, t)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
code = x + ((y - z) * (t - x))
end function
public static double code(double x, double y, double z, double t) {
return x + ((y - z) * (t - x));
}
def code(x, y, z, t): return x + ((y - z) * (t - x))
function code(x, y, z, t) return Float64(x + Float64(Float64(y - z) * Float64(t - x))) end
function tmp = code(x, y, z, t) tmp = x + ((y - z) * (t - x)); end
code[x_, y_, z_, t_] := N[(x + N[(N[(y - z), $MachinePrecision] * N[(t - x), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
x + \left(y - z\right) \cdot \left(t - x\right)
\end{array}
(FPCore (x y z t) :precision binary64 (fma (- y z) (- t x) x))
double code(double x, double y, double z, double t) {
return fma((y - z), (t - x), x);
}
function code(x, y, z, t) return fma(Float64(y - z), Float64(t - x), x) end
code[x_, y_, z_, t_] := N[(N[(y - z), $MachinePrecision] * N[(t - x), $MachinePrecision] + x), $MachinePrecision]
\begin{array}{l}
\\
\mathsf{fma}\left(y - z, t - x, x\right)
\end{array}
Initial program 100.0%
+-commutative100.0%
fma-def100.0%
Simplified100.0%
Final simplification100.0%
(FPCore (x y z t)
:precision binary64
(let* ((t_1 (* t (- z))))
(if (<= z -1.05e-17)
t_1
(if (<= z 3.6e-252)
x
(if (<= z 4.9e-113)
(* y t)
(if (<= z 3.8e-51)
x
(if (or (<= z 1.25e+117) (not (<= z 2.4e+275))) t_1 (* z x))))))))
double code(double x, double y, double z, double t) {
double t_1 = t * -z;
double tmp;
if (z <= -1.05e-17) {
tmp = t_1;
} else if (z <= 3.6e-252) {
tmp = x;
} else if (z <= 4.9e-113) {
tmp = y * t;
} else if (z <= 3.8e-51) {
tmp = x;
} else if ((z <= 1.25e+117) || !(z <= 2.4e+275)) {
tmp = t_1;
} else {
tmp = z * 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) :: t_1
real(8) :: tmp
t_1 = t * -z
if (z <= (-1.05d-17)) then
tmp = t_1
else if (z <= 3.6d-252) then
tmp = x
else if (z <= 4.9d-113) then
tmp = y * t
else if (z <= 3.8d-51) then
tmp = x
else if ((z <= 1.25d+117) .or. (.not. (z <= 2.4d+275))) then
tmp = t_1
else
tmp = z * x
end if
code = tmp
end function
public static double code(double x, double y, double z, double t) {
double t_1 = t * -z;
double tmp;
if (z <= -1.05e-17) {
tmp = t_1;
} else if (z <= 3.6e-252) {
tmp = x;
} else if (z <= 4.9e-113) {
tmp = y * t;
} else if (z <= 3.8e-51) {
tmp = x;
} else if ((z <= 1.25e+117) || !(z <= 2.4e+275)) {
tmp = t_1;
} else {
tmp = z * x;
}
return tmp;
}
def code(x, y, z, t): t_1 = t * -z tmp = 0 if z <= -1.05e-17: tmp = t_1 elif z <= 3.6e-252: tmp = x elif z <= 4.9e-113: tmp = y * t elif z <= 3.8e-51: tmp = x elif (z <= 1.25e+117) or not (z <= 2.4e+275): tmp = t_1 else: tmp = z * x return tmp
function code(x, y, z, t) t_1 = Float64(t * Float64(-z)) tmp = 0.0 if (z <= -1.05e-17) tmp = t_1; elseif (z <= 3.6e-252) tmp = x; elseif (z <= 4.9e-113) tmp = Float64(y * t); elseif (z <= 3.8e-51) tmp = x; elseif ((z <= 1.25e+117) || !(z <= 2.4e+275)) tmp = t_1; else tmp = Float64(z * x); end return tmp end
function tmp_2 = code(x, y, z, t) t_1 = t * -z; tmp = 0.0; if (z <= -1.05e-17) tmp = t_1; elseif (z <= 3.6e-252) tmp = x; elseif (z <= 4.9e-113) tmp = y * t; elseif (z <= 3.8e-51) tmp = x; elseif ((z <= 1.25e+117) || ~((z <= 2.4e+275))) tmp = t_1; else tmp = z * x; end tmp_2 = tmp; end
code[x_, y_, z_, t_] := Block[{t$95$1 = N[(t * (-z)), $MachinePrecision]}, If[LessEqual[z, -1.05e-17], t$95$1, If[LessEqual[z, 3.6e-252], x, If[LessEqual[z, 4.9e-113], N[(y * t), $MachinePrecision], If[LessEqual[z, 3.8e-51], x, If[Or[LessEqual[z, 1.25e+117], N[Not[LessEqual[z, 2.4e+275]], $MachinePrecision]], t$95$1, N[(z * x), $MachinePrecision]]]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := t \cdot \left(-z\right)\\
\mathbf{if}\;z \leq -1.05 \cdot 10^{-17}:\\
\;\;\;\;t_1\\
\mathbf{elif}\;z \leq 3.6 \cdot 10^{-252}:\\
\;\;\;\;x\\
\mathbf{elif}\;z \leq 4.9 \cdot 10^{-113}:\\
\;\;\;\;y \cdot t\\
\mathbf{elif}\;z \leq 3.8 \cdot 10^{-51}:\\
\;\;\;\;x\\
\mathbf{elif}\;z \leq 1.25 \cdot 10^{+117} \lor \neg \left(z \leq 2.4 \cdot 10^{+275}\right):\\
\;\;\;\;t_1\\
\mathbf{else}:\\
\;\;\;\;z \cdot x\\
\end{array}
\end{array}
if z < -1.04999999999999996e-17 or 3.80000000000000003e-51 < z < 1.24999999999999996e117 or 2.39999999999999997e275 < z Initial program 100.0%
Taylor expanded in t around inf 61.3%
Taylor expanded in z around inf 50.7%
mul-1-neg50.7%
distribute-rgt-neg-out50.7%
Simplified50.7%
if -1.04999999999999996e-17 < z < 3.60000000000000023e-252 or 4.9000000000000003e-113 < z < 3.80000000000000003e-51Initial program 100.0%
Taylor expanded in t around inf 78.0%
Taylor expanded in x around inf 49.1%
if 3.60000000000000023e-252 < z < 4.9000000000000003e-113Initial program 100.0%
Taylor expanded in t around inf 50.7%
Taylor expanded in y around inf 34.3%
if 1.24999999999999996e117 < z < 2.39999999999999997e275Initial program 99.9%
Taylor expanded in x around inf 54.3%
*-commutative54.3%
mul-1-neg54.3%
unsub-neg54.3%
distribute-lft-out--54.3%
*-rgt-identity54.3%
Simplified54.3%
Taylor expanded in z around inf 55.9%
Final simplification49.2%
(FPCore (x y z t)
:precision binary64
(let* ((t_1 (+ x (* z (- x t)))))
(if (<= z -4.6e-17)
t_1
(if (<= z 8e-53)
(+ x (* y (- t x)))
(if (<= z 1.2e+65)
(+ x (* (- y z) t))
(if (<= z 6.5e+89) (+ x (* x (- z y))) t_1))))))
double code(double x, double y, double z, double t) {
double t_1 = x + (z * (x - t));
double tmp;
if (z <= -4.6e-17) {
tmp = t_1;
} else if (z <= 8e-53) {
tmp = x + (y * (t - x));
} else if (z <= 1.2e+65) {
tmp = x + ((y - z) * t);
} else if (z <= 6.5e+89) {
tmp = x + (x * (z - y));
} 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 + (z * (x - t))
if (z <= (-4.6d-17)) then
tmp = t_1
else if (z <= 8d-53) then
tmp = x + (y * (t - x))
else if (z <= 1.2d+65) then
tmp = x + ((y - z) * t)
else if (z <= 6.5d+89) then
tmp = x + (x * (z - y))
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 + (z * (x - t));
double tmp;
if (z <= -4.6e-17) {
tmp = t_1;
} else if (z <= 8e-53) {
tmp = x + (y * (t - x));
} else if (z <= 1.2e+65) {
tmp = x + ((y - z) * t);
} else if (z <= 6.5e+89) {
tmp = x + (x * (z - y));
} else {
tmp = t_1;
}
return tmp;
}
def code(x, y, z, t): t_1 = x + (z * (x - t)) tmp = 0 if z <= -4.6e-17: tmp = t_1 elif z <= 8e-53: tmp = x + (y * (t - x)) elif z <= 1.2e+65: tmp = x + ((y - z) * t) elif z <= 6.5e+89: tmp = x + (x * (z - y)) else: tmp = t_1 return tmp
function code(x, y, z, t) t_1 = Float64(x + Float64(z * Float64(x - t))) tmp = 0.0 if (z <= -4.6e-17) tmp = t_1; elseif (z <= 8e-53) tmp = Float64(x + Float64(y * Float64(t - x))); elseif (z <= 1.2e+65) tmp = Float64(x + Float64(Float64(y - z) * t)); elseif (z <= 6.5e+89) tmp = Float64(x + Float64(x * Float64(z - y))); else tmp = t_1; end return tmp end
function tmp_2 = code(x, y, z, t) t_1 = x + (z * (x - t)); tmp = 0.0; if (z <= -4.6e-17) tmp = t_1; elseif (z <= 8e-53) tmp = x + (y * (t - x)); elseif (z <= 1.2e+65) tmp = x + ((y - z) * t); elseif (z <= 6.5e+89) tmp = x + (x * (z - y)); else tmp = t_1; end tmp_2 = tmp; end
code[x_, y_, z_, t_] := Block[{t$95$1 = N[(x + N[(z * N[(x - t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[z, -4.6e-17], t$95$1, If[LessEqual[z, 8e-53], N[(x + N[(y * N[(t - x), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[z, 1.2e+65], N[(x + N[(N[(y - z), $MachinePrecision] * t), $MachinePrecision]), $MachinePrecision], If[LessEqual[z, 6.5e+89], N[(x + N[(x * N[(z - y), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], t$95$1]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := x + z \cdot \left(x - t\right)\\
\mathbf{if}\;z \leq -4.6 \cdot 10^{-17}:\\
\;\;\;\;t_1\\
\mathbf{elif}\;z \leq 8 \cdot 10^{-53}:\\
\;\;\;\;x + y \cdot \left(t - x\right)\\
\mathbf{elif}\;z \leq 1.2 \cdot 10^{+65}:\\
\;\;\;\;x + \left(y - z\right) \cdot t\\
\mathbf{elif}\;z \leq 6.5 \cdot 10^{+89}:\\
\;\;\;\;x + x \cdot \left(z - y\right)\\
\mathbf{else}:\\
\;\;\;\;t_1\\
\end{array}
\end{array}
if z < -4.60000000000000018e-17 or 6.4999999999999996e89 < z Initial program 100.0%
Taylor expanded in y around 0 85.3%
+-commutative85.3%
mul-1-neg85.3%
unsub-neg85.3%
*-commutative85.3%
Simplified85.3%
if -4.60000000000000018e-17 < z < 8.00000000000000025e-53Initial program 100.0%
Taylor expanded in z around 0 96.6%
if 8.00000000000000025e-53 < z < 1.2000000000000001e65Initial program 100.0%
Taylor expanded in t around inf 68.0%
if 1.2000000000000001e65 < z < 6.4999999999999996e89Initial 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%
Final simplification88.7%
(FPCore (x y z t) :precision binary64 (if (or (<= (- y z) -1e-35) (not (<= (- y z) 4e-22))) (* (- y z) t) x))
double code(double x, double y, double z, double t) {
double tmp;
if (((y - z) <= -1e-35) || !((y - z) <= 4e-22)) {
tmp = (y - z) * t;
} else {
tmp = x;
}
return tmp;
}
real(8) function code(x, y, z, t)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
real(8) :: tmp
if (((y - z) <= (-1d-35)) .or. (.not. ((y - z) <= 4d-22))) then
tmp = (y - z) * t
else
tmp = x
end if
code = tmp
end function
public static double code(double x, double y, double z, double t) {
double tmp;
if (((y - z) <= -1e-35) || !((y - z) <= 4e-22)) {
tmp = (y - z) * t;
} else {
tmp = x;
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if ((y - z) <= -1e-35) or not ((y - z) <= 4e-22): tmp = (y - z) * t else: tmp = x return tmp
function code(x, y, z, t) tmp = 0.0 if ((Float64(y - z) <= -1e-35) || !(Float64(y - z) <= 4e-22)) tmp = Float64(Float64(y - z) * t); else tmp = x; end return tmp end
function tmp_2 = code(x, y, z, t) tmp = 0.0; if (((y - z) <= -1e-35) || ~(((y - z) <= 4e-22))) tmp = (y - z) * t; else tmp = x; end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[Or[LessEqual[N[(y - z), $MachinePrecision], -1e-35], N[Not[LessEqual[N[(y - z), $MachinePrecision], 4e-22]], $MachinePrecision]], N[(N[(y - z), $MachinePrecision] * t), $MachinePrecision], x]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;y - z \leq -1 \cdot 10^{-35} \lor \neg \left(y - z \leq 4 \cdot 10^{-22}\right):\\
\;\;\;\;\left(y - z\right) \cdot t\\
\mathbf{else}:\\
\;\;\;\;x\\
\end{array}
\end{array}
if (-.f64 y z) < -1.00000000000000001e-35 or 4.0000000000000002e-22 < (-.f64 y z) Initial program 100.0%
Taylor expanded in t around inf 54.6%
Taylor expanded in x around 0 53.2%
if -1.00000000000000001e-35 < (-.f64 y z) < 4.0000000000000002e-22Initial program 100.0%
Taylor expanded in t around inf 100.0%
Taylor expanded in x around inf 76.7%
Final simplification58.2%
(FPCore (x y z t)
:precision binary64
(if (<= z -1.7e-16)
(* z x)
(if (<= z 8.2e-251)
x
(if (<= z 9.5e-112) (* y t) (if (<= z 27000000.0) x (* z x))))))
double code(double x, double y, double z, double t) {
double tmp;
if (z <= -1.7e-16) {
tmp = z * x;
} else if (z <= 8.2e-251) {
tmp = x;
} else if (z <= 9.5e-112) {
tmp = y * t;
} else if (z <= 27000000.0) {
tmp = x;
} else {
tmp = z * 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 <= (-1.7d-16)) then
tmp = z * x
else if (z <= 8.2d-251) then
tmp = x
else if (z <= 9.5d-112) then
tmp = y * t
else if (z <= 27000000.0d0) then
tmp = x
else
tmp = z * x
end if
code = tmp
end function
public static double code(double x, double y, double z, double t) {
double tmp;
if (z <= -1.7e-16) {
tmp = z * x;
} else if (z <= 8.2e-251) {
tmp = x;
} else if (z <= 9.5e-112) {
tmp = y * t;
} else if (z <= 27000000.0) {
tmp = x;
} else {
tmp = z * x;
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if z <= -1.7e-16: tmp = z * x elif z <= 8.2e-251: tmp = x elif z <= 9.5e-112: tmp = y * t elif z <= 27000000.0: tmp = x else: tmp = z * x return tmp
function code(x, y, z, t) tmp = 0.0 if (z <= -1.7e-16) tmp = Float64(z * x); elseif (z <= 8.2e-251) tmp = x; elseif (z <= 9.5e-112) tmp = Float64(y * t); elseif (z <= 27000000.0) tmp = x; else tmp = Float64(z * x); end return tmp end
function tmp_2 = code(x, y, z, t) tmp = 0.0; if (z <= -1.7e-16) tmp = z * x; elseif (z <= 8.2e-251) tmp = x; elseif (z <= 9.5e-112) tmp = y * t; elseif (z <= 27000000.0) tmp = x; else tmp = z * x; end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[LessEqual[z, -1.7e-16], N[(z * x), $MachinePrecision], If[LessEqual[z, 8.2e-251], x, If[LessEqual[z, 9.5e-112], N[(y * t), $MachinePrecision], If[LessEqual[z, 27000000.0], x, N[(z * x), $MachinePrecision]]]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \leq -1.7 \cdot 10^{-16}:\\
\;\;\;\;z \cdot x\\
\mathbf{elif}\;z \leq 8.2 \cdot 10^{-251}:\\
\;\;\;\;x\\
\mathbf{elif}\;z \leq 9.5 \cdot 10^{-112}:\\
\;\;\;\;y \cdot t\\
\mathbf{elif}\;z \leq 27000000:\\
\;\;\;\;x\\
\mathbf{else}:\\
\;\;\;\;z \cdot x\\
\end{array}
\end{array}
if z < -1.7e-16 or 2.7e7 < z Initial program 100.0%
Taylor expanded in x around inf 48.8%
*-commutative48.8%
mul-1-neg48.8%
unsub-neg48.8%
distribute-lft-out--48.8%
*-rgt-identity48.8%
Simplified48.8%
Taylor expanded in z around inf 37.6%
if -1.7e-16 < z < 8.1999999999999997e-251 or 9.50000000000000056e-112 < z < 2.7e7Initial program 100.0%
Taylor expanded in t around inf 78.5%
Taylor expanded in x around inf 47.2%
if 8.1999999999999997e-251 < z < 9.50000000000000056e-112Initial program 100.0%
Taylor expanded in t around inf 50.7%
Taylor expanded in y around inf 34.3%
Final simplification40.7%
(FPCore (x y z t)
:precision binary64
(let* ((t_1 (* x (+ z 1.0))))
(if (<= x -7.8e+163)
t_1
(if (<= x -1.66e-40)
(- x (* y x))
(if (<= x 1.1e-31) (* (- y z) t) t_1)))))
double code(double x, double y, double z, double t) {
double t_1 = x * (z + 1.0);
double tmp;
if (x <= -7.8e+163) {
tmp = t_1;
} else if (x <= -1.66e-40) {
tmp = x - (y * x);
} else if (x <= 1.1e-31) {
tmp = (y - z) * t;
} else {
tmp = t_1;
}
return tmp;
}
real(8) function code(x, y, z, t)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
real(8) :: t_1
real(8) :: tmp
t_1 = x * (z + 1.0d0)
if (x <= (-7.8d+163)) then
tmp = t_1
else if (x <= (-1.66d-40)) then
tmp = x - (y * x)
else if (x <= 1.1d-31) then
tmp = (y - z) * t
else
tmp = t_1
end if
code = tmp
end function
public static double code(double x, double y, double z, double t) {
double t_1 = x * (z + 1.0);
double tmp;
if (x <= -7.8e+163) {
tmp = t_1;
} else if (x <= -1.66e-40) {
tmp = x - (y * x);
} else if (x <= 1.1e-31) {
tmp = (y - z) * t;
} else {
tmp = t_1;
}
return tmp;
}
def code(x, y, z, t): t_1 = x * (z + 1.0) tmp = 0 if x <= -7.8e+163: tmp = t_1 elif x <= -1.66e-40: tmp = x - (y * x) elif x <= 1.1e-31: tmp = (y - z) * t else: tmp = t_1 return tmp
function code(x, y, z, t) t_1 = Float64(x * Float64(z + 1.0)) tmp = 0.0 if (x <= -7.8e+163) tmp = t_1; elseif (x <= -1.66e-40) tmp = Float64(x - Float64(y * x)); elseif (x <= 1.1e-31) tmp = Float64(Float64(y - z) * t); else tmp = t_1; end return tmp end
function tmp_2 = code(x, y, z, t) t_1 = x * (z + 1.0); tmp = 0.0; if (x <= -7.8e+163) tmp = t_1; elseif (x <= -1.66e-40) tmp = x - (y * x); elseif (x <= 1.1e-31) tmp = (y - z) * t; else tmp = t_1; end tmp_2 = tmp; end
code[x_, y_, z_, t_] := Block[{t$95$1 = N[(x * N[(z + 1.0), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[x, -7.8e+163], t$95$1, If[LessEqual[x, -1.66e-40], N[(x - N[(y * x), $MachinePrecision]), $MachinePrecision], If[LessEqual[x, 1.1e-31], N[(N[(y - z), $MachinePrecision] * t), $MachinePrecision], t$95$1]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := x \cdot \left(z + 1\right)\\
\mathbf{if}\;x \leq -7.8 \cdot 10^{+163}:\\
\;\;\;\;t_1\\
\mathbf{elif}\;x \leq -1.66 \cdot 10^{-40}:\\
\;\;\;\;x - y \cdot x\\
\mathbf{elif}\;x \leq 1.1 \cdot 10^{-31}:\\
\;\;\;\;\left(y - z\right) \cdot t\\
\mathbf{else}:\\
\;\;\;\;t_1\\
\end{array}
\end{array}
if x < -7.80000000000000047e163 or 1.10000000000000005e-31 < x Initial program 100.0%
Taylor expanded in y around 0 71.0%
+-commutative71.0%
mul-1-neg71.0%
unsub-neg71.0%
*-commutative71.0%
Simplified71.0%
Taylor expanded in x around -inf 64.2%
if -7.80000000000000047e163 < x < -1.6600000000000001e-40Initial program 100.0%
Taylor expanded in x around inf 68.1%
*-commutative68.1%
mul-1-neg68.1%
unsub-neg68.1%
distribute-lft-out--68.2%
*-rgt-identity68.2%
Simplified68.2%
Taylor expanded in z around 0 57.5%
if -1.6600000000000001e-40 < x < 1.10000000000000005e-31Initial program 100.0%
Taylor expanded in t around inf 83.3%
Taylor expanded in x around 0 75.4%
Final simplification67.7%
(FPCore (x y z t) :precision binary64 (if (or (<= x -8.5e+120) (not (<= x 5.9e+184))) (* x (+ z 1.0)) (+ x (* (- y z) t))))
double code(double x, double y, double z, double t) {
double tmp;
if ((x <= -8.5e+120) || !(x <= 5.9e+184)) {
tmp = x * (z + 1.0);
} 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 <= (-8.5d+120)) .or. (.not. (x <= 5.9d+184))) then
tmp = x * (z + 1.0d0)
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 <= -8.5e+120) || !(x <= 5.9e+184)) {
tmp = x * (z + 1.0);
} else {
tmp = x + ((y - z) * t);
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if (x <= -8.5e+120) or not (x <= 5.9e+184): tmp = x * (z + 1.0) else: tmp = x + ((y - z) * t) return tmp
function code(x, y, z, t) tmp = 0.0 if ((x <= -8.5e+120) || !(x <= 5.9e+184)) tmp = Float64(x * Float64(z + 1.0)); 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 <= -8.5e+120) || ~((x <= 5.9e+184))) tmp = x * (z + 1.0); else tmp = x + ((y - z) * t); end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[Or[LessEqual[x, -8.5e+120], N[Not[LessEqual[x, 5.9e+184]], $MachinePrecision]], N[(x * N[(z + 1.0), $MachinePrecision]), $MachinePrecision], N[(x + N[(N[(y - z), $MachinePrecision] * t), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x \leq -8.5 \cdot 10^{+120} \lor \neg \left(x \leq 5.9 \cdot 10^{+184}\right):\\
\;\;\;\;x \cdot \left(z + 1\right)\\
\mathbf{else}:\\
\;\;\;\;x + \left(y - z\right) \cdot t\\
\end{array}
\end{array}
if x < -8.50000000000000026e120 or 5.9000000000000001e184 < 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 72.0%
if -8.50000000000000026e120 < x < 5.9000000000000001e184Initial program 100.0%
Taylor expanded in t around inf 72.6%
Final simplification72.4%
(FPCore (x y z t) :precision binary64 (if (or (<= y -0.46) (not (<= y 7200000000.0))) (+ x (* y (- t x))) (+ x (* (- y z) t))))
double code(double x, double y, double z, double t) {
double tmp;
if ((y <= -0.46) || !(y <= 7200000000.0)) {
tmp = x + (y * (t - x));
} 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 ((y <= (-0.46d0)) .or. (.not. (y <= 7200000000.0d0))) then
tmp = x + (y * (t - x))
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 ((y <= -0.46) || !(y <= 7200000000.0)) {
tmp = x + (y * (t - x));
} else {
tmp = x + ((y - z) * t);
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if (y <= -0.46) or not (y <= 7200000000.0): tmp = x + (y * (t - x)) else: tmp = x + ((y - z) * t) return tmp
function code(x, y, z, t) tmp = 0.0 if ((y <= -0.46) || !(y <= 7200000000.0)) tmp = Float64(x + Float64(y * Float64(t - x))); 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 ((y <= -0.46) || ~((y <= 7200000000.0))) tmp = x + (y * (t - x)); else tmp = x + ((y - z) * t); end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[Or[LessEqual[y, -0.46], N[Not[LessEqual[y, 7200000000.0]], $MachinePrecision]], N[(x + N[(y * N[(t - x), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(x + N[(N[(y - z), $MachinePrecision] * t), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;y \leq -0.46 \lor \neg \left(y \leq 7200000000\right):\\
\;\;\;\;x + y \cdot \left(t - x\right)\\
\mathbf{else}:\\
\;\;\;\;x + \left(y - z\right) \cdot t\\
\end{array}
\end{array}
if y < -0.46000000000000002 or 7.2e9 < y Initial program 100.0%
Taylor expanded in z around 0 75.7%
if -0.46000000000000002 < y < 7.2e9Initial program 100.0%
Taylor expanded in t around inf 80.7%
Final simplification78.4%
(FPCore (x y z t) :precision binary64 (if (or (<= x -4.4e+97) (not (<= x 2.3e-60))) (+ x (* x (- z y))) (+ x (* (- y z) t))))
double code(double x, double y, double z, double t) {
double tmp;
if ((x <= -4.4e+97) || !(x <= 2.3e-60)) {
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 <= (-4.4d+97)) .or. (.not. (x <= 2.3d-60))) 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 <= -4.4e+97) || !(x <= 2.3e-60)) {
tmp = x + (x * (z - y));
} else {
tmp = x + ((y - z) * t);
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if (x <= -4.4e+97) or not (x <= 2.3e-60): tmp = x + (x * (z - y)) else: tmp = x + ((y - z) * t) return tmp
function code(x, y, z, t) tmp = 0.0 if ((x <= -4.4e+97) || !(x <= 2.3e-60)) 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 <= -4.4e+97) || ~((x <= 2.3e-60))) 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, -4.4e+97], N[Not[LessEqual[x, 2.3e-60]], $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 -4.4 \cdot 10^{+97} \lor \neg \left(x \leq 2.3 \cdot 10^{-60}\right):\\
\;\;\;\;x + x \cdot \left(z - y\right)\\
\mathbf{else}:\\
\;\;\;\;x + \left(y - z\right) \cdot t\\
\end{array}
\end{array}
if x < -4.4000000000000002e97 or 2.3000000000000001e-60 < x Initial program 100.0%
Taylor expanded in x around inf 84.4%
*-commutative84.4%
mul-1-neg84.4%
unsub-neg84.4%
distribute-lft-out--84.5%
*-rgt-identity84.5%
Simplified84.5%
if -4.4000000000000002e97 < x < 2.3000000000000001e-60Initial program 100.0%
Taylor expanded in t around inf 80.9%
Final simplification82.6%
(FPCore (x y z t) :precision binary64 (if (or (<= x -1.7e+70) (not (<= x 2.9e-31))) (* x (+ z 1.0)) (* (- y z) t)))
double code(double x, double y, double z, double t) {
double tmp;
if ((x <= -1.7e+70) || !(x <= 2.9e-31)) {
tmp = x * (z + 1.0);
} else {
tmp = (y - z) * t;
}
return tmp;
}
real(8) function code(x, y, z, t)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
real(8) :: tmp
if ((x <= (-1.7d+70)) .or. (.not. (x <= 2.9d-31))) then
tmp = x * (z + 1.0d0)
else
tmp = (y - z) * t
end if
code = tmp
end function
public static double code(double x, double y, double z, double t) {
double tmp;
if ((x <= -1.7e+70) || !(x <= 2.9e-31)) {
tmp = x * (z + 1.0);
} else {
tmp = (y - z) * t;
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if (x <= -1.7e+70) or not (x <= 2.9e-31): tmp = x * (z + 1.0) else: tmp = (y - z) * t return tmp
function code(x, y, z, t) tmp = 0.0 if ((x <= -1.7e+70) || !(x <= 2.9e-31)) tmp = Float64(x * Float64(z + 1.0)); else tmp = Float64(Float64(y - z) * t); end return tmp end
function tmp_2 = code(x, y, z, t) tmp = 0.0; if ((x <= -1.7e+70) || ~((x <= 2.9e-31))) tmp = x * (z + 1.0); else tmp = (y - z) * t; end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[Or[LessEqual[x, -1.7e+70], N[Not[LessEqual[x, 2.9e-31]], $MachinePrecision]], N[(x * N[(z + 1.0), $MachinePrecision]), $MachinePrecision], N[(N[(y - z), $MachinePrecision] * t), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x \leq -1.7 \cdot 10^{+70} \lor \neg \left(x \leq 2.9 \cdot 10^{-31}\right):\\
\;\;\;\;x \cdot \left(z + 1\right)\\
\mathbf{else}:\\
\;\;\;\;\left(y - z\right) \cdot t\\
\end{array}
\end{array}
if x < -1.7e70 or 2.9000000000000001e-31 < x Initial program 100.0%
Taylor expanded in y around 0 67.6%
+-commutative67.6%
mul-1-neg67.6%
unsub-neg67.6%
*-commutative67.6%
Simplified67.6%
Taylor expanded in x around -inf 61.7%
if -1.7e70 < x < 2.9000000000000001e-31Initial program 100.0%
Taylor expanded in t around inf 78.3%
Taylor expanded in x around 0 69.7%
Final simplification65.8%
(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 (if (<= y -1.75e-37) (* y t) (if (<= y 2.4e-19) x (* y t))))
double code(double x, double y, double z, double t) {
double tmp;
if (y <= -1.75e-37) {
tmp = y * t;
} else if (y <= 2.4e-19) {
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 <= (-1.75d-37)) then
tmp = y * t
else if (y <= 2.4d-19) 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 <= -1.75e-37) {
tmp = y * t;
} else if (y <= 2.4e-19) {
tmp = x;
} else {
tmp = y * t;
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if y <= -1.75e-37: tmp = y * t elif y <= 2.4e-19: tmp = x else: tmp = y * t return tmp
function code(x, y, z, t) tmp = 0.0 if (y <= -1.75e-37) tmp = Float64(y * t); elseif (y <= 2.4e-19) tmp = x; else tmp = Float64(y * t); end return tmp end
function tmp_2 = code(x, y, z, t) tmp = 0.0; if (y <= -1.75e-37) tmp = y * t; elseif (y <= 2.4e-19) tmp = x; else tmp = y * t; end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[LessEqual[y, -1.75e-37], N[(y * t), $MachinePrecision], If[LessEqual[y, 2.4e-19], x, N[(y * t), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;y \leq -1.75 \cdot 10^{-37}:\\
\;\;\;\;y \cdot t\\
\mathbf{elif}\;y \leq 2.4 \cdot 10^{-19}:\\
\;\;\;\;x\\
\mathbf{else}:\\
\;\;\;\;y \cdot t\\
\end{array}
\end{array}
if y < -1.7500000000000001e-37 or 2.40000000000000023e-19 < y Initial program 100.0%
Taylor expanded in t around inf 49.5%
Taylor expanded in y around inf 32.1%
if -1.7500000000000001e-37 < y < 2.40000000000000023e-19Initial program 100.0%
Taylor expanded in t around inf 81.0%
Taylor expanded in x around inf 37.7%
Final simplification34.8%
(FPCore (x y z t) :precision binary64 x)
double code(double x, double y, double z, double t) {
return x;
}
real(8) function code(x, y, z, t)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
code = x
end function
public static double code(double x, double y, double z, double t) {
return x;
}
def code(x, y, z, t): return x
function code(x, y, z, t) return x end
function tmp = code(x, y, z, t) tmp = x; end
code[x_, y_, z_, t_] := x
\begin{array}{l}
\\
x
\end{array}
Initial program 100.0%
Taylor expanded in t around inf 64.4%
Taylor expanded in x around inf 19.7%
Final simplification19.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 2023238
(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))))