
(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
(let* ((t_1 (* y (- t x))) (t_2 (+ x (* (- y z) t))))
(if (<= y -5.2e+47)
t_1
(if (<= y 1.8e-212)
t_2
(if (<= y 4.7e-147) (+ x (* x z)) (if (<= y 2.5e+38) t_2 t_1))))))
double code(double x, double y, double z, double t) {
double t_1 = y * (t - x);
double t_2 = x + ((y - z) * t);
double tmp;
if (y <= -5.2e+47) {
tmp = t_1;
} else if (y <= 1.8e-212) {
tmp = t_2;
} else if (y <= 4.7e-147) {
tmp = x + (x * z);
} else if (y <= 2.5e+38) {
tmp = t_2;
} else {
tmp = t_1;
}
return tmp;
}
real(8) function code(x, y, z, t)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
real(8) :: t_1
real(8) :: t_2
real(8) :: tmp
t_1 = y * (t - x)
t_2 = x + ((y - z) * t)
if (y <= (-5.2d+47)) then
tmp = t_1
else if (y <= 1.8d-212) then
tmp = t_2
else if (y <= 4.7d-147) then
tmp = x + (x * z)
else if (y <= 2.5d+38) then
tmp = t_2
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 = y * (t - x);
double t_2 = x + ((y - z) * t);
double tmp;
if (y <= -5.2e+47) {
tmp = t_1;
} else if (y <= 1.8e-212) {
tmp = t_2;
} else if (y <= 4.7e-147) {
tmp = x + (x * z);
} else if (y <= 2.5e+38) {
tmp = t_2;
} else {
tmp = t_1;
}
return tmp;
}
def code(x, y, z, t): t_1 = y * (t - x) t_2 = x + ((y - z) * t) tmp = 0 if y <= -5.2e+47: tmp = t_1 elif y <= 1.8e-212: tmp = t_2 elif y <= 4.7e-147: tmp = x + (x * z) elif y <= 2.5e+38: tmp = t_2 else: tmp = t_1 return tmp
function code(x, y, z, t) t_1 = Float64(y * Float64(t - x)) t_2 = Float64(x + Float64(Float64(y - z) * t)) tmp = 0.0 if (y <= -5.2e+47) tmp = t_1; elseif (y <= 1.8e-212) tmp = t_2; elseif (y <= 4.7e-147) tmp = Float64(x + Float64(x * z)); elseif (y <= 2.5e+38) tmp = t_2; else tmp = t_1; end return tmp end
function tmp_2 = code(x, y, z, t) t_1 = y * (t - x); t_2 = x + ((y - z) * t); tmp = 0.0; if (y <= -5.2e+47) tmp = t_1; elseif (y <= 1.8e-212) tmp = t_2; elseif (y <= 4.7e-147) tmp = x + (x * z); elseif (y <= 2.5e+38) tmp = t_2; else tmp = t_1; end tmp_2 = tmp; end
code[x_, y_, z_, t_] := Block[{t$95$1 = N[(y * N[(t - x), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$2 = N[(x + N[(N[(y - z), $MachinePrecision] * t), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[y, -5.2e+47], t$95$1, If[LessEqual[y, 1.8e-212], t$95$2, If[LessEqual[y, 4.7e-147], N[(x + N[(x * z), $MachinePrecision]), $MachinePrecision], If[LessEqual[y, 2.5e+38], t$95$2, t$95$1]]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := y \cdot \left(t - x\right)\\
t_2 := x + \left(y - z\right) \cdot t\\
\mathbf{if}\;y \leq -5.2 \cdot 10^{+47}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;y \leq 1.8 \cdot 10^{-212}:\\
\;\;\;\;t\_2\\
\mathbf{elif}\;y \leq 4.7 \cdot 10^{-147}:\\
\;\;\;\;x + x \cdot z\\
\mathbf{elif}\;y \leq 2.5 \cdot 10^{+38}:\\
\;\;\;\;t\_2\\
\mathbf{else}:\\
\;\;\;\;t\_1\\
\end{array}
\end{array}
if y < -5.20000000000000007e47 or 2.49999999999999985e38 < y Initial program 99.9%
Taylor expanded in y around inf 84.7%
*-commutative84.7%
Simplified84.7%
Taylor expanded in y around inf 84.7%
if -5.20000000000000007e47 < y < 1.8e-212 or 4.69999999999999989e-147 < y < 2.49999999999999985e38Initial program 100.0%
Taylor expanded in t around inf 77.5%
if 1.8e-212 < y < 4.69999999999999989e-147Initial program 100.0%
Taylor expanded in y around 0 93.1%
mul-1-neg93.1%
distribute-rgt-neg-in93.1%
sub-neg93.1%
+-commutative93.1%
distribute-neg-in93.1%
remove-double-neg93.1%
sub-neg93.1%
Simplified93.1%
Taylor expanded in t around 0 86.2%
Final simplification81.0%
(FPCore (x y z t)
:precision binary64
(let* ((t_1 (* y (- t x))) (t_2 (- x (* z t))))
(if (<= y -5e-18)
t_1
(if (<= y 2.25e-212)
t_2
(if (<= y 3e-146) (+ x (* x z)) (if (<= y 1.3e-8) t_2 t_1))))))
double code(double x, double y, double z, double t) {
double t_1 = y * (t - x);
double t_2 = x - (z * t);
double tmp;
if (y <= -5e-18) {
tmp = t_1;
} else if (y <= 2.25e-212) {
tmp = t_2;
} else if (y <= 3e-146) {
tmp = x + (x * z);
} else if (y <= 1.3e-8) {
tmp = t_2;
} else {
tmp = t_1;
}
return tmp;
}
real(8) function code(x, y, z, t)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
real(8) :: t_1
real(8) :: t_2
real(8) :: tmp
t_1 = y * (t - x)
t_2 = x - (z * t)
if (y <= (-5d-18)) then
tmp = t_1
else if (y <= 2.25d-212) then
tmp = t_2
else if (y <= 3d-146) then
tmp = x + (x * z)
else if (y <= 1.3d-8) then
tmp = t_2
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 = y * (t - x);
double t_2 = x - (z * t);
double tmp;
if (y <= -5e-18) {
tmp = t_1;
} else if (y <= 2.25e-212) {
tmp = t_2;
} else if (y <= 3e-146) {
tmp = x + (x * z);
} else if (y <= 1.3e-8) {
tmp = t_2;
} else {
tmp = t_1;
}
return tmp;
}
def code(x, y, z, t): t_1 = y * (t - x) t_2 = x - (z * t) tmp = 0 if y <= -5e-18: tmp = t_1 elif y <= 2.25e-212: tmp = t_2 elif y <= 3e-146: tmp = x + (x * z) elif y <= 1.3e-8: tmp = t_2 else: tmp = t_1 return tmp
function code(x, y, z, t) t_1 = Float64(y * Float64(t - x)) t_2 = Float64(x - Float64(z * t)) tmp = 0.0 if (y <= -5e-18) tmp = t_1; elseif (y <= 2.25e-212) tmp = t_2; elseif (y <= 3e-146) tmp = Float64(x + Float64(x * z)); elseif (y <= 1.3e-8) tmp = t_2; else tmp = t_1; end return tmp end
function tmp_2 = code(x, y, z, t) t_1 = y * (t - x); t_2 = x - (z * t); tmp = 0.0; if (y <= -5e-18) tmp = t_1; elseif (y <= 2.25e-212) tmp = t_2; elseif (y <= 3e-146) tmp = x + (x * z); elseif (y <= 1.3e-8) tmp = t_2; else tmp = t_1; end tmp_2 = tmp; end
code[x_, y_, z_, t_] := Block[{t$95$1 = N[(y * N[(t - x), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$2 = N[(x - N[(z * t), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[y, -5e-18], t$95$1, If[LessEqual[y, 2.25e-212], t$95$2, If[LessEqual[y, 3e-146], N[(x + N[(x * z), $MachinePrecision]), $MachinePrecision], If[LessEqual[y, 1.3e-8], t$95$2, t$95$1]]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := y \cdot \left(t - x\right)\\
t_2 := x - z \cdot t\\
\mathbf{if}\;y \leq -5 \cdot 10^{-18}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;y \leq 2.25 \cdot 10^{-212}:\\
\;\;\;\;t\_2\\
\mathbf{elif}\;y \leq 3 \cdot 10^{-146}:\\
\;\;\;\;x + x \cdot z\\
\mathbf{elif}\;y \leq 1.3 \cdot 10^{-8}:\\
\;\;\;\;t\_2\\
\mathbf{else}:\\
\;\;\;\;t\_1\\
\end{array}
\end{array}
if y < -5.00000000000000036e-18 or 1.3000000000000001e-8 < y Initial program 99.9%
Taylor expanded in y around inf 77.5%
*-commutative77.5%
Simplified77.5%
Taylor expanded in y around inf 75.7%
if -5.00000000000000036e-18 < y < 2.2499999999999999e-212 or 3.00000000000000019e-146 < y < 1.3000000000000001e-8Initial program 100.0%
Taylor expanded in y around 0 93.3%
mul-1-neg93.3%
distribute-rgt-neg-in93.3%
sub-neg93.3%
+-commutative93.3%
distribute-neg-in93.3%
remove-double-neg93.3%
sub-neg93.3%
Simplified93.3%
sub-neg93.3%
distribute-lft-in90.5%
Applied egg-rr90.5%
Taylor expanded in x around 0 70.6%
associate-*r*70.6%
mul-1-neg70.6%
Simplified70.6%
if 2.2499999999999999e-212 < y < 3.00000000000000019e-146Initial program 100.0%
Taylor expanded in y around 0 93.1%
mul-1-neg93.1%
distribute-rgt-neg-in93.1%
sub-neg93.1%
+-commutative93.1%
distribute-neg-in93.1%
remove-double-neg93.1%
sub-neg93.1%
Simplified93.1%
Taylor expanded in t around 0 86.2%
Final simplification74.2%
(FPCore (x y z t)
:precision binary64
(let* ((t_1 (* y (- t x))))
(if (<= y -5.5e+47)
t_1
(if (<= y -3.7e-20)
(+ x (* (- y z) t))
(if (<= y 2.25e+69) (+ x (* z (- x t))) t_1)))))
double code(double x, double y, double z, double t) {
double t_1 = y * (t - x);
double tmp;
if (y <= -5.5e+47) {
tmp = t_1;
} else if (y <= -3.7e-20) {
tmp = x + ((y - z) * t);
} else if (y <= 2.25e+69) {
tmp = x + (z * (x - 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 = y * (t - x)
if (y <= (-5.5d+47)) then
tmp = t_1
else if (y <= (-3.7d-20)) then
tmp = x + ((y - z) * t)
else if (y <= 2.25d+69) then
tmp = x + (z * (x - 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 = y * (t - x);
double tmp;
if (y <= -5.5e+47) {
tmp = t_1;
} else if (y <= -3.7e-20) {
tmp = x + ((y - z) * t);
} else if (y <= 2.25e+69) {
tmp = x + (z * (x - t));
} else {
tmp = t_1;
}
return tmp;
}
def code(x, y, z, t): t_1 = y * (t - x) tmp = 0 if y <= -5.5e+47: tmp = t_1 elif y <= -3.7e-20: tmp = x + ((y - z) * t) elif y <= 2.25e+69: tmp = x + (z * (x - t)) else: tmp = t_1 return tmp
function code(x, y, z, t) t_1 = Float64(y * Float64(t - x)) tmp = 0.0 if (y <= -5.5e+47) tmp = t_1; elseif (y <= -3.7e-20) tmp = Float64(x + Float64(Float64(y - z) * t)); elseif (y <= 2.25e+69) tmp = Float64(x + Float64(z * Float64(x - t))); else tmp = t_1; end return tmp end
function tmp_2 = code(x, y, z, t) t_1 = y * (t - x); tmp = 0.0; if (y <= -5.5e+47) tmp = t_1; elseif (y <= -3.7e-20) tmp = x + ((y - z) * t); elseif (y <= 2.25e+69) tmp = x + (z * (x - t)); else tmp = t_1; end tmp_2 = tmp; end
code[x_, y_, z_, t_] := Block[{t$95$1 = N[(y * N[(t - x), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[y, -5.5e+47], t$95$1, If[LessEqual[y, -3.7e-20], N[(x + N[(N[(y - z), $MachinePrecision] * t), $MachinePrecision]), $MachinePrecision], If[LessEqual[y, 2.25e+69], N[(x + N[(z * N[(x - t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], t$95$1]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := y \cdot \left(t - x\right)\\
\mathbf{if}\;y \leq -5.5 \cdot 10^{+47}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;y \leq -3.7 \cdot 10^{-20}:\\
\;\;\;\;x + \left(y - z\right) \cdot t\\
\mathbf{elif}\;y \leq 2.25 \cdot 10^{+69}:\\
\;\;\;\;x + z \cdot \left(x - t\right)\\
\mathbf{else}:\\
\;\;\;\;t\_1\\
\end{array}
\end{array}
if y < -5.4999999999999998e47 or 2.25e69 < y Initial program 99.9%
Taylor expanded in y around inf 86.2%
*-commutative86.2%
Simplified86.2%
Taylor expanded in y around inf 86.2%
if -5.4999999999999998e47 < y < -3.7000000000000001e-20Initial program 99.9%
Taylor expanded in t around inf 83.9%
if -3.7000000000000001e-20 < y < 2.25e69Initial program 100.0%
Taylor expanded in y around 0 88.4%
mul-1-neg88.4%
distribute-rgt-neg-in88.4%
sub-neg88.4%
+-commutative88.4%
distribute-neg-in88.4%
remove-double-neg88.4%
sub-neg88.4%
Simplified88.4%
Final simplification87.2%
(FPCore (x y z t)
:precision binary64
(let* ((t_1 (* y (- t x))))
(if (<= y -5.8e+47)
t_1
(if (<= y -3.5e-20)
(+ x (* (- y z) t))
(if (<= y 1.8e-8) (+ x (* z (- x t))) (+ x t_1))))))
double code(double x, double y, double z, double t) {
double t_1 = y * (t - x);
double tmp;
if (y <= -5.8e+47) {
tmp = t_1;
} else if (y <= -3.5e-20) {
tmp = x + ((y - z) * t);
} else if (y <= 1.8e-8) {
tmp = x + (z * (x - t));
} else {
tmp = x + t_1;
}
return tmp;
}
real(8) function code(x, y, z, t)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
real(8) :: t_1
real(8) :: tmp
t_1 = y * (t - x)
if (y <= (-5.8d+47)) then
tmp = t_1
else if (y <= (-3.5d-20)) then
tmp = x + ((y - z) * t)
else if (y <= 1.8d-8) then
tmp = x + (z * (x - t))
else
tmp = x + t_1
end if
code = tmp
end function
public static double code(double x, double y, double z, double t) {
double t_1 = y * (t - x);
double tmp;
if (y <= -5.8e+47) {
tmp = t_1;
} else if (y <= -3.5e-20) {
tmp = x + ((y - z) * t);
} else if (y <= 1.8e-8) {
tmp = x + (z * (x - t));
} else {
tmp = x + t_1;
}
return tmp;
}
def code(x, y, z, t): t_1 = y * (t - x) tmp = 0 if y <= -5.8e+47: tmp = t_1 elif y <= -3.5e-20: tmp = x + ((y - z) * t) elif y <= 1.8e-8: tmp = x + (z * (x - t)) else: tmp = x + t_1 return tmp
function code(x, y, z, t) t_1 = Float64(y * Float64(t - x)) tmp = 0.0 if (y <= -5.8e+47) tmp = t_1; elseif (y <= -3.5e-20) tmp = Float64(x + Float64(Float64(y - z) * t)); elseif (y <= 1.8e-8) tmp = Float64(x + Float64(z * Float64(x - t))); else tmp = Float64(x + t_1); end return tmp end
function tmp_2 = code(x, y, z, t) t_1 = y * (t - x); tmp = 0.0; if (y <= -5.8e+47) tmp = t_1; elseif (y <= -3.5e-20) tmp = x + ((y - z) * t); elseif (y <= 1.8e-8) tmp = x + (z * (x - t)); else tmp = x + t_1; end tmp_2 = tmp; end
code[x_, y_, z_, t_] := Block[{t$95$1 = N[(y * N[(t - x), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[y, -5.8e+47], t$95$1, If[LessEqual[y, -3.5e-20], N[(x + N[(N[(y - z), $MachinePrecision] * t), $MachinePrecision]), $MachinePrecision], If[LessEqual[y, 1.8e-8], N[(x + N[(z * N[(x - t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(x + t$95$1), $MachinePrecision]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := y \cdot \left(t - x\right)\\
\mathbf{if}\;y \leq -5.8 \cdot 10^{+47}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;y \leq -3.5 \cdot 10^{-20}:\\
\;\;\;\;x + \left(y - z\right) \cdot t\\
\mathbf{elif}\;y \leq 1.8 \cdot 10^{-8}:\\
\;\;\;\;x + z \cdot \left(x - t\right)\\
\mathbf{else}:\\
\;\;\;\;x + t\_1\\
\end{array}
\end{array}
if y < -5.79999999999999961e47Initial program 99.9%
Taylor expanded in y around inf 88.1%
*-commutative88.1%
Simplified88.1%
Taylor expanded in y around inf 88.1%
if -5.79999999999999961e47 < y < -3.50000000000000003e-20Initial program 99.9%
Taylor expanded in t around inf 83.9%
if -3.50000000000000003e-20 < y < 1.79999999999999991e-8Initial program 100.0%
Taylor expanded in y around 0 93.3%
mul-1-neg93.3%
distribute-rgt-neg-in93.3%
sub-neg93.3%
+-commutative93.3%
distribute-neg-in93.3%
remove-double-neg93.3%
sub-neg93.3%
Simplified93.3%
if 1.79999999999999991e-8 < y Initial program 100.0%
Taylor expanded in y around inf 77.2%
*-commutative77.2%
Simplified77.2%
Final simplification87.2%
(FPCore (x y z t) :precision binary64 (if (or (<= x -6.4e+56) (not (<= x 4.2e-9))) (+ x (* x (- z y))) (+ x (* (- y z) t))))
double code(double x, double y, double z, double t) {
double tmp;
if ((x <= -6.4e+56) || !(x <= 4.2e-9)) {
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 <= (-6.4d+56)) .or. (.not. (x <= 4.2d-9))) 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 <= -6.4e+56) || !(x <= 4.2e-9)) {
tmp = x + (x * (z - y));
} else {
tmp = x + ((y - z) * t);
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if (x <= -6.4e+56) or not (x <= 4.2e-9): tmp = x + (x * (z - y)) else: tmp = x + ((y - z) * t) return tmp
function code(x, y, z, t) tmp = 0.0 if ((x <= -6.4e+56) || !(x <= 4.2e-9)) 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 <= -6.4e+56) || ~((x <= 4.2e-9))) 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, -6.4e+56], N[Not[LessEqual[x, 4.2e-9]], $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 -6.4 \cdot 10^{+56} \lor \neg \left(x \leq 4.2 \cdot 10^{-9}\right):\\
\;\;\;\;x + x \cdot \left(z - y\right)\\
\mathbf{else}:\\
\;\;\;\;x + \left(y - z\right) \cdot t\\
\end{array}
\end{array}
if x < -6.40000000000000007e56 or 4.20000000000000039e-9 < x Initial program 100.0%
Taylor expanded in t around 0 88.2%
mul-1-neg88.2%
distribute-rgt-neg-in88.2%
sub-neg88.2%
+-commutative88.2%
distribute-neg-in88.2%
remove-double-neg88.2%
sub-neg88.2%
Simplified88.2%
if -6.40000000000000007e56 < x < 4.20000000000000039e-9Initial program 100.0%
Taylor expanded in t around inf 81.5%
Final simplification84.6%
(FPCore (x y z t) :precision binary64 (if (or (<= y -4.5e-26) (not (<= y 3.9e-32))) (* y (- t x)) (* x z)))
double code(double x, double y, double z, double t) {
double tmp;
if ((y <= -4.5e-26) || !(y <= 3.9e-32)) {
tmp = y * (t - 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 ((y <= (-4.5d-26)) .or. (.not. (y <= 3.9d-32))) then
tmp = y * (t - 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 ((y <= -4.5e-26) || !(y <= 3.9e-32)) {
tmp = y * (t - x);
} else {
tmp = x * z;
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if (y <= -4.5e-26) or not (y <= 3.9e-32): tmp = y * (t - x) else: tmp = x * z return tmp
function code(x, y, z, t) tmp = 0.0 if ((y <= -4.5e-26) || !(y <= 3.9e-32)) tmp = Float64(y * Float64(t - x)); else tmp = Float64(x * z); end return tmp end
function tmp_2 = code(x, y, z, t) tmp = 0.0; if ((y <= -4.5e-26) || ~((y <= 3.9e-32))) tmp = y * (t - x); else tmp = x * z; end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[Or[LessEqual[y, -4.5e-26], N[Not[LessEqual[y, 3.9e-32]], $MachinePrecision]], N[(y * N[(t - x), $MachinePrecision]), $MachinePrecision], N[(x * z), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;y \leq -4.5 \cdot 10^{-26} \lor \neg \left(y \leq 3.9 \cdot 10^{-32}\right):\\
\;\;\;\;y \cdot \left(t - x\right)\\
\mathbf{else}:\\
\;\;\;\;x \cdot z\\
\end{array}
\end{array}
if y < -4.4999999999999999e-26 or 3.9000000000000001e-32 < y Initial program 99.9%
Taylor expanded in y around inf 76.6%
*-commutative76.6%
Simplified76.6%
Taylor expanded in y around inf 74.2%
if -4.4999999999999999e-26 < y < 3.9000000000000001e-32Initial program 100.0%
Taylor expanded in y around 0 93.5%
mul-1-neg93.5%
distribute-rgt-neg-in93.5%
sub-neg93.5%
+-commutative93.5%
distribute-neg-in93.5%
remove-double-neg93.5%
sub-neg93.5%
Simplified93.5%
Taylor expanded in t around 0 55.9%
Taylor expanded in z around inf 29.7%
*-commutative29.7%
Simplified29.7%
Final simplification54.1%
(FPCore (x y z t) :precision binary64 (if (or (<= y -4.8e-22) (not (<= y 1.5e-31))) (* y (- t x)) (+ x (* x z))))
double code(double x, double y, double z, double t) {
double tmp;
if ((y <= -4.8e-22) || !(y <= 1.5e-31)) {
tmp = y * (t - x);
} 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 ((y <= (-4.8d-22)) .or. (.not. (y <= 1.5d-31))) then
tmp = y * (t - x)
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 ((y <= -4.8e-22) || !(y <= 1.5e-31)) {
tmp = y * (t - x);
} else {
tmp = x + (x * z);
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if (y <= -4.8e-22) or not (y <= 1.5e-31): tmp = y * (t - x) else: tmp = x + (x * z) return tmp
function code(x, y, z, t) tmp = 0.0 if ((y <= -4.8e-22) || !(y <= 1.5e-31)) tmp = Float64(y * Float64(t - x)); else tmp = Float64(x + Float64(x * z)); end return tmp end
function tmp_2 = code(x, y, z, t) tmp = 0.0; if ((y <= -4.8e-22) || ~((y <= 1.5e-31))) tmp = y * (t - x); else tmp = x + (x * z); end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[Or[LessEqual[y, -4.8e-22], N[Not[LessEqual[y, 1.5e-31]], $MachinePrecision]], N[(y * N[(t - x), $MachinePrecision]), $MachinePrecision], N[(x + N[(x * z), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;y \leq -4.8 \cdot 10^{-22} \lor \neg \left(y \leq 1.5 \cdot 10^{-31}\right):\\
\;\;\;\;y \cdot \left(t - x\right)\\
\mathbf{else}:\\
\;\;\;\;x + x \cdot z\\
\end{array}
\end{array}
if y < -4.80000000000000005e-22 or 1.49999999999999991e-31 < y Initial program 99.9%
Taylor expanded in y around inf 76.5%
*-commutative76.5%
Simplified76.5%
Taylor expanded in y around inf 74.7%
if -4.80000000000000005e-22 < y < 1.49999999999999991e-31Initial program 100.0%
Taylor expanded in y around 0 93.5%
mul-1-neg93.5%
distribute-rgt-neg-in93.5%
sub-neg93.5%
+-commutative93.5%
distribute-neg-in93.5%
remove-double-neg93.5%
sub-neg93.5%
Simplified93.5%
Taylor expanded in t around 0 56.3%
Final simplification66.3%
(FPCore (x y z t) :precision binary64 (if (or (<= y -1.95e+47) (not (<= y 1.95e+73))) (* x (- y)) (* x z)))
double code(double x, double y, double z, double t) {
double tmp;
if ((y <= -1.95e+47) || !(y <= 1.95e+73)) {
tmp = x * -y;
} 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 ((y <= (-1.95d+47)) .or. (.not. (y <= 1.95d+73))) then
tmp = x * -y
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 ((y <= -1.95e+47) || !(y <= 1.95e+73)) {
tmp = x * -y;
} else {
tmp = x * z;
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if (y <= -1.95e+47) or not (y <= 1.95e+73): tmp = x * -y else: tmp = x * z return tmp
function code(x, y, z, t) tmp = 0.0 if ((y <= -1.95e+47) || !(y <= 1.95e+73)) tmp = Float64(x * Float64(-y)); else tmp = Float64(x * z); end return tmp end
function tmp_2 = code(x, y, z, t) tmp = 0.0; if ((y <= -1.95e+47) || ~((y <= 1.95e+73))) tmp = x * -y; else tmp = x * z; end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[Or[LessEqual[y, -1.95e+47], N[Not[LessEqual[y, 1.95e+73]], $MachinePrecision]], N[(x * (-y)), $MachinePrecision], N[(x * z), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;y \leq -1.95 \cdot 10^{+47} \lor \neg \left(y \leq 1.95 \cdot 10^{+73}\right):\\
\;\;\;\;x \cdot \left(-y\right)\\
\mathbf{else}:\\
\;\;\;\;x \cdot z\\
\end{array}
\end{array}
if y < -1.95000000000000013e47 or 1.95e73 < y Initial program 99.9%
Taylor expanded in t around 0 61.4%
mul-1-neg61.4%
distribute-rgt-neg-in61.4%
sub-neg61.4%
+-commutative61.4%
distribute-neg-in61.4%
remove-double-neg61.4%
sub-neg61.4%
Simplified61.4%
Taylor expanded in z around 0 56.1%
mul-1-neg56.1%
distribute-rgt-neg-out56.1%
Simplified56.1%
Taylor expanded in y around inf 56.1%
associate-*r*56.1%
mul-1-neg56.1%
Simplified56.1%
if -1.95000000000000013e47 < y < 1.95e73Initial program 100.0%
Taylor expanded in y around 0 83.5%
mul-1-neg83.5%
distribute-rgt-neg-in83.5%
sub-neg83.5%
+-commutative83.5%
distribute-neg-in83.5%
remove-double-neg83.5%
sub-neg83.5%
Simplified83.5%
Taylor expanded in t around 0 48.5%
Taylor expanded in z around inf 27.4%
*-commutative27.4%
Simplified27.4%
Final simplification38.9%
(FPCore (x y z t) :precision binary64 (if (or (<= z -1.0) (not (<= z 8.6e-5))) (* x z) x))
double code(double x, double y, double z, double t) {
double tmp;
if ((z <= -1.0) || !(z <= 8.6e-5)) {
tmp = x * z;
} 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 ((z <= (-1.0d0)) .or. (.not. (z <= 8.6d-5))) then
tmp = x * z
else
tmp = x
end if
code = tmp
end function
public static double code(double x, double y, double z, double t) {
double tmp;
if ((z <= -1.0) || !(z <= 8.6e-5)) {
tmp = x * z;
} else {
tmp = x;
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if (z <= -1.0) or not (z <= 8.6e-5): tmp = x * z else: tmp = x return tmp
function code(x, y, z, t) tmp = 0.0 if ((z <= -1.0) || !(z <= 8.6e-5)) tmp = Float64(x * z); else tmp = x; end return tmp end
function tmp_2 = code(x, y, z, t) tmp = 0.0; if ((z <= -1.0) || ~((z <= 8.6e-5))) tmp = x * z; else tmp = x; end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[Or[LessEqual[z, -1.0], N[Not[LessEqual[z, 8.6e-5]], $MachinePrecision]], N[(x * z), $MachinePrecision], x]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \leq -1 \lor \neg \left(z \leq 8.6 \cdot 10^{-5}\right):\\
\;\;\;\;x \cdot z\\
\mathbf{else}:\\
\;\;\;\;x\\
\end{array}
\end{array}
if z < -1 or 8.6000000000000003e-5 < z Initial program 100.0%
Taylor expanded in y around 0 78.6%
mul-1-neg78.6%
distribute-rgt-neg-in78.6%
sub-neg78.6%
+-commutative78.6%
distribute-neg-in78.6%
remove-double-neg78.6%
sub-neg78.6%
Simplified78.6%
Taylor expanded in t around 0 40.5%
Taylor expanded in z around inf 39.6%
*-commutative39.6%
Simplified39.6%
if -1 < z < 8.6000000000000003e-5Initial program 100.0%
Taylor expanded in y around 0 40.2%
mul-1-neg40.2%
distribute-rgt-neg-in40.2%
sub-neg40.2%
+-commutative40.2%
distribute-neg-in40.2%
remove-double-neg40.2%
sub-neg40.2%
Simplified40.2%
Taylor expanded in z around 0 28.8%
Final simplification34.7%
(FPCore (x y z t) :precision binary64 x)
double code(double x, double y, double z, double t) {
return x;
}
real(8) function code(x, y, z, t)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
code = x
end function
public static double code(double x, double y, double z, double t) {
return x;
}
def code(x, y, z, t): return x
function code(x, y, z, t) return x end
function tmp = code(x, y, z, t) tmp = x; end
code[x_, y_, z_, t_] := x
\begin{array}{l}
\\
x
\end{array}
Initial program 100.0%
Taylor expanded in y around 0 61.1%
mul-1-neg61.1%
distribute-rgt-neg-in61.1%
sub-neg61.1%
+-commutative61.1%
distribute-neg-in61.1%
remove-double-neg61.1%
sub-neg61.1%
Simplified61.1%
Taylor expanded in z around 0 14.7%
Final simplification14.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 2024079
(FPCore (x y z t)
:name "Data.Metrics.Snapshot:quantile from metrics-0.3.0.2"
:precision binary64
:alt
(+ x (+ (* t (- y z)) (* (- x) (- y z))))
(+ x (* (- y z) (- t x))))