
(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 12 alternatives:
| Alternative | Accuracy | Speedup |
|---|
(FPCore (x y z t) :precision binary64 (+ x (* (- y z) (- t x))))
double code(double x, double y, double z, double t) {
return x + ((y - z) * (t - x));
}
real(8) function code(x, y, z, t)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
code = x + ((y - z) * (t - x))
end function
public static double code(double x, double y, double z, double t) {
return x + ((y - z) * (t - x));
}
def code(x, y, z, t): return x + ((y - z) * (t - x))
function code(x, y, z, t) return Float64(x + Float64(Float64(y - z) * Float64(t - x))) end
function tmp = code(x, y, z, t) tmp = x + ((y - z) * (t - x)); end
code[x_, y_, z_, t_] := N[(x + N[(N[(y - z), $MachinePrecision] * N[(t - x), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
x + \left(y - z\right) \cdot \left(t - x\right)
\end{array}
(FPCore (x y z t) :precision binary64 (fma (- y z) (- t x) x))
double code(double x, double y, double z, double t) {
return fma((y - z), (t - x), x);
}
function code(x, y, z, t) return fma(Float64(y - z), Float64(t - x), x) end
code[x_, y_, z_, t_] := N[(N[(y - z), $MachinePrecision] * N[(t - x), $MachinePrecision] + x), $MachinePrecision]
\begin{array}{l}
\\
\mathsf{fma}\left(y - z, t - x, x\right)
\end{array}
Initial program 100.0%
+-commutative100.0%
fma-def100.0%
Simplified100.0%
Final simplification100.0%
(FPCore (x y z t)
:precision binary64
(let* ((t_1 (* x (- 1.0 y))) (t_2 (* z (- t))) (t_3 (+ x (* y t))))
(if (<= z -1.6e+146)
t_2
(if (<= z -7.4e-71)
t_3
(if (<= z -6.2e-274)
t_1
(if (<= z 7.6e-138)
t_3
(if (<= z 5.5e-12)
t_1
(if (<= z 118.0) t_3 (if (<= z 5.2e+154) t_2 (* z x))))))))))
double code(double x, double y, double z, double t) {
double t_1 = x * (1.0 - y);
double t_2 = z * -t;
double t_3 = x + (y * t);
double tmp;
if (z <= -1.6e+146) {
tmp = t_2;
} else if (z <= -7.4e-71) {
tmp = t_3;
} else if (z <= -6.2e-274) {
tmp = t_1;
} else if (z <= 7.6e-138) {
tmp = t_3;
} else if (z <= 5.5e-12) {
tmp = t_1;
} else if (z <= 118.0) {
tmp = t_3;
} else if (z <= 5.2e+154) {
tmp = t_2;
} else {
tmp = z * x;
}
return tmp;
}
real(8) function code(x, y, z, t)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
real(8) :: t_1
real(8) :: t_2
real(8) :: t_3
real(8) :: tmp
t_1 = x * (1.0d0 - y)
t_2 = z * -t
t_3 = x + (y * t)
if (z <= (-1.6d+146)) then
tmp = t_2
else if (z <= (-7.4d-71)) then
tmp = t_3
else if (z <= (-6.2d-274)) then
tmp = t_1
else if (z <= 7.6d-138) then
tmp = t_3
else if (z <= 5.5d-12) then
tmp = t_1
else if (z <= 118.0d0) then
tmp = t_3
else if (z <= 5.2d+154) then
tmp = t_2
else
tmp = z * x
end if
code = tmp
end function
public static double code(double x, double y, double z, double t) {
double t_1 = x * (1.0 - y);
double t_2 = z * -t;
double t_3 = x + (y * t);
double tmp;
if (z <= -1.6e+146) {
tmp = t_2;
} else if (z <= -7.4e-71) {
tmp = t_3;
} else if (z <= -6.2e-274) {
tmp = t_1;
} else if (z <= 7.6e-138) {
tmp = t_3;
} else if (z <= 5.5e-12) {
tmp = t_1;
} else if (z <= 118.0) {
tmp = t_3;
} else if (z <= 5.2e+154) {
tmp = t_2;
} else {
tmp = z * x;
}
return tmp;
}
def code(x, y, z, t): t_1 = x * (1.0 - y) t_2 = z * -t t_3 = x + (y * t) tmp = 0 if z <= -1.6e+146: tmp = t_2 elif z <= -7.4e-71: tmp = t_3 elif z <= -6.2e-274: tmp = t_1 elif z <= 7.6e-138: tmp = t_3 elif z <= 5.5e-12: tmp = t_1 elif z <= 118.0: tmp = t_3 elif z <= 5.2e+154: tmp = t_2 else: tmp = z * x return tmp
function code(x, y, z, t) t_1 = Float64(x * Float64(1.0 - y)) t_2 = Float64(z * Float64(-t)) t_3 = Float64(x + Float64(y * t)) tmp = 0.0 if (z <= -1.6e+146) tmp = t_2; elseif (z <= -7.4e-71) tmp = t_3; elseif (z <= -6.2e-274) tmp = t_1; elseif (z <= 7.6e-138) tmp = t_3; elseif (z <= 5.5e-12) tmp = t_1; elseif (z <= 118.0) tmp = t_3; elseif (z <= 5.2e+154) tmp = t_2; else tmp = Float64(z * x); end return tmp end
function tmp_2 = code(x, y, z, t) t_1 = x * (1.0 - y); t_2 = z * -t; t_3 = x + (y * t); tmp = 0.0; if (z <= -1.6e+146) tmp = t_2; elseif (z <= -7.4e-71) tmp = t_3; elseif (z <= -6.2e-274) tmp = t_1; elseif (z <= 7.6e-138) tmp = t_3; elseif (z <= 5.5e-12) tmp = t_1; elseif (z <= 118.0) tmp = t_3; elseif (z <= 5.2e+154) tmp = t_2; else tmp = z * x; end tmp_2 = tmp; end
code[x_, y_, z_, t_] := Block[{t$95$1 = N[(x * N[(1.0 - y), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$2 = N[(z * (-t)), $MachinePrecision]}, Block[{t$95$3 = N[(x + N[(y * t), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[z, -1.6e+146], t$95$2, If[LessEqual[z, -7.4e-71], t$95$3, If[LessEqual[z, -6.2e-274], t$95$1, If[LessEqual[z, 7.6e-138], t$95$3, If[LessEqual[z, 5.5e-12], t$95$1, If[LessEqual[z, 118.0], t$95$3, If[LessEqual[z, 5.2e+154], t$95$2, N[(z * x), $MachinePrecision]]]]]]]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := x \cdot \left(1 - y\right)\\
t_2 := z \cdot \left(-t\right)\\
t_3 := x + y \cdot t\\
\mathbf{if}\;z \leq -1.6 \cdot 10^{+146}:\\
\;\;\;\;t_2\\
\mathbf{elif}\;z \leq -7.4 \cdot 10^{-71}:\\
\;\;\;\;t_3\\
\mathbf{elif}\;z \leq -6.2 \cdot 10^{-274}:\\
\;\;\;\;t_1\\
\mathbf{elif}\;z \leq 7.6 \cdot 10^{-138}:\\
\;\;\;\;t_3\\
\mathbf{elif}\;z \leq 5.5 \cdot 10^{-12}:\\
\;\;\;\;t_1\\
\mathbf{elif}\;z \leq 118:\\
\;\;\;\;t_3\\
\mathbf{elif}\;z \leq 5.2 \cdot 10^{+154}:\\
\;\;\;\;t_2\\
\mathbf{else}:\\
\;\;\;\;z \cdot x\\
\end{array}
\end{array}
if z < -1.6e146 or 118 < z < 5.19999999999999978e154Initial program 99.9%
Taylor expanded in y around 0 81.3%
mul-1-neg81.3%
unsub-neg81.3%
Simplified81.3%
Taylor expanded in t around inf 56.8%
Taylor expanded in x around 0 56.2%
mul-1-neg56.2%
distribute-rgt-neg-out56.2%
Simplified56.2%
if -1.6e146 < z < -7.3999999999999993e-71 or -6.19999999999999956e-274 < z < 7.6000000000000005e-138 or 5.5000000000000004e-12 < z < 118Initial program 100.0%
sub-neg100.0%
distribute-lft-in96.8%
Applied egg-rr96.8%
Taylor expanded in z around 0 82.9%
Taylor expanded in x around 0 69.5%
if -7.3999999999999993e-71 < z < -6.19999999999999956e-274 or 7.6000000000000005e-138 < z < 5.5000000000000004e-12Initial program 100.0%
Taylor expanded in x around inf 74.0%
mul-1-neg74.0%
unsub-neg74.0%
Simplified74.0%
Taylor expanded in z around 0 73.8%
if 5.19999999999999978e154 < z Initial program 99.9%
Taylor expanded in x around inf 61.5%
mul-1-neg61.5%
unsub-neg61.5%
Simplified61.5%
Taylor expanded in y around 0 54.6%
+-commutative54.6%
Simplified54.6%
Taylor expanded in z around inf 54.6%
Final simplification65.4%
(FPCore (x y z t)
:precision binary64
(let* ((t_1 (* z (- t))))
(if (<= z -4e+137)
t_1
(if (<= z -6.2e+30)
(* z x)
(if (<= z -6.2e-62)
t_1
(if (<= z 960.0) x (if (<= z 5.3e+157) t_1 (* z x))))))))
double code(double x, double y, double z, double t) {
double t_1 = z * -t;
double tmp;
if (z <= -4e+137) {
tmp = t_1;
} else if (z <= -6.2e+30) {
tmp = z * x;
} else if (z <= -6.2e-62) {
tmp = t_1;
} else if (z <= 960.0) {
tmp = x;
} else if (z <= 5.3e+157) {
tmp = t_1;
} else {
tmp = z * x;
}
return tmp;
}
real(8) function code(x, y, z, t)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
real(8) :: t_1
real(8) :: tmp
t_1 = z * -t
if (z <= (-4d+137)) then
tmp = t_1
else if (z <= (-6.2d+30)) then
tmp = z * x
else if (z <= (-6.2d-62)) then
tmp = t_1
else if (z <= 960.0d0) then
tmp = x
else if (z <= 5.3d+157) then
tmp = t_1
else
tmp = z * x
end if
code = tmp
end function
public static double code(double x, double y, double z, double t) {
double t_1 = z * -t;
double tmp;
if (z <= -4e+137) {
tmp = t_1;
} else if (z <= -6.2e+30) {
tmp = z * x;
} else if (z <= -6.2e-62) {
tmp = t_1;
} else if (z <= 960.0) {
tmp = x;
} else if (z <= 5.3e+157) {
tmp = t_1;
} else {
tmp = z * x;
}
return tmp;
}
def code(x, y, z, t): t_1 = z * -t tmp = 0 if z <= -4e+137: tmp = t_1 elif z <= -6.2e+30: tmp = z * x elif z <= -6.2e-62: tmp = t_1 elif z <= 960.0: tmp = x elif z <= 5.3e+157: tmp = t_1 else: tmp = z * x return tmp
function code(x, y, z, t) t_1 = Float64(z * Float64(-t)) tmp = 0.0 if (z <= -4e+137) tmp = t_1; elseif (z <= -6.2e+30) tmp = Float64(z * x); elseif (z <= -6.2e-62) tmp = t_1; elseif (z <= 960.0) tmp = x; elseif (z <= 5.3e+157) tmp = t_1; else tmp = Float64(z * x); end return tmp end
function tmp_2 = code(x, y, z, t) t_1 = z * -t; tmp = 0.0; if (z <= -4e+137) tmp = t_1; elseif (z <= -6.2e+30) tmp = z * x; elseif (z <= -6.2e-62) tmp = t_1; elseif (z <= 960.0) tmp = x; elseif (z <= 5.3e+157) tmp = t_1; else tmp = z * x; end tmp_2 = tmp; end
code[x_, y_, z_, t_] := Block[{t$95$1 = N[(z * (-t)), $MachinePrecision]}, If[LessEqual[z, -4e+137], t$95$1, If[LessEqual[z, -6.2e+30], N[(z * x), $MachinePrecision], If[LessEqual[z, -6.2e-62], t$95$1, If[LessEqual[z, 960.0], x, If[LessEqual[z, 5.3e+157], t$95$1, N[(z * x), $MachinePrecision]]]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := z \cdot \left(-t\right)\\
\mathbf{if}\;z \leq -4 \cdot 10^{+137}:\\
\;\;\;\;t_1\\
\mathbf{elif}\;z \leq -6.2 \cdot 10^{+30}:\\
\;\;\;\;z \cdot x\\
\mathbf{elif}\;z \leq -6.2 \cdot 10^{-62}:\\
\;\;\;\;t_1\\
\mathbf{elif}\;z \leq 960:\\
\;\;\;\;x\\
\mathbf{elif}\;z \leq 5.3 \cdot 10^{+157}:\\
\;\;\;\;t_1\\
\mathbf{else}:\\
\;\;\;\;z \cdot x\\
\end{array}
\end{array}
if z < -4.0000000000000001e137 or -6.1999999999999995e30 < z < -6.1999999999999999e-62 or 960 < z < 5.2999999999999998e157Initial program 99.9%
Taylor expanded in y around 0 78.8%
mul-1-neg78.8%
unsub-neg78.8%
Simplified78.8%
Taylor expanded in t around inf 55.9%
Taylor expanded in x around 0 53.4%
mul-1-neg53.4%
distribute-rgt-neg-out53.4%
Simplified53.4%
if -4.0000000000000001e137 < z < -6.1999999999999995e30 or 5.2999999999999998e157 < z Initial program 100.0%
Taylor expanded in x around inf 61.9%
mul-1-neg61.9%
unsub-neg61.9%
Simplified61.9%
Taylor expanded in y around 0 52.3%
+-commutative52.3%
Simplified52.3%
Taylor expanded in z around inf 52.3%
if -6.1999999999999999e-62 < z < 960Initial program 100.0%
Taylor expanded in y around 0 37.6%
mul-1-neg37.6%
unsub-neg37.6%
Simplified37.6%
Taylor expanded in z around 0 33.2%
Final simplification42.8%
(FPCore (x y z t)
:precision binary64
(let* ((t_1 (* z (- t))))
(if (<= z -8e+145)
t_1
(if (<= z -1.85e+31)
(* z x)
(if (<= z -14.2)
t_1
(if (<= z 26000.0)
(* x (- 1.0 y))
(if (<= z 4.2e+165) t_1 (* z x))))))))
double code(double x, double y, double z, double t) {
double t_1 = z * -t;
double tmp;
if (z <= -8e+145) {
tmp = t_1;
} else if (z <= -1.85e+31) {
tmp = z * x;
} else if (z <= -14.2) {
tmp = t_1;
} else if (z <= 26000.0) {
tmp = x * (1.0 - y);
} else if (z <= 4.2e+165) {
tmp = t_1;
} else {
tmp = z * x;
}
return tmp;
}
real(8) function code(x, y, z, t)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
real(8) :: t_1
real(8) :: tmp
t_1 = z * -t
if (z <= (-8d+145)) then
tmp = t_1
else if (z <= (-1.85d+31)) then
tmp = z * x
else if (z <= (-14.2d0)) then
tmp = t_1
else if (z <= 26000.0d0) then
tmp = x * (1.0d0 - y)
else if (z <= 4.2d+165) then
tmp = t_1
else
tmp = z * x
end if
code = tmp
end function
public static double code(double x, double y, double z, double t) {
double t_1 = z * -t;
double tmp;
if (z <= -8e+145) {
tmp = t_1;
} else if (z <= -1.85e+31) {
tmp = z * x;
} else if (z <= -14.2) {
tmp = t_1;
} else if (z <= 26000.0) {
tmp = x * (1.0 - y);
} else if (z <= 4.2e+165) {
tmp = t_1;
} else {
tmp = z * x;
}
return tmp;
}
def code(x, y, z, t): t_1 = z * -t tmp = 0 if z <= -8e+145: tmp = t_1 elif z <= -1.85e+31: tmp = z * x elif z <= -14.2: tmp = t_1 elif z <= 26000.0: tmp = x * (1.0 - y) elif z <= 4.2e+165: tmp = t_1 else: tmp = z * x return tmp
function code(x, y, z, t) t_1 = Float64(z * Float64(-t)) tmp = 0.0 if (z <= -8e+145) tmp = t_1; elseif (z <= -1.85e+31) tmp = Float64(z * x); elseif (z <= -14.2) tmp = t_1; elseif (z <= 26000.0) tmp = Float64(x * Float64(1.0 - y)); elseif (z <= 4.2e+165) tmp = t_1; else tmp = Float64(z * x); end return tmp end
function tmp_2 = code(x, y, z, t) t_1 = z * -t; tmp = 0.0; if (z <= -8e+145) tmp = t_1; elseif (z <= -1.85e+31) tmp = z * x; elseif (z <= -14.2) tmp = t_1; elseif (z <= 26000.0) tmp = x * (1.0 - y); elseif (z <= 4.2e+165) tmp = t_1; else tmp = z * x; end tmp_2 = tmp; end
code[x_, y_, z_, t_] := Block[{t$95$1 = N[(z * (-t)), $MachinePrecision]}, If[LessEqual[z, -8e+145], t$95$1, If[LessEqual[z, -1.85e+31], N[(z * x), $MachinePrecision], If[LessEqual[z, -14.2], t$95$1, If[LessEqual[z, 26000.0], N[(x * N[(1.0 - y), $MachinePrecision]), $MachinePrecision], If[LessEqual[z, 4.2e+165], t$95$1, N[(z * x), $MachinePrecision]]]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := z \cdot \left(-t\right)\\
\mathbf{if}\;z \leq -8 \cdot 10^{+145}:\\
\;\;\;\;t_1\\
\mathbf{elif}\;z \leq -1.85 \cdot 10^{+31}:\\
\;\;\;\;z \cdot x\\
\mathbf{elif}\;z \leq -14.2:\\
\;\;\;\;t_1\\
\mathbf{elif}\;z \leq 26000:\\
\;\;\;\;x \cdot \left(1 - y\right)\\
\mathbf{elif}\;z \leq 4.2 \cdot 10^{+165}:\\
\;\;\;\;t_1\\
\mathbf{else}:\\
\;\;\;\;z \cdot x\\
\end{array}
\end{array}
if z < -7.9999999999999999e145 or -1.8499999999999999e31 < z < -14.199999999999999 or 26000 < z < 4.2000000000000001e165Initial program 99.9%
Taylor expanded in y around 0 81.6%
mul-1-neg81.6%
unsub-neg81.6%
Simplified81.6%
Taylor expanded in t around inf 56.4%
Taylor expanded in x around 0 55.9%
mul-1-neg55.9%
distribute-rgt-neg-out55.9%
Simplified55.9%
if -7.9999999999999999e145 < z < -1.8499999999999999e31 or 4.2000000000000001e165 < z Initial program 100.0%
Taylor expanded in x around inf 61.9%
mul-1-neg61.9%
unsub-neg61.9%
Simplified61.9%
Taylor expanded in y around 0 52.3%
+-commutative52.3%
Simplified52.3%
Taylor expanded in z around inf 52.3%
if -14.199999999999999 < z < 26000Initial program 100.0%
Taylor expanded in x around inf 63.2%
mul-1-neg63.2%
unsub-neg63.2%
Simplified63.2%
Taylor expanded in z around 0 62.7%
Final simplification59.1%
(FPCore (x y z t)
:precision binary64
(let* ((t_1 (+ x (* y (- t x)))))
(if (<= y -3.3e+18)
t_1
(if (<= y -1.05e-51)
(* x (+ (- z y) 1.0))
(if (<= y 3.2e-88) (- x (* z t)) t_1)))))
double code(double x, double y, double z, double t) {
double t_1 = x + (y * (t - x));
double tmp;
if (y <= -3.3e+18) {
tmp = t_1;
} else if (y <= -1.05e-51) {
tmp = x * ((z - y) + 1.0);
} else if (y <= 3.2e-88) {
tmp = x - (z * t);
} else {
tmp = t_1;
}
return tmp;
}
real(8) function code(x, y, z, t)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
real(8) :: t_1
real(8) :: tmp
t_1 = x + (y * (t - x))
if (y <= (-3.3d+18)) then
tmp = t_1
else if (y <= (-1.05d-51)) then
tmp = x * ((z - y) + 1.0d0)
else if (y <= 3.2d-88) then
tmp = x - (z * t)
else
tmp = t_1
end if
code = tmp
end function
public static double code(double x, double y, double z, double t) {
double t_1 = x + (y * (t - x));
double tmp;
if (y <= -3.3e+18) {
tmp = t_1;
} else if (y <= -1.05e-51) {
tmp = x * ((z - y) + 1.0);
} else if (y <= 3.2e-88) {
tmp = x - (z * t);
} else {
tmp = t_1;
}
return tmp;
}
def code(x, y, z, t): t_1 = x + (y * (t - x)) tmp = 0 if y <= -3.3e+18: tmp = t_1 elif y <= -1.05e-51: tmp = x * ((z - y) + 1.0) elif y <= 3.2e-88: tmp = x - (z * t) else: tmp = t_1 return tmp
function code(x, y, z, t) t_1 = Float64(x + Float64(y * Float64(t - x))) tmp = 0.0 if (y <= -3.3e+18) tmp = t_1; elseif (y <= -1.05e-51) tmp = Float64(x * Float64(Float64(z - y) + 1.0)); elseif (y <= 3.2e-88) tmp = Float64(x - Float64(z * t)); else tmp = t_1; end return tmp end
function tmp_2 = code(x, y, z, t) t_1 = x + (y * (t - x)); tmp = 0.0; if (y <= -3.3e+18) tmp = t_1; elseif (y <= -1.05e-51) tmp = x * ((z - y) + 1.0); elseif (y <= 3.2e-88) tmp = x - (z * t); else tmp = t_1; end tmp_2 = tmp; end
code[x_, y_, z_, t_] := Block[{t$95$1 = N[(x + N[(y * N[(t - x), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[y, -3.3e+18], t$95$1, If[LessEqual[y, -1.05e-51], N[(x * N[(N[(z - y), $MachinePrecision] + 1.0), $MachinePrecision]), $MachinePrecision], If[LessEqual[y, 3.2e-88], N[(x - N[(z * t), $MachinePrecision]), $MachinePrecision], t$95$1]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := x + y \cdot \left(t - x\right)\\
\mathbf{if}\;y \leq -3.3 \cdot 10^{+18}:\\
\;\;\;\;t_1\\
\mathbf{elif}\;y \leq -1.05 \cdot 10^{-51}:\\
\;\;\;\;x \cdot \left(\left(z - y\right) + 1\right)\\
\mathbf{elif}\;y \leq 3.2 \cdot 10^{-88}:\\
\;\;\;\;x - z \cdot t\\
\mathbf{else}:\\
\;\;\;\;t_1\\
\end{array}
\end{array}
if y < -3.3e18 or 3.20000000000000012e-88 < y Initial program 100.0%
Taylor expanded in y around inf 78.5%
*-commutative78.5%
Simplified78.5%
if -3.3e18 < y < -1.05000000000000001e-51Initial program 99.9%
Taylor expanded in x around inf 77.6%
mul-1-neg77.6%
unsub-neg77.6%
Simplified77.6%
if -1.05000000000000001e-51 < y < 3.20000000000000012e-88Initial program 100.0%
Taylor expanded in y around 0 91.9%
mul-1-neg91.9%
unsub-neg91.9%
Simplified91.9%
Taylor expanded in t around inf 76.2%
Final simplification77.6%
(FPCore (x y z t)
:precision binary64
(let* ((t_1 (* x (- 1.0 y))))
(if (<= y -9e+87)
t_1
(if (<= y -3.7e-20)
(+ x (* y t))
(if (<= y 3600000.0) (- x (* z t)) t_1)))))
double code(double x, double y, double z, double t) {
double t_1 = x * (1.0 - y);
double tmp;
if (y <= -9e+87) {
tmp = t_1;
} else if (y <= -3.7e-20) {
tmp = x + (y * t);
} else if (y <= 3600000.0) {
tmp = x - (z * t);
} else {
tmp = t_1;
}
return tmp;
}
real(8) function code(x, y, z, t)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
real(8) :: t_1
real(8) :: tmp
t_1 = x * (1.0d0 - y)
if (y <= (-9d+87)) then
tmp = t_1
else if (y <= (-3.7d-20)) then
tmp = x + (y * t)
else if (y <= 3600000.0d0) then
tmp = x - (z * t)
else
tmp = t_1
end if
code = tmp
end function
public static double code(double x, double y, double z, double t) {
double t_1 = x * (1.0 - y);
double tmp;
if (y <= -9e+87) {
tmp = t_1;
} else if (y <= -3.7e-20) {
tmp = x + (y * t);
} else if (y <= 3600000.0) {
tmp = x - (z * t);
} else {
tmp = t_1;
}
return tmp;
}
def code(x, y, z, t): t_1 = x * (1.0 - y) tmp = 0 if y <= -9e+87: tmp = t_1 elif y <= -3.7e-20: tmp = x + (y * t) elif y <= 3600000.0: tmp = x - (z * t) else: tmp = t_1 return tmp
function code(x, y, z, t) t_1 = Float64(x * Float64(1.0 - y)) tmp = 0.0 if (y <= -9e+87) tmp = t_1; elseif (y <= -3.7e-20) tmp = Float64(x + Float64(y * t)); elseif (y <= 3600000.0) tmp = Float64(x - Float64(z * t)); else tmp = t_1; end return tmp end
function tmp_2 = code(x, y, z, t) t_1 = x * (1.0 - y); tmp = 0.0; if (y <= -9e+87) tmp = t_1; elseif (y <= -3.7e-20) tmp = x + (y * t); elseif (y <= 3600000.0) tmp = x - (z * t); else tmp = t_1; end tmp_2 = tmp; end
code[x_, y_, z_, t_] := Block[{t$95$1 = N[(x * N[(1.0 - y), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[y, -9e+87], t$95$1, If[LessEqual[y, -3.7e-20], N[(x + N[(y * t), $MachinePrecision]), $MachinePrecision], If[LessEqual[y, 3600000.0], N[(x - N[(z * t), $MachinePrecision]), $MachinePrecision], t$95$1]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := x \cdot \left(1 - y\right)\\
\mathbf{if}\;y \leq -9 \cdot 10^{+87}:\\
\;\;\;\;t_1\\
\mathbf{elif}\;y \leq -3.7 \cdot 10^{-20}:\\
\;\;\;\;x + y \cdot t\\
\mathbf{elif}\;y \leq 3600000:\\
\;\;\;\;x - z \cdot t\\
\mathbf{else}:\\
\;\;\;\;t_1\\
\end{array}
\end{array}
if y < -9.0000000000000005e87 or 3.6e6 < y Initial program 100.0%
Taylor expanded in x around inf 57.7%
mul-1-neg57.7%
unsub-neg57.7%
Simplified57.7%
Taylor expanded in z around 0 52.0%
if -9.0000000000000005e87 < y < -3.7000000000000001e-20Initial program 99.9%
sub-neg99.9%
distribute-lft-in93.2%
Applied egg-rr93.2%
Taylor expanded in z around 0 63.8%
Taylor expanded in x around 0 58.7%
if -3.7000000000000001e-20 < y < 3.6e6Initial program 100.0%
Taylor expanded in y around 0 88.9%
mul-1-neg88.9%
unsub-neg88.9%
Simplified88.9%
Taylor expanded in t around inf 69.6%
Final simplification61.1%
(FPCore (x y z t) :precision binary64 (if (or (<= z -2000.0) (not (<= z 10800.0))) (- x (* z (- t x))) (+ x (* y (- t x)))))
double code(double x, double y, double z, double t) {
double tmp;
if ((z <= -2000.0) || !(z <= 10800.0)) {
tmp = x - (z * (t - x));
} else {
tmp = x + (y * (t - 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 <= (-2000.0d0)) .or. (.not. (z <= 10800.0d0))) then
tmp = x - (z * (t - x))
else
tmp = x + (y * (t - x))
end if
code = tmp
end function
public static double code(double x, double y, double z, double t) {
double tmp;
if ((z <= -2000.0) || !(z <= 10800.0)) {
tmp = x - (z * (t - x));
} else {
tmp = x + (y * (t - x));
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if (z <= -2000.0) or not (z <= 10800.0): tmp = x - (z * (t - x)) else: tmp = x + (y * (t - x)) return tmp
function code(x, y, z, t) tmp = 0.0 if ((z <= -2000.0) || !(z <= 10800.0)) tmp = Float64(x - Float64(z * Float64(t - x))); else tmp = Float64(x + Float64(y * Float64(t - x))); end return tmp end
function tmp_2 = code(x, y, z, t) tmp = 0.0; if ((z <= -2000.0) || ~((z <= 10800.0))) tmp = x - (z * (t - x)); else tmp = x + (y * (t - x)); end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[Or[LessEqual[z, -2000.0], N[Not[LessEqual[z, 10800.0]], $MachinePrecision]], N[(x - N[(z * N[(t - x), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(x + N[(y * N[(t - x), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \leq -2000 \lor \neg \left(z \leq 10800\right):\\
\;\;\;\;x - z \cdot \left(t - x\right)\\
\mathbf{else}:\\
\;\;\;\;x + y \cdot \left(t - x\right)\\
\end{array}
\end{array}
if z < -2e3 or 10800 < z Initial program 99.9%
Taylor expanded in y around 0 79.8%
mul-1-neg79.8%
unsub-neg79.8%
Simplified79.8%
if -2e3 < z < 10800Initial program 100.0%
Taylor expanded in y around inf 94.7%
*-commutative94.7%
Simplified94.7%
Final simplification87.9%
(FPCore (x y z t) :precision binary64 (if (<= t -1.04e+26) (- x (* z t)) (if (<= t 5.6e+34) (* x (+ (- z y) 1.0)) (+ x (* y t)))))
double code(double x, double y, double z, double t) {
double tmp;
if (t <= -1.04e+26) {
tmp = x - (z * t);
} else if (t <= 5.6e+34) {
tmp = x * ((z - y) + 1.0);
} 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) :: tmp
if (t <= (-1.04d+26)) then
tmp = x - (z * t)
else if (t <= 5.6d+34) then
tmp = x * ((z - y) + 1.0d0)
else
tmp = x + (y * t)
end if
code = tmp
end function
public static double code(double x, double y, double z, double t) {
double tmp;
if (t <= -1.04e+26) {
tmp = x - (z * t);
} else if (t <= 5.6e+34) {
tmp = x * ((z - y) + 1.0);
} else {
tmp = x + (y * t);
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if t <= -1.04e+26: tmp = x - (z * t) elif t <= 5.6e+34: tmp = x * ((z - y) + 1.0) else: tmp = x + (y * t) return tmp
function code(x, y, z, t) tmp = 0.0 if (t <= -1.04e+26) tmp = Float64(x - Float64(z * t)); elseif (t <= 5.6e+34) tmp = Float64(x * Float64(Float64(z - y) + 1.0)); else tmp = Float64(x + Float64(y * t)); end return tmp end
function tmp_2 = code(x, y, z, t) tmp = 0.0; if (t <= -1.04e+26) tmp = x - (z * t); elseif (t <= 5.6e+34) tmp = x * ((z - y) + 1.0); else tmp = x + (y * t); end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[LessEqual[t, -1.04e+26], N[(x - N[(z * t), $MachinePrecision]), $MachinePrecision], If[LessEqual[t, 5.6e+34], N[(x * N[(N[(z - y), $MachinePrecision] + 1.0), $MachinePrecision]), $MachinePrecision], N[(x + N[(y * t), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;t \leq -1.04 \cdot 10^{+26}:\\
\;\;\;\;x - z \cdot t\\
\mathbf{elif}\;t \leq 5.6 \cdot 10^{+34}:\\
\;\;\;\;x \cdot \left(\left(z - y\right) + 1\right)\\
\mathbf{else}:\\
\;\;\;\;x + y \cdot t\\
\end{array}
\end{array}
if t < -1.0399999999999999e26Initial program 100.0%
Taylor expanded in y around 0 61.3%
mul-1-neg61.3%
unsub-neg61.3%
Simplified61.3%
Taylor expanded in t around inf 58.2%
if -1.0399999999999999e26 < t < 5.60000000000000016e34Initial program 99.9%
Taylor expanded in x around inf 81.6%
mul-1-neg81.6%
unsub-neg81.6%
Simplified81.6%
if 5.60000000000000016e34 < t Initial program 100.0%
sub-neg100.0%
distribute-lft-in89.2%
Applied egg-rr89.2%
Taylor expanded in z around 0 59.2%
Taylor expanded in x around 0 56.6%
Final simplification70.5%
(FPCore (x y z t) :precision binary64 (if (or (<= t -1e+18) (not (<= t 6e+50))) (* z (- t)) (* x (+ z 1.0))))
double code(double x, double y, double z, double t) {
double tmp;
if ((t <= -1e+18) || !(t <= 6e+50)) {
tmp = z * -t;
} else {
tmp = x * (z + 1.0);
}
return tmp;
}
real(8) function code(x, y, z, t)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
real(8) :: tmp
if ((t <= (-1d+18)) .or. (.not. (t <= 6d+50))) then
tmp = z * -t
else
tmp = x * (z + 1.0d0)
end if
code = tmp
end function
public static double code(double x, double y, double z, double t) {
double tmp;
if ((t <= -1e+18) || !(t <= 6e+50)) {
tmp = z * -t;
} else {
tmp = x * (z + 1.0);
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if (t <= -1e+18) or not (t <= 6e+50): tmp = z * -t else: tmp = x * (z + 1.0) return tmp
function code(x, y, z, t) tmp = 0.0 if ((t <= -1e+18) || !(t <= 6e+50)) tmp = Float64(z * Float64(-t)); else tmp = Float64(x * Float64(z + 1.0)); end return tmp end
function tmp_2 = code(x, y, z, t) tmp = 0.0; if ((t <= -1e+18) || ~((t <= 6e+50))) tmp = z * -t; else tmp = x * (z + 1.0); end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[Or[LessEqual[t, -1e+18], N[Not[LessEqual[t, 6e+50]], $MachinePrecision]], N[(z * (-t)), $MachinePrecision], N[(x * N[(z + 1.0), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;t \leq -1 \cdot 10^{+18} \lor \neg \left(t \leq 6 \cdot 10^{+50}\right):\\
\;\;\;\;z \cdot \left(-t\right)\\
\mathbf{else}:\\
\;\;\;\;x \cdot \left(z + 1\right)\\
\end{array}
\end{array}
if t < -1e18 or 5.9999999999999996e50 < t Initial program 100.0%
Taylor expanded in y around 0 54.6%
mul-1-neg54.6%
unsub-neg54.6%
Simplified54.6%
Taylor expanded in t around inf 50.7%
Taylor expanded in x around 0 44.3%
mul-1-neg44.3%
distribute-rgt-neg-out44.3%
Simplified44.3%
if -1e18 < t < 5.9999999999999996e50Initial program 99.9%
Taylor expanded in x around inf 79.4%
mul-1-neg79.4%
unsub-neg79.4%
Simplified79.4%
Taylor expanded in y around 0 52.4%
+-commutative52.4%
Simplified52.4%
Final simplification48.8%
(FPCore (x y z t) :precision binary64 (if (or (<= z -1.0) (not (<= z 1.0))) (* z x) x))
double code(double x, double y, double z, double t) {
double tmp;
if ((z <= -1.0) || !(z <= 1.0)) {
tmp = z * x;
} 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 <= 1.0d0))) then
tmp = z * x
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 <= 1.0)) {
tmp = z * x;
} else {
tmp = x;
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if (z <= -1.0) or not (z <= 1.0): tmp = z * x else: tmp = x return tmp
function code(x, y, z, t) tmp = 0.0 if ((z <= -1.0) || !(z <= 1.0)) tmp = Float64(z * x); else tmp = x; end return tmp end
function tmp_2 = code(x, y, z, t) tmp = 0.0; if ((z <= -1.0) || ~((z <= 1.0))) tmp = z * x; else tmp = x; end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[Or[LessEqual[z, -1.0], N[Not[LessEqual[z, 1.0]], $MachinePrecision]], N[(z * x), $MachinePrecision], x]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \leq -1 \lor \neg \left(z \leq 1\right):\\
\;\;\;\;z \cdot x\\
\mathbf{else}:\\
\;\;\;\;x\\
\end{array}
\end{array}
if z < -1 or 1 < z Initial program 99.9%
Taylor expanded in x around inf 47.2%
mul-1-neg47.2%
unsub-neg47.2%
Simplified47.2%
Taylor expanded in y around 0 36.7%
+-commutative36.7%
Simplified36.7%
Taylor expanded in z around inf 36.0%
if -1 < z < 1Initial program 100.0%
Taylor expanded in y around 0 38.6%
mul-1-neg38.6%
unsub-neg38.6%
Simplified38.6%
Taylor expanded in z around 0 33.1%
Final simplification34.4%
(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 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 57.1%
mul-1-neg57.1%
unsub-neg57.1%
Simplified57.1%
Taylor expanded in z around 0 19.4%
Final simplification19.4%
(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 2024024
(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))))