
(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 (* (- t x) (- y z))))
double code(double x, double y, double z, double t) {
return x + ((t - 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 - x) * (y - z))
end function
public static double code(double x, double y, double z, double t) {
return x + ((t - x) * (y - z));
}
def code(x, y, z, t): return x + ((t - x) * (y - z))
function code(x, y, z, t) return Float64(x + Float64(Float64(t - x) * Float64(y - z))) end
function tmp = code(x, y, z, t) tmp = x + ((t - x) * (y - z)); end
code[x_, y_, z_, t_] := N[(x + N[(N[(t - x), $MachinePrecision] * N[(y - z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
x + \left(t - x\right) \cdot \left(y - z\right)
\end{array}
Initial program 100.0%
Final simplification100.0%
(FPCore (x y z t)
:precision binary64
(let* ((t_1 (* t (- z))))
(if (<= z -2.8e+273)
(* x z)
(if (<= z -2300000.0)
t_1
(if (<= z 470000.0)
(+ x (* y t))
(if (or (<= z 2.3e+146) (not (<= z 6.6e+180))) t_1 (* x z)))))))
double code(double x, double y, double z, double t) {
double t_1 = t * -z;
double tmp;
if (z <= -2.8e+273) {
tmp = x * z;
} else if (z <= -2300000.0) {
tmp = t_1;
} else if (z <= 470000.0) {
tmp = x + (y * t);
} else if ((z <= 2.3e+146) || !(z <= 6.6e+180)) {
tmp = t_1;
} 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) :: t_1
real(8) :: tmp
t_1 = t * -z
if (z <= (-2.8d+273)) then
tmp = x * z
else if (z <= (-2300000.0d0)) then
tmp = t_1
else if (z <= 470000.0d0) then
tmp = x + (y * t)
else if ((z <= 2.3d+146) .or. (.not. (z <= 6.6d+180))) then
tmp = t_1
else
tmp = x * z
end if
code = tmp
end function
public static double code(double x, double y, double z, double t) {
double t_1 = t * -z;
double tmp;
if (z <= -2.8e+273) {
tmp = x * z;
} else if (z <= -2300000.0) {
tmp = t_1;
} else if (z <= 470000.0) {
tmp = x + (y * t);
} else if ((z <= 2.3e+146) || !(z <= 6.6e+180)) {
tmp = t_1;
} else {
tmp = x * z;
}
return tmp;
}
def code(x, y, z, t): t_1 = t * -z tmp = 0 if z <= -2.8e+273: tmp = x * z elif z <= -2300000.0: tmp = t_1 elif z <= 470000.0: tmp = x + (y * t) elif (z <= 2.3e+146) or not (z <= 6.6e+180): tmp = t_1 else: tmp = x * z return tmp
function code(x, y, z, t) t_1 = Float64(t * Float64(-z)) tmp = 0.0 if (z <= -2.8e+273) tmp = Float64(x * z); elseif (z <= -2300000.0) tmp = t_1; elseif (z <= 470000.0) tmp = Float64(x + Float64(y * t)); elseif ((z <= 2.3e+146) || !(z <= 6.6e+180)) tmp = t_1; else tmp = Float64(x * z); end return tmp end
function tmp_2 = code(x, y, z, t) t_1 = t * -z; tmp = 0.0; if (z <= -2.8e+273) tmp = x * z; elseif (z <= -2300000.0) tmp = t_1; elseif (z <= 470000.0) tmp = x + (y * t); elseif ((z <= 2.3e+146) || ~((z <= 6.6e+180))) tmp = t_1; else tmp = x * z; end tmp_2 = tmp; end
code[x_, y_, z_, t_] := Block[{t$95$1 = N[(t * (-z)), $MachinePrecision]}, If[LessEqual[z, -2.8e+273], N[(x * z), $MachinePrecision], If[LessEqual[z, -2300000.0], t$95$1, If[LessEqual[z, 470000.0], N[(x + N[(y * t), $MachinePrecision]), $MachinePrecision], If[Or[LessEqual[z, 2.3e+146], N[Not[LessEqual[z, 6.6e+180]], $MachinePrecision]], t$95$1, N[(x * z), $MachinePrecision]]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := t \cdot \left(-z\right)\\
\mathbf{if}\;z \leq -2.8 \cdot 10^{+273}:\\
\;\;\;\;x \cdot z\\
\mathbf{elif}\;z \leq -2300000:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;z \leq 470000:\\
\;\;\;\;x + y \cdot t\\
\mathbf{elif}\;z \leq 2.3 \cdot 10^{+146} \lor \neg \left(z \leq 6.6 \cdot 10^{+180}\right):\\
\;\;\;\;t\_1\\
\mathbf{else}:\\
\;\;\;\;x \cdot z\\
\end{array}
\end{array}
if z < -2.80000000000000018e273 or 2.3e146 < z < 6.59999999999999978e180Initial program 100.0%
Taylor expanded in t around 0 89.5%
mul-1-neg89.5%
distribute-rgt-neg-in89.5%
sub-neg89.5%
+-commutative89.5%
distribute-neg-in89.5%
remove-double-neg89.5%
sub-neg89.5%
Simplified89.5%
Taylor expanded in z around inf 88.6%
*-commutative88.6%
Simplified88.6%
Taylor expanded in z around inf 88.6%
*-commutative88.6%
Simplified88.6%
if -2.80000000000000018e273 < z < -2.3e6 or 4.7e5 < z < 2.3e146 or 6.59999999999999978e180 < z Initial program 100.0%
Taylor expanded in t around inf 63.7%
Taylor expanded in y around 0 52.2%
mul-1-neg52.2%
unsub-neg52.2%
*-commutative52.2%
Simplified52.2%
Taylor expanded in x around 0 51.7%
associate-*r*51.7%
neg-mul-151.7%
*-commutative51.7%
Simplified51.7%
if -2.3e6 < z < 4.7e5Initial program 100.0%
Taylor expanded in t around inf 71.5%
Taylor expanded in y around inf 66.9%
*-commutative66.9%
Simplified66.9%
Final simplification61.6%
(FPCore (x y z t)
:precision binary64
(let* ((t_1 (* t (- z))))
(if (<= z -4.8e+273)
(* x z)
(if (<= z -6.5e-15)
t_1
(if (<= z 92.0)
x
(if (or (<= z 3.6e+150) (not (<= z 1.05e+179))) t_1 (* x z)))))))
double code(double x, double y, double z, double t) {
double t_1 = t * -z;
double tmp;
if (z <= -4.8e+273) {
tmp = x * z;
} else if (z <= -6.5e-15) {
tmp = t_1;
} else if (z <= 92.0) {
tmp = x;
} else if ((z <= 3.6e+150) || !(z <= 1.05e+179)) {
tmp = t_1;
} 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) :: t_1
real(8) :: tmp
t_1 = t * -z
if (z <= (-4.8d+273)) then
tmp = x * z
else if (z <= (-6.5d-15)) then
tmp = t_1
else if (z <= 92.0d0) then
tmp = x
else if ((z <= 3.6d+150) .or. (.not. (z <= 1.05d+179))) then
tmp = t_1
else
tmp = x * z
end if
code = tmp
end function
public static double code(double x, double y, double z, double t) {
double t_1 = t * -z;
double tmp;
if (z <= -4.8e+273) {
tmp = x * z;
} else if (z <= -6.5e-15) {
tmp = t_1;
} else if (z <= 92.0) {
tmp = x;
} else if ((z <= 3.6e+150) || !(z <= 1.05e+179)) {
tmp = t_1;
} else {
tmp = x * z;
}
return tmp;
}
def code(x, y, z, t): t_1 = t * -z tmp = 0 if z <= -4.8e+273: tmp = x * z elif z <= -6.5e-15: tmp = t_1 elif z <= 92.0: tmp = x elif (z <= 3.6e+150) or not (z <= 1.05e+179): tmp = t_1 else: tmp = x * z return tmp
function code(x, y, z, t) t_1 = Float64(t * Float64(-z)) tmp = 0.0 if (z <= -4.8e+273) tmp = Float64(x * z); elseif (z <= -6.5e-15) tmp = t_1; elseif (z <= 92.0) tmp = x; elseif ((z <= 3.6e+150) || !(z <= 1.05e+179)) tmp = t_1; else tmp = Float64(x * z); end return tmp end
function tmp_2 = code(x, y, z, t) t_1 = t * -z; tmp = 0.0; if (z <= -4.8e+273) tmp = x * z; elseif (z <= -6.5e-15) tmp = t_1; elseif (z <= 92.0) tmp = x; elseif ((z <= 3.6e+150) || ~((z <= 1.05e+179))) tmp = t_1; else tmp = x * z; end tmp_2 = tmp; end
code[x_, y_, z_, t_] := Block[{t$95$1 = N[(t * (-z)), $MachinePrecision]}, If[LessEqual[z, -4.8e+273], N[(x * z), $MachinePrecision], If[LessEqual[z, -6.5e-15], t$95$1, If[LessEqual[z, 92.0], x, If[Or[LessEqual[z, 3.6e+150], N[Not[LessEqual[z, 1.05e+179]], $MachinePrecision]], t$95$1, N[(x * z), $MachinePrecision]]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := t \cdot \left(-z\right)\\
\mathbf{if}\;z \leq -4.8 \cdot 10^{+273}:\\
\;\;\;\;x \cdot z\\
\mathbf{elif}\;z \leq -6.5 \cdot 10^{-15}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;z \leq 92:\\
\;\;\;\;x\\
\mathbf{elif}\;z \leq 3.6 \cdot 10^{+150} \lor \neg \left(z \leq 1.05 \cdot 10^{+179}\right):\\
\;\;\;\;t\_1\\
\mathbf{else}:\\
\;\;\;\;x \cdot z\\
\end{array}
\end{array}
if z < -4.8000000000000003e273 or 3.59999999999999986e150 < z < 1.0499999999999999e179Initial program 100.0%
Taylor expanded in t around 0 89.5%
mul-1-neg89.5%
distribute-rgt-neg-in89.5%
sub-neg89.5%
+-commutative89.5%
distribute-neg-in89.5%
remove-double-neg89.5%
sub-neg89.5%
Simplified89.5%
Taylor expanded in z around inf 88.6%
*-commutative88.6%
Simplified88.6%
Taylor expanded in z around inf 88.6%
*-commutative88.6%
Simplified88.6%
if -4.8000000000000003e273 < z < -6.49999999999999991e-15 or 92 < z < 3.59999999999999986e150 or 1.0499999999999999e179 < z Initial program 100.0%
Taylor expanded in t around inf 63.0%
Taylor expanded in y around 0 51.3%
mul-1-neg51.3%
unsub-neg51.3%
*-commutative51.3%
Simplified51.3%
Taylor expanded in x around 0 50.2%
associate-*r*50.2%
neg-mul-150.2%
*-commutative50.2%
Simplified50.2%
if -6.49999999999999991e-15 < z < 92Initial program 100.0%
Taylor expanded in t around inf 72.7%
Taylor expanded in x around inf 30.8%
Final simplification44.0%
(FPCore (x y z t)
:precision binary64
(let* ((t_1 (- x (* z t))) (t_2 (+ x (* y t))))
(if (<= t -1e+209)
t_1
(if (<= t -1.7e+113)
t_2
(if (<= t 8.5e+42) (+ x (* x (- z y))) (if (<= t 4.25e+99) t_2 t_1))))))
double code(double x, double y, double z, double t) {
double t_1 = x - (z * t);
double t_2 = x + (y * t);
double tmp;
if (t <= -1e+209) {
tmp = t_1;
} else if (t <= -1.7e+113) {
tmp = t_2;
} else if (t <= 8.5e+42) {
tmp = x + (x * (z - y));
} else if (t <= 4.25e+99) {
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 = x - (z * t)
t_2 = x + (y * t)
if (t <= (-1d+209)) then
tmp = t_1
else if (t <= (-1.7d+113)) then
tmp = t_2
else if (t <= 8.5d+42) then
tmp = x + (x * (z - y))
else if (t <= 4.25d+99) 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 = x - (z * t);
double t_2 = x + (y * t);
double tmp;
if (t <= -1e+209) {
tmp = t_1;
} else if (t <= -1.7e+113) {
tmp = t_2;
} else if (t <= 8.5e+42) {
tmp = x + (x * (z - y));
} else if (t <= 4.25e+99) {
tmp = t_2;
} else {
tmp = t_1;
}
return tmp;
}
def code(x, y, z, t): t_1 = x - (z * t) t_2 = x + (y * t) tmp = 0 if t <= -1e+209: tmp = t_1 elif t <= -1.7e+113: tmp = t_2 elif t <= 8.5e+42: tmp = x + (x * (z - y)) elif t <= 4.25e+99: tmp = t_2 else: tmp = t_1 return tmp
function code(x, y, z, t) t_1 = Float64(x - Float64(z * t)) t_2 = Float64(x + Float64(y * t)) tmp = 0.0 if (t <= -1e+209) tmp = t_1; elseif (t <= -1.7e+113) tmp = t_2; elseif (t <= 8.5e+42) tmp = Float64(x + Float64(x * Float64(z - y))); elseif (t <= 4.25e+99) tmp = t_2; else tmp = t_1; end return tmp end
function tmp_2 = code(x, y, z, t) t_1 = x - (z * t); t_2 = x + (y * t); tmp = 0.0; if (t <= -1e+209) tmp = t_1; elseif (t <= -1.7e+113) tmp = t_2; elseif (t <= 8.5e+42) tmp = x + (x * (z - y)); elseif (t <= 4.25e+99) tmp = t_2; else tmp = t_1; end tmp_2 = tmp; end
code[x_, y_, z_, t_] := Block[{t$95$1 = N[(x - N[(z * t), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$2 = N[(x + N[(y * t), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[t, -1e+209], t$95$1, If[LessEqual[t, -1.7e+113], t$95$2, If[LessEqual[t, 8.5e+42], N[(x + N[(x * N[(z - y), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[t, 4.25e+99], t$95$2, t$95$1]]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := x - z \cdot t\\
t_2 := x + y \cdot t\\
\mathbf{if}\;t \leq -1 \cdot 10^{+209}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;t \leq -1.7 \cdot 10^{+113}:\\
\;\;\;\;t\_2\\
\mathbf{elif}\;t \leq 8.5 \cdot 10^{+42}:\\
\;\;\;\;x + x \cdot \left(z - y\right)\\
\mathbf{elif}\;t \leq 4.25 \cdot 10^{+99}:\\
\;\;\;\;t\_2\\
\mathbf{else}:\\
\;\;\;\;t\_1\\
\end{array}
\end{array}
if t < -1.0000000000000001e209 or 4.24999999999999992e99 < t Initial program 100.0%
Taylor expanded in t around inf 98.4%
Taylor expanded in y around 0 65.4%
mul-1-neg65.4%
unsub-neg65.4%
*-commutative65.4%
Simplified65.4%
if -1.0000000000000001e209 < t < -1.70000000000000009e113 or 8.5000000000000003e42 < t < 4.24999999999999992e99Initial program 100.0%
Taylor expanded in t around inf 88.4%
Taylor expanded in y around inf 64.6%
*-commutative64.6%
Simplified64.6%
if -1.70000000000000009e113 < t < 8.5000000000000003e42Initial program 100.0%
Taylor expanded in t around 0 76.0%
mul-1-neg76.0%
distribute-rgt-neg-in76.0%
sub-neg76.0%
+-commutative76.0%
distribute-neg-in76.0%
remove-double-neg76.0%
sub-neg76.0%
Simplified76.0%
(FPCore (x y z t)
:precision binary64
(let* ((t_1 (* t (- z))))
(if (<= z -1e+272)
(* x z)
(if (<= z -5.5e+92)
t_1
(if (<= z -6e-124)
(- x (* x y))
(if (<= z 18000.0) (+ x (* y t)) t_1))))))
double code(double x, double y, double z, double t) {
double t_1 = t * -z;
double tmp;
if (z <= -1e+272) {
tmp = x * z;
} else if (z <= -5.5e+92) {
tmp = t_1;
} else if (z <= -6e-124) {
tmp = x - (x * y);
} else if (z <= 18000.0) {
tmp = x + (y * 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 = t * -z
if (z <= (-1d+272)) then
tmp = x * z
else if (z <= (-5.5d+92)) then
tmp = t_1
else if (z <= (-6d-124)) then
tmp = x - (x * y)
else if (z <= 18000.0d0) then
tmp = x + (y * 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 = t * -z;
double tmp;
if (z <= -1e+272) {
tmp = x * z;
} else if (z <= -5.5e+92) {
tmp = t_1;
} else if (z <= -6e-124) {
tmp = x - (x * y);
} else if (z <= 18000.0) {
tmp = x + (y * t);
} else {
tmp = t_1;
}
return tmp;
}
def code(x, y, z, t): t_1 = t * -z tmp = 0 if z <= -1e+272: tmp = x * z elif z <= -5.5e+92: tmp = t_1 elif z <= -6e-124: tmp = x - (x * y) elif z <= 18000.0: tmp = x + (y * t) else: tmp = t_1 return tmp
function code(x, y, z, t) t_1 = Float64(t * Float64(-z)) tmp = 0.0 if (z <= -1e+272) tmp = Float64(x * z); elseif (z <= -5.5e+92) tmp = t_1; elseif (z <= -6e-124) tmp = Float64(x - Float64(x * y)); elseif (z <= 18000.0) tmp = Float64(x + Float64(y * t)); else tmp = t_1; end return tmp end
function tmp_2 = code(x, y, z, t) t_1 = t * -z; tmp = 0.0; if (z <= -1e+272) tmp = x * z; elseif (z <= -5.5e+92) tmp = t_1; elseif (z <= -6e-124) tmp = x - (x * y); elseif (z <= 18000.0) tmp = x + (y * t); else tmp = t_1; end tmp_2 = tmp; end
code[x_, y_, z_, t_] := Block[{t$95$1 = N[(t * (-z)), $MachinePrecision]}, If[LessEqual[z, -1e+272], N[(x * z), $MachinePrecision], If[LessEqual[z, -5.5e+92], t$95$1, If[LessEqual[z, -6e-124], N[(x - N[(x * y), $MachinePrecision]), $MachinePrecision], If[LessEqual[z, 18000.0], N[(x + N[(y * t), $MachinePrecision]), $MachinePrecision], t$95$1]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := t \cdot \left(-z\right)\\
\mathbf{if}\;z \leq -1 \cdot 10^{+272}:\\
\;\;\;\;x \cdot z\\
\mathbf{elif}\;z \leq -5.5 \cdot 10^{+92}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;z \leq -6 \cdot 10^{-124}:\\
\;\;\;\;x - x \cdot y\\
\mathbf{elif}\;z \leq 18000:\\
\;\;\;\;x + y \cdot t\\
\mathbf{else}:\\
\;\;\;\;t\_1\\
\end{array}
\end{array}
if z < -1.0000000000000001e272Initial program 100.0%
Taylor expanded in t around 0 90.4%
mul-1-neg90.4%
distribute-rgt-neg-in90.4%
sub-neg90.4%
+-commutative90.4%
distribute-neg-in90.4%
remove-double-neg90.4%
sub-neg90.4%
Simplified90.4%
Taylor expanded in z around inf 88.7%
*-commutative88.7%
Simplified88.7%
Taylor expanded in z around inf 88.7%
*-commutative88.7%
Simplified88.7%
if -1.0000000000000001e272 < z < -5.50000000000000053e92 or 18000 < z Initial program 100.0%
Taylor expanded in t around inf 60.6%
Taylor expanded in y around 0 51.8%
mul-1-neg51.8%
unsub-neg51.8%
*-commutative51.8%
Simplified51.8%
Taylor expanded in x around 0 51.3%
associate-*r*51.3%
neg-mul-151.3%
*-commutative51.3%
Simplified51.3%
if -5.50000000000000053e92 < z < -6e-124Initial program 100.0%
Taylor expanded in t around 0 68.2%
mul-1-neg68.2%
distribute-rgt-neg-in68.2%
sub-neg68.2%
+-commutative68.2%
distribute-neg-in68.2%
remove-double-neg68.2%
sub-neg68.2%
Simplified68.2%
Taylor expanded in z around 0 60.7%
mul-1-neg60.7%
unsub-neg60.7%
*-commutative60.7%
Simplified60.7%
if -6e-124 < z < 18000Initial program 100.0%
Taylor expanded in t around inf 74.0%
Taylor expanded in y around inf 69.1%
*-commutative69.1%
Simplified69.1%
Final simplification61.0%
(FPCore (x y z t)
:precision binary64
(let* ((t_1 (- x (* x y))))
(if (<= y -1.95e+16)
t_1
(if (<= y 7.8e+30)
(- x (* z t))
(if (<= y 9.5e+209) t_1 (+ x (* y t)))))))
double code(double x, double y, double z, double t) {
double t_1 = x - (x * y);
double tmp;
if (y <= -1.95e+16) {
tmp = t_1;
} else if (y <= 7.8e+30) {
tmp = x - (z * t);
} else if (y <= 9.5e+209) {
tmp = t_1;
} else {
tmp = x + (y * t);
}
return tmp;
}
real(8) function code(x, y, z, t)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
real(8) :: t_1
real(8) :: tmp
t_1 = x - (x * y)
if (y <= (-1.95d+16)) then
tmp = t_1
else if (y <= 7.8d+30) then
tmp = x - (z * t)
else if (y <= 9.5d+209) then
tmp = t_1
else
tmp = x + (y * t)
end if
code = tmp
end function
public static double code(double x, double y, double z, double t) {
double t_1 = x - (x * y);
double tmp;
if (y <= -1.95e+16) {
tmp = t_1;
} else if (y <= 7.8e+30) {
tmp = x - (z * t);
} else if (y <= 9.5e+209) {
tmp = t_1;
} else {
tmp = x + (y * t);
}
return tmp;
}
def code(x, y, z, t): t_1 = x - (x * y) tmp = 0 if y <= -1.95e+16: tmp = t_1 elif y <= 7.8e+30: tmp = x - (z * t) elif y <= 9.5e+209: tmp = t_1 else: tmp = x + (y * t) return tmp
function code(x, y, z, t) t_1 = Float64(x - Float64(x * y)) tmp = 0.0 if (y <= -1.95e+16) tmp = t_1; elseif (y <= 7.8e+30) tmp = Float64(x - Float64(z * t)); elseif (y <= 9.5e+209) tmp = t_1; else tmp = Float64(x + Float64(y * t)); end return tmp end
function tmp_2 = code(x, y, z, t) t_1 = x - (x * y); tmp = 0.0; if (y <= -1.95e+16) tmp = t_1; elseif (y <= 7.8e+30) tmp = x - (z * t); elseif (y <= 9.5e+209) tmp = t_1; else tmp = x + (y * t); end tmp_2 = tmp; end
code[x_, y_, z_, t_] := Block[{t$95$1 = N[(x - N[(x * y), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[y, -1.95e+16], t$95$1, If[LessEqual[y, 7.8e+30], N[(x - N[(z * t), $MachinePrecision]), $MachinePrecision], If[LessEqual[y, 9.5e+209], t$95$1, N[(x + N[(y * t), $MachinePrecision]), $MachinePrecision]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := x - x \cdot y\\
\mathbf{if}\;y \leq -1.95 \cdot 10^{+16}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;y \leq 7.8 \cdot 10^{+30}:\\
\;\;\;\;x - z \cdot t\\
\mathbf{elif}\;y \leq 9.5 \cdot 10^{+209}:\\
\;\;\;\;t\_1\\
\mathbf{else}:\\
\;\;\;\;x + y \cdot t\\
\end{array}
\end{array}
if y < -1.95e16 or 7.80000000000000021e30 < y < 9.50000000000000069e209Initial program 100.0%
Taylor expanded in t around 0 60.6%
mul-1-neg60.6%
distribute-rgt-neg-in60.6%
sub-neg60.6%
+-commutative60.6%
distribute-neg-in60.6%
remove-double-neg60.6%
sub-neg60.6%
Simplified60.6%
Taylor expanded in z around 0 47.6%
mul-1-neg47.6%
unsub-neg47.6%
*-commutative47.6%
Simplified47.6%
if -1.95e16 < y < 7.80000000000000021e30Initial program 100.0%
Taylor expanded in t around inf 79.3%
Taylor expanded in y around 0 67.0%
mul-1-neg67.0%
unsub-neg67.0%
*-commutative67.0%
Simplified67.0%
if 9.50000000000000069e209 < y Initial program 99.9%
Taylor expanded in t around inf 68.8%
Taylor expanded in y around inf 66.9%
*-commutative66.9%
Simplified66.9%
Final simplification58.8%
(FPCore (x y z t) :precision binary64 (if (or (<= z -6300000.0) (not (<= z 0.024))) (+ x (* z (- x t))) (- x (* y (- x t)))))
double code(double x, double y, double z, double t) {
double tmp;
if ((z <= -6300000.0) || !(z <= 0.024)) {
tmp = x + (z * (x - t));
} else {
tmp = x - (y * (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 ((z <= (-6300000.0d0)) .or. (.not. (z <= 0.024d0))) then
tmp = x + (z * (x - t))
else
tmp = x - (y * (x - t))
end if
code = tmp
end function
public static double code(double x, double y, double z, double t) {
double tmp;
if ((z <= -6300000.0) || !(z <= 0.024)) {
tmp = x + (z * (x - t));
} else {
tmp = x - (y * (x - t));
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if (z <= -6300000.0) or not (z <= 0.024): tmp = x + (z * (x - t)) else: tmp = x - (y * (x - t)) return tmp
function code(x, y, z, t) tmp = 0.0 if ((z <= -6300000.0) || !(z <= 0.024)) tmp = Float64(x + Float64(z * Float64(x - t))); else tmp = Float64(x - Float64(y * Float64(x - t))); end return tmp end
function tmp_2 = code(x, y, z, t) tmp = 0.0; if ((z <= -6300000.0) || ~((z <= 0.024))) tmp = x + (z * (x - t)); else tmp = x - (y * (x - t)); end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[Or[LessEqual[z, -6300000.0], N[Not[LessEqual[z, 0.024]], $MachinePrecision]], N[(x + N[(z * N[(x - t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(x - N[(y * N[(x - t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \leq -6300000 \lor \neg \left(z \leq 0.024\right):\\
\;\;\;\;x + z \cdot \left(x - t\right)\\
\mathbf{else}:\\
\;\;\;\;x - y \cdot \left(x - t\right)\\
\end{array}
\end{array}
if z < -6.3e6 or 0.024 < z Initial program 100.0%
Taylor expanded in y around 0 80.0%
mul-1-neg80.0%
unsub-neg80.0%
Simplified80.0%
if -6.3e6 < z < 0.024Initial program 100.0%
Taylor expanded in y around inf 95.1%
*-commutative95.1%
Simplified95.1%
Final simplification87.2%
(FPCore (x y z t) :precision binary64 (if (or (<= t -9e-32) (not (<= t 3.1e+40))) (- x (* t (- z y))) (+ x (* x (- z y)))))
double code(double x, double y, double z, double t) {
double tmp;
if ((t <= -9e-32) || !(t <= 3.1e+40)) {
tmp = x - (t * (z - y));
} else {
tmp = x + (x * (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 ((t <= (-9d-32)) .or. (.not. (t <= 3.1d+40))) then
tmp = x - (t * (z - y))
else
tmp = x + (x * (z - y))
end if
code = tmp
end function
public static double code(double x, double y, double z, double t) {
double tmp;
if ((t <= -9e-32) || !(t <= 3.1e+40)) {
tmp = x - (t * (z - y));
} else {
tmp = x + (x * (z - y));
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if (t <= -9e-32) or not (t <= 3.1e+40): tmp = x - (t * (z - y)) else: tmp = x + (x * (z - y)) return tmp
function code(x, y, z, t) tmp = 0.0 if ((t <= -9e-32) || !(t <= 3.1e+40)) tmp = Float64(x - Float64(t * Float64(z - y))); else tmp = Float64(x + Float64(x * Float64(z - y))); end return tmp end
function tmp_2 = code(x, y, z, t) tmp = 0.0; if ((t <= -9e-32) || ~((t <= 3.1e+40))) tmp = x - (t * (z - y)); else tmp = x + (x * (z - y)); end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[Or[LessEqual[t, -9e-32], N[Not[LessEqual[t, 3.1e+40]], $MachinePrecision]], N[(x - N[(t * N[(z - y), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(x + N[(x * N[(z - y), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;t \leq -9 \cdot 10^{-32} \lor \neg \left(t \leq 3.1 \cdot 10^{+40}\right):\\
\;\;\;\;x - t \cdot \left(z - y\right)\\
\mathbf{else}:\\
\;\;\;\;x + x \cdot \left(z - y\right)\\
\end{array}
\end{array}
if t < -9.00000000000000009e-32 or 3.0999999999999998e40 < t Initial program 100.0%
Taylor expanded in t around inf 88.9%
if -9.00000000000000009e-32 < t < 3.0999999999999998e40Initial program 100.0%
Taylor expanded in t around 0 81.6%
mul-1-neg81.6%
distribute-rgt-neg-in81.6%
sub-neg81.6%
+-commutative81.6%
distribute-neg-in81.6%
remove-double-neg81.6%
sub-neg81.6%
Simplified81.6%
Final simplification85.2%
(FPCore (x y z t) :precision binary64 (if (or (<= y -860000000000.0) (not (<= y 0.0026))) (- x (* y (- x t))) (- x (* z t))))
double code(double x, double y, double z, double t) {
double tmp;
if ((y <= -860000000000.0) || !(y <= 0.0026)) {
tmp = x - (y * (x - t));
} else {
tmp = x - (z * t);
}
return tmp;
}
real(8) function code(x, y, z, t)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
real(8) :: tmp
if ((y <= (-860000000000.0d0)) .or. (.not. (y <= 0.0026d0))) then
tmp = x - (y * (x - t))
else
tmp = x - (z * t)
end if
code = tmp
end function
public static double code(double x, double y, double z, double t) {
double tmp;
if ((y <= -860000000000.0) || !(y <= 0.0026)) {
tmp = x - (y * (x - t));
} else {
tmp = x - (z * t);
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if (y <= -860000000000.0) or not (y <= 0.0026): tmp = x - (y * (x - t)) else: tmp = x - (z * t) return tmp
function code(x, y, z, t) tmp = 0.0 if ((y <= -860000000000.0) || !(y <= 0.0026)) tmp = Float64(x - Float64(y * Float64(x - t))); else tmp = Float64(x - Float64(z * t)); end return tmp end
function tmp_2 = code(x, y, z, t) tmp = 0.0; if ((y <= -860000000000.0) || ~((y <= 0.0026))) tmp = x - (y * (x - t)); else tmp = x - (z * t); end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[Or[LessEqual[y, -860000000000.0], N[Not[LessEqual[y, 0.0026]], $MachinePrecision]], N[(x - N[(y * N[(x - t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(x - N[(z * t), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;y \leq -860000000000 \lor \neg \left(y \leq 0.0026\right):\\
\;\;\;\;x - y \cdot \left(x - t\right)\\
\mathbf{else}:\\
\;\;\;\;x - z \cdot t\\
\end{array}
\end{array}
if y < -8.6e11 or 0.0025999999999999999 < y Initial program 100.0%
Taylor expanded in y around inf 75.7%
*-commutative75.7%
Simplified75.7%
if -8.6e11 < y < 0.0025999999999999999Initial program 100.0%
Taylor expanded in t around inf 78.3%
Taylor expanded in y around 0 68.5%
mul-1-neg68.5%
unsub-neg68.5%
*-commutative68.5%
Simplified68.5%
Final simplification72.4%
(FPCore (x y z t) :precision binary64 (if (or (<= z -1.15e+16) (not (<= z 1.0))) (* x z) x))
double code(double x, double y, double z, double t) {
double tmp;
if ((z <= -1.15e+16) || !(z <= 1.0)) {
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.15d+16)) .or. (.not. (z <= 1.0d0))) 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.15e+16) || !(z <= 1.0)) {
tmp = x * z;
} else {
tmp = x;
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if (z <= -1.15e+16) or not (z <= 1.0): tmp = x * z else: tmp = x return tmp
function code(x, y, z, t) tmp = 0.0 if ((z <= -1.15e+16) || !(z <= 1.0)) 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.15e+16) || ~((z <= 1.0))) tmp = x * z; else tmp = x; end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[Or[LessEqual[z, -1.15e+16], N[Not[LessEqual[z, 1.0]], $MachinePrecision]], N[(x * z), $MachinePrecision], x]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \leq -1.15 \cdot 10^{+16} \lor \neg \left(z \leq 1\right):\\
\;\;\;\;x \cdot z\\
\mathbf{else}:\\
\;\;\;\;x\\
\end{array}
\end{array}
if z < -1.15e16 or 1 < z Initial program 100.0%
Taylor expanded in t around 0 51.9%
mul-1-neg51.9%
distribute-rgt-neg-in51.9%
sub-neg51.9%
+-commutative51.9%
distribute-neg-in51.9%
remove-double-neg51.9%
sub-neg51.9%
Simplified51.9%
Taylor expanded in z around inf 40.2%
*-commutative40.2%
Simplified40.2%
Taylor expanded in z around inf 39.7%
*-commutative39.7%
Simplified39.7%
if -1.15e16 < z < 1Initial program 100.0%
Taylor expanded in t around inf 71.9%
Taylor expanded in x around inf 29.6%
Final simplification34.8%
(FPCore (x y z t) :precision binary64 x)
double code(double x, double y, double z, double t) {
return x;
}
real(8) function code(x, y, z, t)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
code = x
end function
public static double code(double x, double y, double z, double t) {
return x;
}
def code(x, y, z, t): return x
function code(x, y, z, t) return x end
function tmp = code(x, y, z, t) tmp = x; end
code[x_, y_, z_, t_] := x
\begin{array}{l}
\\
x
\end{array}
Initial program 100.0%
Taylor expanded in t around inf 64.8%
Taylor expanded in x around inf 16.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 2024110
(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))))