
(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 11 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
(if (<= z -10000000000.0)
(* x z)
(if (<= z -5.2e-101)
(* y t)
(if (<= z -1.2e-295)
x
(if (<= z 1.9e-264)
(* y t)
(if (<= z 6.4e-184) x (if (<= z 8.5e+159) (* y t) (* x z))))))))
double code(double x, double y, double z, double t) {
double tmp;
if (z <= -10000000000.0) {
tmp = x * z;
} else if (z <= -5.2e-101) {
tmp = y * t;
} else if (z <= -1.2e-295) {
tmp = x;
} else if (z <= 1.9e-264) {
tmp = y * t;
} else if (z <= 6.4e-184) {
tmp = x;
} else if (z <= 8.5e+159) {
tmp = y * t;
} 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 <= (-10000000000.0d0)) then
tmp = x * z
else if (z <= (-5.2d-101)) then
tmp = y * t
else if (z <= (-1.2d-295)) then
tmp = x
else if (z <= 1.9d-264) then
tmp = y * t
else if (z <= 6.4d-184) then
tmp = x
else if (z <= 8.5d+159) then
tmp = y * t
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 <= -10000000000.0) {
tmp = x * z;
} else if (z <= -5.2e-101) {
tmp = y * t;
} else if (z <= -1.2e-295) {
tmp = x;
} else if (z <= 1.9e-264) {
tmp = y * t;
} else if (z <= 6.4e-184) {
tmp = x;
} else if (z <= 8.5e+159) {
tmp = y * t;
} else {
tmp = x * z;
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if z <= -10000000000.0: tmp = x * z elif z <= -5.2e-101: tmp = y * t elif z <= -1.2e-295: tmp = x elif z <= 1.9e-264: tmp = y * t elif z <= 6.4e-184: tmp = x elif z <= 8.5e+159: tmp = y * t else: tmp = x * z return tmp
function code(x, y, z, t) tmp = 0.0 if (z <= -10000000000.0) tmp = Float64(x * z); elseif (z <= -5.2e-101) tmp = Float64(y * t); elseif (z <= -1.2e-295) tmp = x; elseif (z <= 1.9e-264) tmp = Float64(y * t); elseif (z <= 6.4e-184) tmp = x; elseif (z <= 8.5e+159) tmp = Float64(y * t); else tmp = Float64(x * z); end return tmp end
function tmp_2 = code(x, y, z, t) tmp = 0.0; if (z <= -10000000000.0) tmp = x * z; elseif (z <= -5.2e-101) tmp = y * t; elseif (z <= -1.2e-295) tmp = x; elseif (z <= 1.9e-264) tmp = y * t; elseif (z <= 6.4e-184) tmp = x; elseif (z <= 8.5e+159) tmp = y * t; else tmp = x * z; end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[LessEqual[z, -10000000000.0], N[(x * z), $MachinePrecision], If[LessEqual[z, -5.2e-101], N[(y * t), $MachinePrecision], If[LessEqual[z, -1.2e-295], x, If[LessEqual[z, 1.9e-264], N[(y * t), $MachinePrecision], If[LessEqual[z, 6.4e-184], x, If[LessEqual[z, 8.5e+159], N[(y * t), $MachinePrecision], N[(x * z), $MachinePrecision]]]]]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \leq -10000000000:\\
\;\;\;\;x \cdot z\\
\mathbf{elif}\;z \leq -5.2 \cdot 10^{-101}:\\
\;\;\;\;y \cdot t\\
\mathbf{elif}\;z \leq -1.2 \cdot 10^{-295}:\\
\;\;\;\;x\\
\mathbf{elif}\;z \leq 1.9 \cdot 10^{-264}:\\
\;\;\;\;y \cdot t\\
\mathbf{elif}\;z \leq 6.4 \cdot 10^{-184}:\\
\;\;\;\;x\\
\mathbf{elif}\;z \leq 8.5 \cdot 10^{+159}:\\
\;\;\;\;y \cdot t\\
\mathbf{else}:\\
\;\;\;\;x \cdot z\\
\end{array}
\end{array}
if z < -1e10 or 8.50000000000000076e159 < z Initial program 100.0%
Taylor expanded in x around inf 58.2%
mul-1-neg58.2%
unsub-neg58.2%
Simplified58.2%
associate--r-58.2%
distribute-rgt-in55.4%
Applied egg-rr55.4%
Taylor expanded in z around inf 50.0%
if -1e10 < z < -5.2000000000000002e-101 or -1.1999999999999999e-295 < z < 1.90000000000000007e-264 or 6.4e-184 < z < 8.50000000000000076e159Initial program 100.0%
*-commutative100.0%
sub-neg100.0%
distribute-lft-in99.0%
Applied egg-rr99.0%
Taylor expanded in x around 0 66.0%
Taylor expanded in x around 0 57.0%
Taylor expanded in z around 0 39.7%
if -5.2000000000000002e-101 < z < -1.1999999999999999e-295 or 1.90000000000000007e-264 < z < 6.4e-184Initial program 99.9%
Taylor expanded in t around inf 71.8%
Taylor expanded in x around inf 45.3%
Final simplification45.1%
(FPCore (x y z t)
:precision binary64
(let* ((t_1 (* x (- y))) (t_2 (* (- y z) t)))
(if (<= t -1.15e-125)
t_2
(if (<= t -3.1e-300)
(* x z)
(if (<= t 8.5e-110)
t_1
(if (<= t 4.5e-75) (* x z) (if (<= t 3.7e-35) t_1 t_2)))))))
double code(double x, double y, double z, double t) {
double t_1 = x * -y;
double t_2 = (y - z) * t;
double tmp;
if (t <= -1.15e-125) {
tmp = t_2;
} else if (t <= -3.1e-300) {
tmp = x * z;
} else if (t <= 8.5e-110) {
tmp = t_1;
} else if (t <= 4.5e-75) {
tmp = x * z;
} else if (t <= 3.7e-35) {
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 * -y
t_2 = (y - z) * t
if (t <= (-1.15d-125)) then
tmp = t_2
else if (t <= (-3.1d-300)) then
tmp = x * z
else if (t <= 8.5d-110) then
tmp = t_1
else if (t <= 4.5d-75) then
tmp = x * z
else if (t <= 3.7d-35) 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 * -y;
double t_2 = (y - z) * t;
double tmp;
if (t <= -1.15e-125) {
tmp = t_2;
} else if (t <= -3.1e-300) {
tmp = x * z;
} else if (t <= 8.5e-110) {
tmp = t_1;
} else if (t <= 4.5e-75) {
tmp = x * z;
} else if (t <= 3.7e-35) {
tmp = t_1;
} else {
tmp = t_2;
}
return tmp;
}
def code(x, y, z, t): t_1 = x * -y t_2 = (y - z) * t tmp = 0 if t <= -1.15e-125: tmp = t_2 elif t <= -3.1e-300: tmp = x * z elif t <= 8.5e-110: tmp = t_1 elif t <= 4.5e-75: tmp = x * z elif t <= 3.7e-35: tmp = t_1 else: tmp = t_2 return tmp
function code(x, y, z, t) t_1 = Float64(x * Float64(-y)) t_2 = Float64(Float64(y - z) * t) tmp = 0.0 if (t <= -1.15e-125) tmp = t_2; elseif (t <= -3.1e-300) tmp = Float64(x * z); elseif (t <= 8.5e-110) tmp = t_1; elseif (t <= 4.5e-75) tmp = Float64(x * z); elseif (t <= 3.7e-35) tmp = t_1; else tmp = t_2; end return tmp end
function tmp_2 = code(x, y, z, t) t_1 = x * -y; t_2 = (y - z) * t; tmp = 0.0; if (t <= -1.15e-125) tmp = t_2; elseif (t <= -3.1e-300) tmp = x * z; elseif (t <= 8.5e-110) tmp = t_1; elseif (t <= 4.5e-75) tmp = x * z; elseif (t <= 3.7e-35) tmp = t_1; else tmp = t_2; end tmp_2 = tmp; end
code[x_, y_, z_, t_] := Block[{t$95$1 = N[(x * (-y)), $MachinePrecision]}, Block[{t$95$2 = N[(N[(y - z), $MachinePrecision] * t), $MachinePrecision]}, If[LessEqual[t, -1.15e-125], t$95$2, If[LessEqual[t, -3.1e-300], N[(x * z), $MachinePrecision], If[LessEqual[t, 8.5e-110], t$95$1, If[LessEqual[t, 4.5e-75], N[(x * z), $MachinePrecision], If[LessEqual[t, 3.7e-35], t$95$1, t$95$2]]]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := x \cdot \left(-y\right)\\
t_2 := \left(y - z\right) \cdot t\\
\mathbf{if}\;t \leq -1.15 \cdot 10^{-125}:\\
\;\;\;\;t_2\\
\mathbf{elif}\;t \leq -3.1 \cdot 10^{-300}:\\
\;\;\;\;x \cdot z\\
\mathbf{elif}\;t \leq 8.5 \cdot 10^{-110}:\\
\;\;\;\;t_1\\
\mathbf{elif}\;t \leq 4.5 \cdot 10^{-75}:\\
\;\;\;\;x \cdot z\\
\mathbf{elif}\;t \leq 3.7 \cdot 10^{-35}:\\
\;\;\;\;t_1\\
\mathbf{else}:\\
\;\;\;\;t_2\\
\end{array}
\end{array}
if t < -1.15e-125 or 3.6999999999999999e-35 < t Initial program 100.0%
*-commutative100.0%
sub-neg100.0%
distribute-lft-in96.1%
Applied egg-rr96.1%
Taylor expanded in x around 0 80.6%
Taylor expanded in x around 0 69.5%
Taylor expanded in t around 0 72.1%
mul-1-neg72.1%
sub-neg72.1%
Simplified72.1%
if -1.15e-125 < t < -3.1000000000000002e-300 or 8.50000000000000029e-110 < t < 4.5000000000000003e-75Initial program 100.0%
Taylor expanded in x around inf 89.7%
mul-1-neg89.7%
unsub-neg89.7%
Simplified89.7%
associate--r-89.7%
distribute-rgt-in87.4%
Applied egg-rr87.4%
Taylor expanded in z around inf 52.8%
if -3.1000000000000002e-300 < t < 8.50000000000000029e-110 or 4.5000000000000003e-75 < t < 3.6999999999999999e-35Initial program 99.9%
Taylor expanded in x around inf 89.5%
mul-1-neg89.5%
unsub-neg89.5%
Simplified89.5%
Taylor expanded in z around 0 65.9%
Taylor expanded in y around inf 50.7%
associate-*r*50.7%
neg-mul-150.7%
*-commutative50.7%
Simplified50.7%
Final simplification64.1%
(FPCore (x y z t) :precision binary64 (if (or (<= t -2.1e-121) (not (<= t 1060000000000.0))) (* (- y z) t) (* x (+ (- z y) 1.0))))
double code(double x, double y, double z, double t) {
double tmp;
if ((t <= -2.1e-121) || !(t <= 1060000000000.0)) {
tmp = (y - z) * t;
} else {
tmp = x * ((z - y) + 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 ((t <= (-2.1d-121)) .or. (.not. (t <= 1060000000000.0d0))) then
tmp = (y - z) * t
else
tmp = x * ((z - y) + 1.0d0)
end if
code = tmp
end function
public static double code(double x, double y, double z, double t) {
double tmp;
if ((t <= -2.1e-121) || !(t <= 1060000000000.0)) {
tmp = (y - z) * t;
} else {
tmp = x * ((z - y) + 1.0);
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if (t <= -2.1e-121) or not (t <= 1060000000000.0): tmp = (y - z) * t else: tmp = x * ((z - y) + 1.0) return tmp
function code(x, y, z, t) tmp = 0.0 if ((t <= -2.1e-121) || !(t <= 1060000000000.0)) tmp = Float64(Float64(y - z) * t); else tmp = Float64(x * Float64(Float64(z - y) + 1.0)); end return tmp end
function tmp_2 = code(x, y, z, t) tmp = 0.0; if ((t <= -2.1e-121) || ~((t <= 1060000000000.0))) tmp = (y - z) * t; else tmp = x * ((z - y) + 1.0); end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[Or[LessEqual[t, -2.1e-121], N[Not[LessEqual[t, 1060000000000.0]], $MachinePrecision]], N[(N[(y - z), $MachinePrecision] * t), $MachinePrecision], N[(x * N[(N[(z - y), $MachinePrecision] + 1.0), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;t \leq -2.1 \cdot 10^{-121} \lor \neg \left(t \leq 1060000000000\right):\\
\;\;\;\;\left(y - z\right) \cdot t\\
\mathbf{else}:\\
\;\;\;\;x \cdot \left(\left(z - y\right) + 1\right)\\
\end{array}
\end{array}
if t < -2.0999999999999999e-121 or 1.06e12 < t Initial program 100.0%
*-commutative100.0%
sub-neg100.0%
distribute-lft-in96.0%
Applied egg-rr96.0%
Taylor expanded in x around 0 81.0%
Taylor expanded in x around 0 71.3%
Taylor expanded in t around 0 74.0%
mul-1-neg74.0%
sub-neg74.0%
Simplified74.0%
if -2.0999999999999999e-121 < t < 1.06e12Initial program 99.9%
Taylor expanded in x around inf 88.2%
mul-1-neg88.2%
unsub-neg88.2%
Simplified88.2%
Final simplification79.9%
(FPCore (x y z t) :precision binary64 (if (or (<= t -2.1e-121) (not (<= t 1.3e-34))) (+ x (* (- y z) t)) (* x (+ (- z y) 1.0))))
double code(double x, double y, double z, double t) {
double tmp;
if ((t <= -2.1e-121) || !(t <= 1.3e-34)) {
tmp = x + ((y - z) * t);
} else {
tmp = x * ((z - y) + 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 ((t <= (-2.1d-121)) .or. (.not. (t <= 1.3d-34))) then
tmp = x + ((y - z) * t)
else
tmp = x * ((z - y) + 1.0d0)
end if
code = tmp
end function
public static double code(double x, double y, double z, double t) {
double tmp;
if ((t <= -2.1e-121) || !(t <= 1.3e-34)) {
tmp = x + ((y - z) * t);
} else {
tmp = x * ((z - y) + 1.0);
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if (t <= -2.1e-121) or not (t <= 1.3e-34): tmp = x + ((y - z) * t) else: tmp = x * ((z - y) + 1.0) return tmp
function code(x, y, z, t) tmp = 0.0 if ((t <= -2.1e-121) || !(t <= 1.3e-34)) tmp = Float64(x + Float64(Float64(y - z) * t)); else tmp = Float64(x * Float64(Float64(z - y) + 1.0)); end return tmp end
function tmp_2 = code(x, y, z, t) tmp = 0.0; if ((t <= -2.1e-121) || ~((t <= 1.3e-34))) tmp = x + ((y - z) * t); else tmp = x * ((z - y) + 1.0); end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[Or[LessEqual[t, -2.1e-121], N[Not[LessEqual[t, 1.3e-34]], $MachinePrecision]], N[(x + N[(N[(y - z), $MachinePrecision] * t), $MachinePrecision]), $MachinePrecision], N[(x * N[(N[(z - y), $MachinePrecision] + 1.0), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;t \leq -2.1 \cdot 10^{-121} \lor \neg \left(t \leq 1.3 \cdot 10^{-34}\right):\\
\;\;\;\;x + \left(y - z\right) \cdot t\\
\mathbf{else}:\\
\;\;\;\;x \cdot \left(\left(z - y\right) + 1\right)\\
\end{array}
\end{array}
if t < -2.0999999999999999e-121 or 1.3e-34 < t Initial program 100.0%
Taylor expanded in t around inf 83.2%
if -2.0999999999999999e-121 < t < 1.3e-34Initial program 99.9%
Taylor expanded in x around inf 89.6%
mul-1-neg89.6%
unsub-neg89.6%
Simplified89.6%
Final simplification85.7%
(FPCore (x y z t) :precision binary64 (if (<= y -2.95e+140) (* y t) (if (<= y -5.1e-144) (* x z) (if (<= y 0.0014) (* t (- z)) (* y t)))))
double code(double x, double y, double z, double t) {
double tmp;
if (y <= -2.95e+140) {
tmp = y * t;
} else if (y <= -5.1e-144) {
tmp = x * z;
} else if (y <= 0.0014) {
tmp = t * -z;
} 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 <= (-2.95d+140)) then
tmp = y * t
else if (y <= (-5.1d-144)) then
tmp = x * z
else if (y <= 0.0014d0) then
tmp = t * -z
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 <= -2.95e+140) {
tmp = y * t;
} else if (y <= -5.1e-144) {
tmp = x * z;
} else if (y <= 0.0014) {
tmp = t * -z;
} else {
tmp = y * t;
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if y <= -2.95e+140: tmp = y * t elif y <= -5.1e-144: tmp = x * z elif y <= 0.0014: tmp = t * -z else: tmp = y * t return tmp
function code(x, y, z, t) tmp = 0.0 if (y <= -2.95e+140) tmp = Float64(y * t); elseif (y <= -5.1e-144) tmp = Float64(x * z); elseif (y <= 0.0014) tmp = Float64(t * Float64(-z)); else tmp = Float64(y * t); end return tmp end
function tmp_2 = code(x, y, z, t) tmp = 0.0; if (y <= -2.95e+140) tmp = y * t; elseif (y <= -5.1e-144) tmp = x * z; elseif (y <= 0.0014) tmp = t * -z; else tmp = y * t; end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[LessEqual[y, -2.95e+140], N[(y * t), $MachinePrecision], If[LessEqual[y, -5.1e-144], N[(x * z), $MachinePrecision], If[LessEqual[y, 0.0014], N[(t * (-z)), $MachinePrecision], N[(y * t), $MachinePrecision]]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;y \leq -2.95 \cdot 10^{+140}:\\
\;\;\;\;y \cdot t\\
\mathbf{elif}\;y \leq -5.1 \cdot 10^{-144}:\\
\;\;\;\;x \cdot z\\
\mathbf{elif}\;y \leq 0.0014:\\
\;\;\;\;t \cdot \left(-z\right)\\
\mathbf{else}:\\
\;\;\;\;y \cdot t\\
\end{array}
\end{array}
if y < -2.9500000000000001e140 or 0.00139999999999999999 < y Initial program 99.9%
*-commutative99.9%
sub-neg99.9%
distribute-lft-in95.3%
Applied egg-rr95.3%
Taylor expanded in x around 0 50.1%
Taylor expanded in x around 0 49.9%
Taylor expanded in z around 0 44.1%
if -2.9500000000000001e140 < y < -5.1e-144Initial program 100.0%
Taylor expanded in x around inf 65.1%
mul-1-neg65.1%
unsub-neg65.1%
Simplified65.1%
associate--r-65.1%
distribute-rgt-in63.4%
Applied egg-rr63.4%
Taylor expanded in z around inf 39.2%
if -5.1e-144 < y < 0.00139999999999999999Initial program 100.0%
*-commutative100.0%
sub-neg100.0%
distribute-lft-in100.0%
Applied egg-rr100.0%
Taylor expanded in x around 0 76.6%
Taylor expanded in x around 0 51.1%
Taylor expanded in z around inf 50.2%
mul-1-neg50.2%
distribute-rgt-neg-in50.2%
Simplified50.2%
Final simplification45.1%
(FPCore (x y z t) :precision binary64 (if (<= y -1.05e+131) (* x (- y)) (if (<= y -3.6e-144) (* x z) (if (<= y 0.0007) (* t (- z)) (* y t)))))
double code(double x, double y, double z, double t) {
double tmp;
if (y <= -1.05e+131) {
tmp = x * -y;
} else if (y <= -3.6e-144) {
tmp = x * z;
} else if (y <= 0.0007) {
tmp = t * -z;
} 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.05d+131)) then
tmp = x * -y
else if (y <= (-3.6d-144)) then
tmp = x * z
else if (y <= 0.0007d0) then
tmp = t * -z
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.05e+131) {
tmp = x * -y;
} else if (y <= -3.6e-144) {
tmp = x * z;
} else if (y <= 0.0007) {
tmp = t * -z;
} else {
tmp = y * t;
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if y <= -1.05e+131: tmp = x * -y elif y <= -3.6e-144: tmp = x * z elif y <= 0.0007: tmp = t * -z else: tmp = y * t return tmp
function code(x, y, z, t) tmp = 0.0 if (y <= -1.05e+131) tmp = Float64(x * Float64(-y)); elseif (y <= -3.6e-144) tmp = Float64(x * z); elseif (y <= 0.0007) tmp = Float64(t * Float64(-z)); else tmp = Float64(y * t); end return tmp end
function tmp_2 = code(x, y, z, t) tmp = 0.0; if (y <= -1.05e+131) tmp = x * -y; elseif (y <= -3.6e-144) tmp = x * z; elseif (y <= 0.0007) tmp = t * -z; else tmp = y * t; end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[LessEqual[y, -1.05e+131], N[(x * (-y)), $MachinePrecision], If[LessEqual[y, -3.6e-144], N[(x * z), $MachinePrecision], If[LessEqual[y, 0.0007], N[(t * (-z)), $MachinePrecision], N[(y * t), $MachinePrecision]]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;y \leq -1.05 \cdot 10^{+131}:\\
\;\;\;\;x \cdot \left(-y\right)\\
\mathbf{elif}\;y \leq -3.6 \cdot 10^{-144}:\\
\;\;\;\;x \cdot z\\
\mathbf{elif}\;y \leq 0.0007:\\
\;\;\;\;t \cdot \left(-z\right)\\
\mathbf{else}:\\
\;\;\;\;y \cdot t\\
\end{array}
\end{array}
if y < -1.04999999999999993e131Initial program 99.8%
Taylor expanded in x around inf 62.7%
mul-1-neg62.7%
unsub-neg62.7%
Simplified62.7%
Taylor expanded in z around 0 54.2%
Taylor expanded in y around inf 54.2%
associate-*r*54.2%
neg-mul-154.2%
*-commutative54.2%
Simplified54.2%
if -1.04999999999999993e131 < y < -3.6e-144Initial program 100.0%
Taylor expanded in x around inf 64.5%
mul-1-neg64.5%
unsub-neg64.5%
Simplified64.5%
associate--r-64.5%
distribute-rgt-in62.8%
Applied egg-rr62.8%
Taylor expanded in z around inf 39.9%
if -3.6e-144 < y < 6.99999999999999993e-4Initial program 100.0%
*-commutative100.0%
sub-neg100.0%
distribute-lft-in100.0%
Applied egg-rr100.0%
Taylor expanded in x around 0 76.6%
Taylor expanded in x around 0 51.1%
Taylor expanded in z around inf 50.2%
mul-1-neg50.2%
distribute-rgt-neg-in50.2%
Simplified50.2%
if 6.99999999999999993e-4 < y Initial program 100.0%
*-commutative100.0%
sub-neg100.0%
distribute-lft-in95.5%
Applied egg-rr95.5%
Taylor expanded in x around 0 56.0%
Taylor expanded in x around 0 56.3%
Taylor expanded in z around 0 50.7%
Final simplification48.6%
(FPCore (x y z t) :precision binary64 (if (or (<= x -1.45e+56) (not (<= x 4.8e+43))) (* x (+ z 1.0)) (* (- y z) t)))
double code(double x, double y, double z, double t) {
double tmp;
if ((x <= -1.45e+56) || !(x <= 4.8e+43)) {
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.45d+56)) .or. (.not. (x <= 4.8d+43))) 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.45e+56) || !(x <= 4.8e+43)) {
tmp = x * (z + 1.0);
} else {
tmp = (y - z) * t;
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if (x <= -1.45e+56) or not (x <= 4.8e+43): tmp = x * (z + 1.0) else: tmp = (y - z) * t return tmp
function code(x, y, z, t) tmp = 0.0 if ((x <= -1.45e+56) || !(x <= 4.8e+43)) 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.45e+56) || ~((x <= 4.8e+43))) 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.45e+56], N[Not[LessEqual[x, 4.8e+43]], $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.45 \cdot 10^{+56} \lor \neg \left(x \leq 4.8 \cdot 10^{+43}\right):\\
\;\;\;\;x \cdot \left(z + 1\right)\\
\mathbf{else}:\\
\;\;\;\;\left(y - z\right) \cdot t\\
\end{array}
\end{array}
if x < -1.45000000000000004e56 or 4.80000000000000046e43 < x Initial program 100.0%
Taylor expanded in x around inf 85.7%
mul-1-neg85.7%
unsub-neg85.7%
Simplified85.7%
Taylor expanded in y around 0 62.2%
+-commutative62.2%
Simplified62.2%
if -1.45000000000000004e56 < x < 4.80000000000000046e43Initial program 99.9%
*-commutative99.9%
sub-neg99.9%
distribute-lft-in97.4%
Applied egg-rr97.4%
Taylor expanded in x around 0 72.3%
Taylor expanded in x around 0 63.4%
Taylor expanded in t around 0 65.9%
mul-1-neg65.9%
sub-neg65.9%
Simplified65.9%
Final simplification64.5%
(FPCore (x y z t) :precision binary64 (if (<= x -1.8e+56) (* x (+ z 1.0)) (if (<= x 2.5e+126) (* (- y z) t) (* x (- 1.0 y)))))
double code(double x, double y, double z, double t) {
double tmp;
if (x <= -1.8e+56) {
tmp = x * (z + 1.0);
} else if (x <= 2.5e+126) {
tmp = (y - z) * t;
} else {
tmp = x * (1.0 - y);
}
return tmp;
}
real(8) function code(x, y, z, t)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
real(8) :: tmp
if (x <= (-1.8d+56)) then
tmp = x * (z + 1.0d0)
else if (x <= 2.5d+126) then
tmp = (y - z) * t
else
tmp = x * (1.0d0 - y)
end if
code = tmp
end function
public static double code(double x, double y, double z, double t) {
double tmp;
if (x <= -1.8e+56) {
tmp = x * (z + 1.0);
} else if (x <= 2.5e+126) {
tmp = (y - z) * t;
} else {
tmp = x * (1.0 - y);
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if x <= -1.8e+56: tmp = x * (z + 1.0) elif x <= 2.5e+126: tmp = (y - z) * t else: tmp = x * (1.0 - y) return tmp
function code(x, y, z, t) tmp = 0.0 if (x <= -1.8e+56) tmp = Float64(x * Float64(z + 1.0)); elseif (x <= 2.5e+126) tmp = Float64(Float64(y - z) * t); else tmp = Float64(x * Float64(1.0 - y)); end return tmp end
function tmp_2 = code(x, y, z, t) tmp = 0.0; if (x <= -1.8e+56) tmp = x * (z + 1.0); elseif (x <= 2.5e+126) tmp = (y - z) * t; else tmp = x * (1.0 - y); end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[LessEqual[x, -1.8e+56], N[(x * N[(z + 1.0), $MachinePrecision]), $MachinePrecision], If[LessEqual[x, 2.5e+126], N[(N[(y - z), $MachinePrecision] * t), $MachinePrecision], N[(x * N[(1.0 - y), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x \leq -1.8 \cdot 10^{+56}:\\
\;\;\;\;x \cdot \left(z + 1\right)\\
\mathbf{elif}\;x \leq 2.5 \cdot 10^{+126}:\\
\;\;\;\;\left(y - z\right) \cdot t\\
\mathbf{else}:\\
\;\;\;\;x \cdot \left(1 - y\right)\\
\end{array}
\end{array}
if x < -1.79999999999999999e56Initial program 100.0%
Taylor expanded in x around inf 86.8%
mul-1-neg86.8%
unsub-neg86.8%
Simplified86.8%
Taylor expanded in y around 0 65.8%
+-commutative65.8%
Simplified65.8%
if -1.79999999999999999e56 < x < 2.49999999999999989e126Initial program 99.9%
*-commutative99.9%
sub-neg99.9%
distribute-lft-in97.6%
Applied egg-rr97.6%
Taylor expanded in x around 0 71.4%
Taylor expanded in x around 0 62.5%
Taylor expanded in t around 0 64.9%
mul-1-neg64.9%
sub-neg64.9%
Simplified64.9%
if 2.49999999999999989e126 < x Initial program 100.0%
Taylor expanded in x around inf 92.1%
mul-1-neg92.1%
unsub-neg92.1%
Simplified92.1%
Taylor expanded in z around 0 70.5%
Final simplification65.9%
(FPCore (x y z t) :precision binary64 (if (or (<= y -4.6e-9) (not (<= y 0.00045))) (* y t) x))
double code(double x, double y, double z, double t) {
double tmp;
if ((y <= -4.6e-9) || !(y <= 0.00045)) {
tmp = y * t;
} else {
tmp = x;
}
return tmp;
}
real(8) function code(x, y, z, t)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
real(8) :: tmp
if ((y <= (-4.6d-9)) .or. (.not. (y <= 0.00045d0))) then
tmp = y * t
else
tmp = x
end if
code = tmp
end function
public static double code(double x, double y, double z, double t) {
double tmp;
if ((y <= -4.6e-9) || !(y <= 0.00045)) {
tmp = y * t;
} else {
tmp = x;
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if (y <= -4.6e-9) or not (y <= 0.00045): tmp = y * t else: tmp = x return tmp
function code(x, y, z, t) tmp = 0.0 if ((y <= -4.6e-9) || !(y <= 0.00045)) tmp = Float64(y * t); else tmp = x; end return tmp end
function tmp_2 = code(x, y, z, t) tmp = 0.0; if ((y <= -4.6e-9) || ~((y <= 0.00045))) tmp = y * t; else tmp = x; end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[Or[LessEqual[y, -4.6e-9], N[Not[LessEqual[y, 0.00045]], $MachinePrecision]], N[(y * t), $MachinePrecision], x]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;y \leq -4.6 \cdot 10^{-9} \lor \neg \left(y \leq 0.00045\right):\\
\;\;\;\;y \cdot t\\
\mathbf{else}:\\
\;\;\;\;x\\
\end{array}
\end{array}
if y < -4.5999999999999998e-9 or 4.4999999999999999e-4 < y Initial program 99.9%
*-commutative99.9%
sub-neg99.9%
distribute-lft-in94.9%
Applied egg-rr94.9%
Taylor expanded in x around 0 48.2%
Taylor expanded in x around 0 47.5%
Taylor expanded in z around 0 39.5%
if -4.5999999999999998e-9 < y < 4.4999999999999999e-4Initial program 100.0%
Taylor expanded in t around inf 73.0%
Taylor expanded in x around inf 27.7%
Final simplification34.1%
(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 61.2%
Taylor expanded in x around inf 14.6%
Final simplification14.6%
(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 2023310
(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))))