
(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 -2.9e+28)
t_2
(if (<= y 1.85e-192)
t_1
(if (<= y 2.5e-125) (+ x (* x z)) (if (<= y 1.1e+47) 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 <= -2.9e+28) {
tmp = t_2;
} else if (y <= 1.85e-192) {
tmp = t_1;
} else if (y <= 2.5e-125) {
tmp = x + (x * z);
} else if (y <= 1.1e+47) {
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 <= (-2.9d+28)) then
tmp = t_2
else if (y <= 1.85d-192) then
tmp = t_1
else if (y <= 2.5d-125) then
tmp = x + (x * z)
else if (y <= 1.1d+47) 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 <= -2.9e+28) {
tmp = t_2;
} else if (y <= 1.85e-192) {
tmp = t_1;
} else if (y <= 2.5e-125) {
tmp = x + (x * z);
} else if (y <= 1.1e+47) {
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 <= -2.9e+28: tmp = t_2 elif y <= 1.85e-192: tmp = t_1 elif y <= 2.5e-125: tmp = x + (x * z) elif y <= 1.1e+47: 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 <= -2.9e+28) tmp = t_2; elseif (y <= 1.85e-192) tmp = t_1; elseif (y <= 2.5e-125) tmp = Float64(x + Float64(x * z)); elseif (y <= 1.1e+47) 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 <= -2.9e+28) tmp = t_2; elseif (y <= 1.85e-192) tmp = t_1; elseif (y <= 2.5e-125) tmp = x + (x * z); elseif (y <= 1.1e+47) 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, -2.9e+28], t$95$2, If[LessEqual[y, 1.85e-192], t$95$1, If[LessEqual[y, 2.5e-125], N[(x + N[(x * z), $MachinePrecision]), $MachinePrecision], If[LessEqual[y, 1.1e+47], 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 -2.9 \cdot 10^{+28}:\\
\;\;\;\;t_2\\
\mathbf{elif}\;y \leq 1.85 \cdot 10^{-192}:\\
\;\;\;\;t_1\\
\mathbf{elif}\;y \leq 2.5 \cdot 10^{-125}:\\
\;\;\;\;x + x \cdot z\\
\mathbf{elif}\;y \leq 1.1 \cdot 10^{+47}:\\
\;\;\;\;t_1\\
\mathbf{else}:\\
\;\;\;\;t_2\\
\end{array}
\end{array}
if y < -2.9000000000000001e28 or 1.1e47 < y Initial program 100.0%
Taylor expanded in z around 0 84.9%
if -2.9000000000000001e28 < y < 1.85e-192 or 2.49999999999999983e-125 < y < 1.1e47Initial program 100.0%
Taylor expanded in t around inf 75.6%
if 1.85e-192 < y < 2.49999999999999983e-125Initial program 100.0%
Taylor expanded in x around inf 93.1%
+-commutative93.1%
distribute-rgt1-in93.1%
mul-1-neg93.1%
cancel-sign-sub-inv93.1%
*-commutative93.1%
Simplified93.1%
Taylor expanded in y around 0 93.1%
+-commutative93.1%
mul-1-neg93.1%
sub-neg93.1%
mul-1-neg93.1%
Simplified93.1%
Taylor expanded in y around 0 93.1%
Final simplification80.7%
(FPCore (x y z t)
:precision binary64
(let* ((t_1 (- (* z t))))
(if (<= t -5.2e+102)
(* y t)
(if (<= t -1.75e-20)
t_1
(if (<= t 3e-193)
(* x z)
(if (<= t 1.4e-94) (* x (- y)) (if (<= t 2.32e+207) t_1 (* y t))))))))
double code(double x, double y, double z, double t) {
double t_1 = -(z * t);
double tmp;
if (t <= -5.2e+102) {
tmp = y * t;
} else if (t <= -1.75e-20) {
tmp = t_1;
} else if (t <= 3e-193) {
tmp = x * z;
} else if (t <= 1.4e-94) {
tmp = x * -y;
} else if (t <= 2.32e+207) {
tmp = t_1;
} 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) :: t_1
real(8) :: tmp
t_1 = -(z * t)
if (t <= (-5.2d+102)) then
tmp = y * t
else if (t <= (-1.75d-20)) then
tmp = t_1
else if (t <= 3d-193) then
tmp = x * z
else if (t <= 1.4d-94) then
tmp = x * -y
else if (t <= 2.32d+207) then
tmp = t_1
else
tmp = y * t
end if
code = tmp
end function
public static double code(double x, double y, double z, double t) {
double t_1 = -(z * t);
double tmp;
if (t <= -5.2e+102) {
tmp = y * t;
} else if (t <= -1.75e-20) {
tmp = t_1;
} else if (t <= 3e-193) {
tmp = x * z;
} else if (t <= 1.4e-94) {
tmp = x * -y;
} else if (t <= 2.32e+207) {
tmp = t_1;
} else {
tmp = y * t;
}
return tmp;
}
def code(x, y, z, t): t_1 = -(z * t) tmp = 0 if t <= -5.2e+102: tmp = y * t elif t <= -1.75e-20: tmp = t_1 elif t <= 3e-193: tmp = x * z elif t <= 1.4e-94: tmp = x * -y elif t <= 2.32e+207: tmp = t_1 else: tmp = y * t return tmp
function code(x, y, z, t) t_1 = Float64(-Float64(z * t)) tmp = 0.0 if (t <= -5.2e+102) tmp = Float64(y * t); elseif (t <= -1.75e-20) tmp = t_1; elseif (t <= 3e-193) tmp = Float64(x * z); elseif (t <= 1.4e-94) tmp = Float64(x * Float64(-y)); elseif (t <= 2.32e+207) tmp = t_1; else tmp = Float64(y * t); end return tmp end
function tmp_2 = code(x, y, z, t) t_1 = -(z * t); tmp = 0.0; if (t <= -5.2e+102) tmp = y * t; elseif (t <= -1.75e-20) tmp = t_1; elseif (t <= 3e-193) tmp = x * z; elseif (t <= 1.4e-94) tmp = x * -y; elseif (t <= 2.32e+207) tmp = t_1; else tmp = y * t; end tmp_2 = tmp; end
code[x_, y_, z_, t_] := Block[{t$95$1 = (-N[(z * t), $MachinePrecision])}, If[LessEqual[t, -5.2e+102], N[(y * t), $MachinePrecision], If[LessEqual[t, -1.75e-20], t$95$1, If[LessEqual[t, 3e-193], N[(x * z), $MachinePrecision], If[LessEqual[t, 1.4e-94], N[(x * (-y)), $MachinePrecision], If[LessEqual[t, 2.32e+207], t$95$1, N[(y * t), $MachinePrecision]]]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := -z \cdot t\\
\mathbf{if}\;t \leq -5.2 \cdot 10^{+102}:\\
\;\;\;\;y \cdot t\\
\mathbf{elif}\;t \leq -1.75 \cdot 10^{-20}:\\
\;\;\;\;t_1\\
\mathbf{elif}\;t \leq 3 \cdot 10^{-193}:\\
\;\;\;\;x \cdot z\\
\mathbf{elif}\;t \leq 1.4 \cdot 10^{-94}:\\
\;\;\;\;x \cdot \left(-y\right)\\
\mathbf{elif}\;t \leq 2.32 \cdot 10^{+207}:\\
\;\;\;\;t_1\\
\mathbf{else}:\\
\;\;\;\;y \cdot t\\
\end{array}
\end{array}
if t < -5.20000000000000013e102 or 2.32e207 < t Initial program 100.0%
Taylor expanded in t around inf 90.9%
Taylor expanded in y around inf 60.0%
if -5.20000000000000013e102 < t < -1.75000000000000002e-20 or 1.3999999999999999e-94 < t < 2.32e207Initial program 100.0%
Taylor expanded in t around inf 72.7%
Taylor expanded in z around inf 46.8%
mul-1-neg46.8%
distribute-rgt-neg-in46.8%
Simplified46.8%
if -1.75000000000000002e-20 < t < 2.9999999999999999e-193Initial program 99.9%
Taylor expanded in x around inf 87.6%
+-commutative87.6%
distribute-rgt1-in87.6%
mul-1-neg87.6%
cancel-sign-sub-inv87.6%
*-commutative87.6%
Simplified87.6%
Taylor expanded in z around inf 42.3%
if 2.9999999999999999e-193 < t < 1.3999999999999999e-94Initial program 99.9%
Taylor expanded in x around inf 68.0%
+-commutative68.0%
distribute-rgt1-in68.0%
mul-1-neg68.0%
cancel-sign-sub-inv68.0%
*-commutative68.0%
Simplified68.0%
Taylor expanded in y around inf 42.1%
mul-1-neg42.1%
*-commutative42.1%
distribute-rgt-neg-in42.1%
Simplified42.1%
Final simplification48.2%
(FPCore (x y z t)
:precision binary64
(let* ((t_1 (- (* z t))))
(if (<= t -2e+103)
(* y t)
(if (<= t -1.8e-20)
t_1
(if (<= t 3e-176) (* x z) (if (<= t 6e+208) t_1 (* y t)))))))
double code(double x, double y, double z, double t) {
double t_1 = -(z * t);
double tmp;
if (t <= -2e+103) {
tmp = y * t;
} else if (t <= -1.8e-20) {
tmp = t_1;
} else if (t <= 3e-176) {
tmp = x * z;
} else if (t <= 6e+208) {
tmp = t_1;
} 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) :: t_1
real(8) :: tmp
t_1 = -(z * t)
if (t <= (-2d+103)) then
tmp = y * t
else if (t <= (-1.8d-20)) then
tmp = t_1
else if (t <= 3d-176) then
tmp = x * z
else if (t <= 6d+208) then
tmp = t_1
else
tmp = y * t
end if
code = tmp
end function
public static double code(double x, double y, double z, double t) {
double t_1 = -(z * t);
double tmp;
if (t <= -2e+103) {
tmp = y * t;
} else if (t <= -1.8e-20) {
tmp = t_1;
} else if (t <= 3e-176) {
tmp = x * z;
} else if (t <= 6e+208) {
tmp = t_1;
} else {
tmp = y * t;
}
return tmp;
}
def code(x, y, z, t): t_1 = -(z * t) tmp = 0 if t <= -2e+103: tmp = y * t elif t <= -1.8e-20: tmp = t_1 elif t <= 3e-176: tmp = x * z elif t <= 6e+208: tmp = t_1 else: tmp = y * t return tmp
function code(x, y, z, t) t_1 = Float64(-Float64(z * t)) tmp = 0.0 if (t <= -2e+103) tmp = Float64(y * t); elseif (t <= -1.8e-20) tmp = t_1; elseif (t <= 3e-176) tmp = Float64(x * z); elseif (t <= 6e+208) tmp = t_1; else tmp = Float64(y * t); end return tmp end
function tmp_2 = code(x, y, z, t) t_1 = -(z * t); tmp = 0.0; if (t <= -2e+103) tmp = y * t; elseif (t <= -1.8e-20) tmp = t_1; elseif (t <= 3e-176) tmp = x * z; elseif (t <= 6e+208) tmp = t_1; else tmp = y * t; end tmp_2 = tmp; end
code[x_, y_, z_, t_] := Block[{t$95$1 = (-N[(z * t), $MachinePrecision])}, If[LessEqual[t, -2e+103], N[(y * t), $MachinePrecision], If[LessEqual[t, -1.8e-20], t$95$1, If[LessEqual[t, 3e-176], N[(x * z), $MachinePrecision], If[LessEqual[t, 6e+208], t$95$1, N[(y * t), $MachinePrecision]]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := -z \cdot t\\
\mathbf{if}\;t \leq -2 \cdot 10^{+103}:\\
\;\;\;\;y \cdot t\\
\mathbf{elif}\;t \leq -1.8 \cdot 10^{-20}:\\
\;\;\;\;t_1\\
\mathbf{elif}\;t \leq 3 \cdot 10^{-176}:\\
\;\;\;\;x \cdot z\\
\mathbf{elif}\;t \leq 6 \cdot 10^{+208}:\\
\;\;\;\;t_1\\
\mathbf{else}:\\
\;\;\;\;y \cdot t\\
\end{array}
\end{array}
if t < -2e103 or 5.99999999999999989e208 < t Initial program 100.0%
Taylor expanded in t around inf 90.9%
Taylor expanded in y around inf 60.0%
if -2e103 < t < -1.79999999999999987e-20 or 3e-176 < t < 5.99999999999999989e208Initial program 100.0%
Taylor expanded in t around inf 70.6%
Taylor expanded in z around inf 43.0%
mul-1-neg43.0%
distribute-rgt-neg-in43.0%
Simplified43.0%
if -1.79999999999999987e-20 < t < 3e-176Initial program 100.0%
Taylor expanded in x around inf 87.5%
+-commutative87.5%
distribute-rgt1-in87.5%
mul-1-neg87.5%
cancel-sign-sub-inv87.5%
*-commutative87.5%
Simplified87.5%
Taylor expanded in z around inf 40.4%
Final simplification46.3%
(FPCore (x y z t)
:precision binary64
(let* ((t_1 (+ x (* x z))))
(if (<= x -4e-34)
t_1
(if (<= x 8.8e+21)
(* (- y z) t)
(if (<= x 1.55e+186) (- x (* x y)) t_1)))))
double code(double x, double y, double z, double t) {
double t_1 = x + (x * z);
double tmp;
if (x <= -4e-34) {
tmp = t_1;
} else if (x <= 8.8e+21) {
tmp = (y - z) * t;
} else if (x <= 1.55e+186) {
tmp = x - (x * 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 + (x * z)
if (x <= (-4d-34)) then
tmp = t_1
else if (x <= 8.8d+21) then
tmp = (y - z) * t
else if (x <= 1.55d+186) then
tmp = x - (x * 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 + (x * z);
double tmp;
if (x <= -4e-34) {
tmp = t_1;
} else if (x <= 8.8e+21) {
tmp = (y - z) * t;
} else if (x <= 1.55e+186) {
tmp = x - (x * y);
} else {
tmp = t_1;
}
return tmp;
}
def code(x, y, z, t): t_1 = x + (x * z) tmp = 0 if x <= -4e-34: tmp = t_1 elif x <= 8.8e+21: tmp = (y - z) * t elif x <= 1.55e+186: tmp = x - (x * y) else: tmp = t_1 return tmp
function code(x, y, z, t) t_1 = Float64(x + Float64(x * z)) tmp = 0.0 if (x <= -4e-34) tmp = t_1; elseif (x <= 8.8e+21) tmp = Float64(Float64(y - z) * t); elseif (x <= 1.55e+186) tmp = Float64(x - Float64(x * y)); else tmp = t_1; end return tmp end
function tmp_2 = code(x, y, z, t) t_1 = x + (x * z); tmp = 0.0; if (x <= -4e-34) tmp = t_1; elseif (x <= 8.8e+21) tmp = (y - z) * t; elseif (x <= 1.55e+186) tmp = x - (x * y); else tmp = t_1; end tmp_2 = tmp; end
code[x_, y_, z_, t_] := Block[{t$95$1 = N[(x + N[(x * z), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[x, -4e-34], t$95$1, If[LessEqual[x, 8.8e+21], N[(N[(y - z), $MachinePrecision] * t), $MachinePrecision], If[LessEqual[x, 1.55e+186], N[(x - N[(x * y), $MachinePrecision]), $MachinePrecision], t$95$1]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := x + x \cdot z\\
\mathbf{if}\;x \leq -4 \cdot 10^{-34}:\\
\;\;\;\;t_1\\
\mathbf{elif}\;x \leq 8.8 \cdot 10^{+21}:\\
\;\;\;\;\left(y - z\right) \cdot t\\
\mathbf{elif}\;x \leq 1.55 \cdot 10^{+186}:\\
\;\;\;\;x - x \cdot y\\
\mathbf{else}:\\
\;\;\;\;t_1\\
\end{array}
\end{array}
if x < -3.99999999999999971e-34 or 1.5500000000000001e186 < x Initial program 100.0%
Taylor expanded in x around inf 82.2%
+-commutative82.2%
distribute-rgt1-in82.2%
mul-1-neg82.2%
cancel-sign-sub-inv82.2%
*-commutative82.2%
Simplified82.2%
Taylor expanded in y around 0 80.1%
+-commutative80.1%
mul-1-neg80.1%
sub-neg80.1%
mul-1-neg80.1%
Simplified80.1%
Taylor expanded in y around 0 61.2%
if -3.99999999999999971e-34 < x < 8.8e21Initial program 99.9%
flip-+51.2%
div-inv51.1%
pow251.1%
Applied egg-rr51.1%
Taylor expanded in t around -inf 100.0%
Taylor expanded in x around 0 75.9%
if 8.8e21 < x < 1.5500000000000001e186Initial program 100.0%
Taylor expanded in x around inf 82.4%
+-commutative82.4%
distribute-rgt1-in82.4%
mul-1-neg82.4%
cancel-sign-sub-inv82.4%
*-commutative82.4%
Simplified82.4%
Taylor expanded in z around 0 64.6%
Final simplification68.5%
(FPCore (x y z t) :precision binary64 (if (or (<= t -5.2e-107) (not (<= t 1e-190))) (- x (* t (- z y))) (+ x (* x z))))
double code(double x, double y, double z, double t) {
double tmp;
if ((t <= -5.2e-107) || !(t <= 1e-190)) {
tmp = x - (t * (z - y));
} else {
tmp = x + (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 ((t <= (-5.2d-107)) .or. (.not. (t <= 1d-190))) then
tmp = x - (t * (z - y))
else
tmp = x + (x * z)
end if
code = tmp
end function
public static double code(double x, double y, double z, double t) {
double tmp;
if ((t <= -5.2e-107) || !(t <= 1e-190)) {
tmp = x - (t * (z - y));
} else {
tmp = x + (x * z);
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if (t <= -5.2e-107) or not (t <= 1e-190): tmp = x - (t * (z - y)) else: tmp = x + (x * z) return tmp
function code(x, y, z, t) tmp = 0.0 if ((t <= -5.2e-107) || !(t <= 1e-190)) tmp = Float64(x - Float64(t * Float64(z - y))); else tmp = Float64(x + Float64(x * z)); end return tmp end
function tmp_2 = code(x, y, z, t) tmp = 0.0; if ((t <= -5.2e-107) || ~((t <= 1e-190))) tmp = x - (t * (z - y)); else tmp = x + (x * z); end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[Or[LessEqual[t, -5.2e-107], N[Not[LessEqual[t, 1e-190]], $MachinePrecision]], N[(x - N[(t * N[(z - y), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(x + N[(x * z), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;t \leq -5.2 \cdot 10^{-107} \lor \neg \left(t \leq 10^{-190}\right):\\
\;\;\;\;x - t \cdot \left(z - y\right)\\
\mathbf{else}:\\
\;\;\;\;x + x \cdot z\\
\end{array}
\end{array}
if t < -5.2000000000000001e-107 or 1e-190 < t Initial program 100.0%
Taylor expanded in t around inf 74.1%
if -5.2000000000000001e-107 < t < 1e-190Initial program 99.9%
Taylor expanded in x around inf 92.3%
+-commutative92.3%
distribute-rgt1-in92.3%
mul-1-neg92.3%
cancel-sign-sub-inv92.3%
*-commutative92.3%
Simplified92.3%
Taylor expanded in y around 0 90.8%
+-commutative90.8%
mul-1-neg90.8%
sub-neg90.8%
mul-1-neg90.8%
Simplified90.8%
Taylor expanded in y around 0 67.2%
Final simplification72.2%
(FPCore (x y z t) :precision binary64 (if (or (<= x -3.8e-33) (not (<= x 3.5e+21))) (+ x (* x (- z y))) (- x (* t (- z y)))))
double code(double x, double y, double z, double t) {
double tmp;
if ((x <= -3.8e-33) || !(x <= 3.5e+21)) {
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 <= (-3.8d-33)) .or. (.not. (x <= 3.5d+21))) 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 <= -3.8e-33) || !(x <= 3.5e+21)) {
tmp = x + (x * (z - y));
} else {
tmp = x - (t * (z - y));
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if (x <= -3.8e-33) or not (x <= 3.5e+21): tmp = x + (x * (z - y)) else: tmp = x - (t * (z - y)) return tmp
function code(x, y, z, t) tmp = 0.0 if ((x <= -3.8e-33) || !(x <= 3.5e+21)) 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 <= -3.8e-33) || ~((x <= 3.5e+21))) 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, -3.8e-33], N[Not[LessEqual[x, 3.5e+21]], $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 -3.8 \cdot 10^{-33} \lor \neg \left(x \leq 3.5 \cdot 10^{+21}\right):\\
\;\;\;\;x + x \cdot \left(z - y\right)\\
\mathbf{else}:\\
\;\;\;\;x - t \cdot \left(z - y\right)\\
\end{array}
\end{array}
if x < -3.79999999999999994e-33 or 3.5e21 < x Initial program 100.0%
Taylor expanded in x around inf 82.2%
+-commutative82.2%
distribute-rgt1-in82.2%
mul-1-neg82.2%
cancel-sign-sub-inv82.2%
*-commutative82.2%
Simplified82.2%
if -3.79999999999999994e-33 < x < 3.5e21Initial program 99.9%
Taylor expanded in t around inf 82.2%
Final simplification82.2%
(FPCore (x y z t) :precision binary64 (if (or (<= y -1.2e+27) (not (<= y 4e+38))) (+ x (* y (- t x))) (+ x (* z (- x t)))))
double code(double x, double y, double z, double t) {
double tmp;
if ((y <= -1.2e+27) || !(y <= 4e+38)) {
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 <= (-1.2d+27)) .or. (.not. (y <= 4d+38))) 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 <= -1.2e+27) || !(y <= 4e+38)) {
tmp = x + (y * (t - x));
} else {
tmp = x + (z * (x - t));
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if (y <= -1.2e+27) or not (y <= 4e+38): tmp = x + (y * (t - x)) else: tmp = x + (z * (x - t)) return tmp
function code(x, y, z, t) tmp = 0.0 if ((y <= -1.2e+27) || !(y <= 4e+38)) 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 <= -1.2e+27) || ~((y <= 4e+38))) 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, -1.2e+27], N[Not[LessEqual[y, 4e+38]], $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 -1.2 \cdot 10^{+27} \lor \neg \left(y \leq 4 \cdot 10^{+38}\right):\\
\;\;\;\;x + y \cdot \left(t - x\right)\\
\mathbf{else}:\\
\;\;\;\;x + z \cdot \left(x - t\right)\\
\end{array}
\end{array}
if y < -1.19999999999999999e27 or 3.99999999999999991e38 < y Initial program 100.0%
Taylor expanded in z around 0 84.6%
if -1.19999999999999999e27 < y < 3.99999999999999991e38Initial program 100.0%
Taylor expanded in y around 0 89.6%
+-commutative89.6%
mul-1-neg89.6%
unsub-neg89.6%
*-commutative89.6%
Simplified89.6%
Final simplification87.3%
(FPCore (x y z t) :precision binary64 (if (<= z -5.4e+38) (* x z) (if (<= z -1.12e-265) (* y t) (if (<= z 16600000000000.0) x (* x z)))))
double code(double x, double y, double z, double t) {
double tmp;
if (z <= -5.4e+38) {
tmp = x * z;
} else if (z <= -1.12e-265) {
tmp = y * t;
} else if (z <= 16600000000000.0) {
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 <= (-5.4d+38)) then
tmp = x * z
else if (z <= (-1.12d-265)) then
tmp = y * t
else if (z <= 16600000000000.0d0) 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 <= -5.4e+38) {
tmp = x * z;
} else if (z <= -1.12e-265) {
tmp = y * t;
} else if (z <= 16600000000000.0) {
tmp = x;
} else {
tmp = x * z;
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if z <= -5.4e+38: tmp = x * z elif z <= -1.12e-265: tmp = y * t elif z <= 16600000000000.0: tmp = x else: tmp = x * z return tmp
function code(x, y, z, t) tmp = 0.0 if (z <= -5.4e+38) tmp = Float64(x * z); elseif (z <= -1.12e-265) tmp = Float64(y * t); elseif (z <= 16600000000000.0) tmp = x; else tmp = Float64(x * z); end return tmp end
function tmp_2 = code(x, y, z, t) tmp = 0.0; if (z <= -5.4e+38) tmp = x * z; elseif (z <= -1.12e-265) tmp = y * t; elseif (z <= 16600000000000.0) tmp = x; else tmp = x * z; end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[LessEqual[z, -5.4e+38], N[(x * z), $MachinePrecision], If[LessEqual[z, -1.12e-265], N[(y * t), $MachinePrecision], If[LessEqual[z, 16600000000000.0], x, N[(x * z), $MachinePrecision]]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \leq -5.4 \cdot 10^{+38}:\\
\;\;\;\;x \cdot z\\
\mathbf{elif}\;z \leq -1.12 \cdot 10^{-265}:\\
\;\;\;\;y \cdot t\\
\mathbf{elif}\;z \leq 16600000000000:\\
\;\;\;\;x\\
\mathbf{else}:\\
\;\;\;\;x \cdot z\\
\end{array}
\end{array}
if z < -5.39999999999999992e38 or 1.66e13 < z Initial program 100.0%
Taylor expanded in x around inf 55.3%
+-commutative55.3%
distribute-rgt1-in55.3%
mul-1-neg55.3%
cancel-sign-sub-inv55.3%
*-commutative55.3%
Simplified55.3%
Taylor expanded in z around inf 47.0%
if -5.39999999999999992e38 < z < -1.12e-265Initial program 100.0%
Taylor expanded in t around inf 76.6%
Taylor expanded in y around inf 45.8%
if -1.12e-265 < z < 1.66e13Initial program 100.0%
Taylor expanded in t around inf 70.8%
Taylor expanded in x around inf 38.3%
Final simplification44.5%
(FPCore (x y z t) :precision binary64 (if (or (<= t -7.1e-28) (not (<= t 9.5e-191))) (* (- y z) t) (* x z)))
double code(double x, double y, double z, double t) {
double tmp;
if ((t <= -7.1e-28) || !(t <= 9.5e-191)) {
tmp = (y - z) * 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 ((t <= (-7.1d-28)) .or. (.not. (t <= 9.5d-191))) then
tmp = (y - z) * 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 ((t <= -7.1e-28) || !(t <= 9.5e-191)) {
tmp = (y - z) * t;
} else {
tmp = x * z;
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if (t <= -7.1e-28) or not (t <= 9.5e-191): tmp = (y - z) * t else: tmp = x * z return tmp
function code(x, y, z, t) tmp = 0.0 if ((t <= -7.1e-28) || !(t <= 9.5e-191)) tmp = Float64(Float64(y - z) * t); else tmp = Float64(x * z); end return tmp end
function tmp_2 = code(x, y, z, t) tmp = 0.0; if ((t <= -7.1e-28) || ~((t <= 9.5e-191))) tmp = (y - z) * t; else tmp = x * z; end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[Or[LessEqual[t, -7.1e-28], N[Not[LessEqual[t, 9.5e-191]], $MachinePrecision]], N[(N[(y - z), $MachinePrecision] * t), $MachinePrecision], N[(x * z), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;t \leq -7.1 \cdot 10^{-28} \lor \neg \left(t \leq 9.5 \cdot 10^{-191}\right):\\
\;\;\;\;\left(y - z\right) \cdot t\\
\mathbf{else}:\\
\;\;\;\;x \cdot z\\
\end{array}
\end{array}
if t < -7.09999999999999981e-28 or 9.4999999999999996e-191 < t Initial program 100.0%
flip-+25.4%
div-inv25.3%
pow225.3%
Applied egg-rr25.3%
Taylor expanded in t around -inf 80.9%
Taylor expanded in x around 0 66.5%
if -7.09999999999999981e-28 < t < 9.4999999999999996e-191Initial program 99.9%
Taylor expanded in x around inf 87.6%
+-commutative87.6%
distribute-rgt1-in87.6%
mul-1-neg87.6%
cancel-sign-sub-inv87.6%
*-commutative87.6%
Simplified87.6%
Taylor expanded in z around inf 42.3%
Final simplification58.2%
(FPCore (x y z t) :precision binary64 (if (or (<= t -1.75e-20) (not (<= t 7.6e-190))) (* (- y z) t) (+ x (* x z))))
double code(double x, double y, double z, double t) {
double tmp;
if ((t <= -1.75e-20) || !(t <= 7.6e-190)) {
tmp = (y - z) * t;
} else {
tmp = x + (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 ((t <= (-1.75d-20)) .or. (.not. (t <= 7.6d-190))) then
tmp = (y - z) * t
else
tmp = x + (x * z)
end if
code = tmp
end function
public static double code(double x, double y, double z, double t) {
double tmp;
if ((t <= -1.75e-20) || !(t <= 7.6e-190)) {
tmp = (y - z) * t;
} else {
tmp = x + (x * z);
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if (t <= -1.75e-20) or not (t <= 7.6e-190): tmp = (y - z) * t else: tmp = x + (x * z) return tmp
function code(x, y, z, t) tmp = 0.0 if ((t <= -1.75e-20) || !(t <= 7.6e-190)) tmp = Float64(Float64(y - z) * t); else tmp = Float64(x + Float64(x * z)); end return tmp end
function tmp_2 = code(x, y, z, t) tmp = 0.0; if ((t <= -1.75e-20) || ~((t <= 7.6e-190))) tmp = (y - z) * t; else tmp = x + (x * z); end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[Or[LessEqual[t, -1.75e-20], N[Not[LessEqual[t, 7.6e-190]], $MachinePrecision]], N[(N[(y - z), $MachinePrecision] * t), $MachinePrecision], N[(x + N[(x * z), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;t \leq -1.75 \cdot 10^{-20} \lor \neg \left(t \leq 7.6 \cdot 10^{-190}\right):\\
\;\;\;\;\left(y - z\right) \cdot t\\
\mathbf{else}:\\
\;\;\;\;x + x \cdot z\\
\end{array}
\end{array}
if t < -1.75000000000000002e-20 or 7.5999999999999996e-190 < t Initial program 100.0%
flip-+24.5%
div-inv24.4%
pow224.4%
Applied egg-rr24.4%
Taylor expanded in t around -inf 80.7%
Taylor expanded in x around 0 67.3%
if -1.75000000000000002e-20 < t < 7.5999999999999996e-190Initial program 99.9%
Taylor expanded in x around inf 87.9%
+-commutative87.9%
distribute-rgt1-in87.9%
mul-1-neg87.9%
cancel-sign-sub-inv87.9%
*-commutative87.9%
Simplified87.9%
Taylor expanded in y around 0 86.8%
+-commutative86.8%
mul-1-neg86.8%
sub-neg86.8%
mul-1-neg86.8%
Simplified86.8%
Taylor expanded in y around 0 63.3%
Final simplification65.9%
(FPCore (x y z t) :precision binary64 (if (<= y -9.5e-24) (* y t) (if (<= y 1.15e-99) x (* y t))))
double code(double x, double y, double z, double t) {
double tmp;
if (y <= -9.5e-24) {
tmp = y * t;
} else if (y <= 1.15e-99) {
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 <= (-9.5d-24)) then
tmp = y * t
else if (y <= 1.15d-99) 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 <= -9.5e-24) {
tmp = y * t;
} else if (y <= 1.15e-99) {
tmp = x;
} else {
tmp = y * t;
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if y <= -9.5e-24: tmp = y * t elif y <= 1.15e-99: tmp = x else: tmp = y * t return tmp
function code(x, y, z, t) tmp = 0.0 if (y <= -9.5e-24) tmp = Float64(y * t); elseif (y <= 1.15e-99) tmp = x; else tmp = Float64(y * t); end return tmp end
function tmp_2 = code(x, y, z, t) tmp = 0.0; if (y <= -9.5e-24) tmp = y * t; elseif (y <= 1.15e-99) tmp = x; else tmp = y * t; end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[LessEqual[y, -9.5e-24], N[(y * t), $MachinePrecision], If[LessEqual[y, 1.15e-99], x, N[(y * t), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;y \leq -9.5 \cdot 10^{-24}:\\
\;\;\;\;y \cdot t\\
\mathbf{elif}\;y \leq 1.15 \cdot 10^{-99}:\\
\;\;\;\;x\\
\mathbf{else}:\\
\;\;\;\;y \cdot t\\
\end{array}
\end{array}
if y < -9.50000000000000029e-24 or 1.1499999999999999e-99 < y Initial program 99.9%
Taylor expanded in t around inf 56.3%
Taylor expanded in y around inf 40.4%
if -9.50000000000000029e-24 < y < 1.1499999999999999e-99Initial program 100.0%
Taylor expanded in t around inf 72.9%
Taylor expanded in x around inf 36.7%
Final simplification38.9%
(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 62.9%
Taylor expanded in x around inf 17.0%
Final simplification17.0%
(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 2023268
(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))))