
(FPCore (x y z t) :precision binary64 (+ x (* (- y z) (- t x))))
double code(double x, double y, double z, double t) {
return x + ((y - z) * (t - x));
}
real(8) function code(x, y, z, t)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
code = x + ((y - z) * (t - x))
end function
public static double code(double x, double y, double z, double t) {
return x + ((y - z) * (t - x));
}
def code(x, y, z, t): return x + ((y - z) * (t - x))
function code(x, y, z, t) return Float64(x + Float64(Float64(y - z) * Float64(t - x))) end
function tmp = code(x, y, z, t) tmp = x + ((y - z) * (t - x)); end
code[x_, y_, z_, t_] := N[(x + N[(N[(y - z), $MachinePrecision] * N[(t - x), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
x + \left(y - z\right) \cdot \left(t - x\right)
\end{array}
Sampling outcomes in binary64 precision:
Herbie found 13 alternatives:
| Alternative | Accuracy | Speedup |
|---|
(FPCore (x y z t) :precision binary64 (+ x (* (- y z) (- t x))))
double code(double x, double y, double z, double t) {
return x + ((y - z) * (t - x));
}
real(8) function code(x, y, z, t)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
code = x + ((y - z) * (t - x))
end function
public static double code(double x, double y, double z, double t) {
return x + ((y - z) * (t - x));
}
def code(x, y, z, t): return x + ((y - z) * (t - x))
function code(x, y, z, t) return Float64(x + Float64(Float64(y - z) * Float64(t - x))) end
function tmp = code(x, y, z, t) tmp = x + ((y - z) * (t - x)); end
code[x_, y_, z_, t_] := N[(x + N[(N[(y - z), $MachinePrecision] * N[(t - x), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
x + \left(y - z\right) \cdot \left(t - x\right)
\end{array}
(FPCore (x y z t) :precision binary64 (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-define100.0%
Simplified100.0%
(FPCore (x y z t)
:precision binary64
(let* ((t_1 (* y (- t x))) (t_2 (* z (- x t))) (t_3 (* x (- 1.0 y))))
(if (<= z -1.95e-22)
t_2
(if (<= z -1.2e-146)
t_3
(if (<= z -5.2e-260)
t_1
(if (<= z 1.75e-193) t_3 (if (<= z 1.82) t_1 t_2)))))))
double code(double x, double y, double z, double t) {
double t_1 = y * (t - x);
double t_2 = z * (x - t);
double t_3 = x * (1.0 - y);
double tmp;
if (z <= -1.95e-22) {
tmp = t_2;
} else if (z <= -1.2e-146) {
tmp = t_3;
} else if (z <= -5.2e-260) {
tmp = t_1;
} else if (z <= 1.75e-193) {
tmp = t_3;
} else if (z <= 1.82) {
tmp = t_1;
} else {
tmp = t_2;
}
return tmp;
}
real(8) function code(x, y, z, t)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
real(8) :: t_1
real(8) :: t_2
real(8) :: t_3
real(8) :: tmp
t_1 = y * (t - x)
t_2 = z * (x - t)
t_3 = x * (1.0d0 - y)
if (z <= (-1.95d-22)) then
tmp = t_2
else if (z <= (-1.2d-146)) then
tmp = t_3
else if (z <= (-5.2d-260)) then
tmp = t_1
else if (z <= 1.75d-193) then
tmp = t_3
else if (z <= 1.82d0) then
tmp = t_1
else
tmp = t_2
end if
code = tmp
end function
public static double code(double x, double y, double z, double t) {
double t_1 = y * (t - x);
double t_2 = z * (x - t);
double t_3 = x * (1.0 - y);
double tmp;
if (z <= -1.95e-22) {
tmp = t_2;
} else if (z <= -1.2e-146) {
tmp = t_3;
} else if (z <= -5.2e-260) {
tmp = t_1;
} else if (z <= 1.75e-193) {
tmp = t_3;
} else if (z <= 1.82) {
tmp = t_1;
} else {
tmp = t_2;
}
return tmp;
}
def code(x, y, z, t): t_1 = y * (t - x) t_2 = z * (x - t) t_3 = x * (1.0 - y) tmp = 0 if z <= -1.95e-22: tmp = t_2 elif z <= -1.2e-146: tmp = t_3 elif z <= -5.2e-260: tmp = t_1 elif z <= 1.75e-193: tmp = t_3 elif z <= 1.82: tmp = t_1 else: tmp = t_2 return tmp
function code(x, y, z, t) t_1 = Float64(y * Float64(t - x)) t_2 = Float64(z * Float64(x - t)) t_3 = Float64(x * Float64(1.0 - y)) tmp = 0.0 if (z <= -1.95e-22) tmp = t_2; elseif (z <= -1.2e-146) tmp = t_3; elseif (z <= -5.2e-260) tmp = t_1; elseif (z <= 1.75e-193) tmp = t_3; elseif (z <= 1.82) tmp = t_1; else tmp = t_2; end return tmp end
function tmp_2 = code(x, y, z, t) t_1 = y * (t - x); t_2 = z * (x - t); t_3 = x * (1.0 - y); tmp = 0.0; if (z <= -1.95e-22) tmp = t_2; elseif (z <= -1.2e-146) tmp = t_3; elseif (z <= -5.2e-260) tmp = t_1; elseif (z <= 1.75e-193) tmp = t_3; elseif (z <= 1.82) tmp = t_1; else tmp = t_2; 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[(z * N[(x - t), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$3 = N[(x * N[(1.0 - y), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[z, -1.95e-22], t$95$2, If[LessEqual[z, -1.2e-146], t$95$3, If[LessEqual[z, -5.2e-260], t$95$1, If[LessEqual[z, 1.75e-193], t$95$3, If[LessEqual[z, 1.82], t$95$1, t$95$2]]]]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := y \cdot \left(t - x\right)\\
t_2 := z \cdot \left(x - t\right)\\
t_3 := x \cdot \left(1 - y\right)\\
\mathbf{if}\;z \leq -1.95 \cdot 10^{-22}:\\
\;\;\;\;t\_2\\
\mathbf{elif}\;z \leq -1.2 \cdot 10^{-146}:\\
\;\;\;\;t\_3\\
\mathbf{elif}\;z \leq -5.2 \cdot 10^{-260}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;z \leq 1.75 \cdot 10^{-193}:\\
\;\;\;\;t\_3\\
\mathbf{elif}\;z \leq 1.82:\\
\;\;\;\;t\_1\\
\mathbf{else}:\\
\;\;\;\;t\_2\\
\end{array}
\end{array}
if z < -1.94999999999999999e-22 or 1.82000000000000006 < z Initial program 100.0%
Taylor expanded in x around 0 96.1%
fma-define98.4%
+-commutative98.4%
mul-1-neg98.4%
Simplified98.4%
Taylor expanded in z around inf 79.3%
mul-1-neg79.3%
sub-neg79.3%
Simplified79.3%
if -1.94999999999999999e-22 < z < -1.2000000000000001e-146 or -5.19999999999999987e-260 < z < 1.75000000000000002e-193Initial program 100.0%
Taylor expanded in x around inf 79.7%
mul-1-neg79.7%
unsub-neg79.7%
Simplified79.7%
Taylor expanded in y around inf 79.7%
if -1.2000000000000001e-146 < z < -5.19999999999999987e-260 or 1.75000000000000002e-193 < z < 1.82000000000000006Initial program 100.0%
Taylor expanded in x around 0 96.7%
fma-define98.3%
+-commutative98.3%
mul-1-neg98.3%
Simplified98.3%
Taylor expanded in y around inf 73.9%
neg-mul-173.9%
sub-neg73.9%
Simplified73.9%
(FPCore (x y z t)
:precision binary64
(let* ((t_1 (* z (- t))))
(if (<= z -1.7e-22)
t_1
(if (<= z -1.1e-132)
x
(if (<= z -3.4e-251)
(* y t)
(if (<= z 9e-195) x (if (<= z 6.8e+55) (* y t) t_1)))))))
double code(double x, double y, double z, double t) {
double t_1 = z * -t;
double tmp;
if (z <= -1.7e-22) {
tmp = t_1;
} else if (z <= -1.1e-132) {
tmp = x;
} else if (z <= -3.4e-251) {
tmp = y * t;
} else if (z <= 9e-195) {
tmp = x;
} else if (z <= 6.8e+55) {
tmp = 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 = z * -t
if (z <= (-1.7d-22)) then
tmp = t_1
else if (z <= (-1.1d-132)) then
tmp = x
else if (z <= (-3.4d-251)) then
tmp = y * t
else if (z <= 9d-195) then
tmp = x
else if (z <= 6.8d+55) then
tmp = 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 = z * -t;
double tmp;
if (z <= -1.7e-22) {
tmp = t_1;
} else if (z <= -1.1e-132) {
tmp = x;
} else if (z <= -3.4e-251) {
tmp = y * t;
} else if (z <= 9e-195) {
tmp = x;
} else if (z <= 6.8e+55) {
tmp = y * t;
} else {
tmp = t_1;
}
return tmp;
}
def code(x, y, z, t): t_1 = z * -t tmp = 0 if z <= -1.7e-22: tmp = t_1 elif z <= -1.1e-132: tmp = x elif z <= -3.4e-251: tmp = y * t elif z <= 9e-195: tmp = x elif z <= 6.8e+55: tmp = y * t else: tmp = t_1 return tmp
function code(x, y, z, t) t_1 = Float64(z * Float64(-t)) tmp = 0.0 if (z <= -1.7e-22) tmp = t_1; elseif (z <= -1.1e-132) tmp = x; elseif (z <= -3.4e-251) tmp = Float64(y * t); elseif (z <= 9e-195) tmp = x; elseif (z <= 6.8e+55) tmp = Float64(y * t); else tmp = t_1; end return tmp end
function tmp_2 = code(x, y, z, t) t_1 = z * -t; tmp = 0.0; if (z <= -1.7e-22) tmp = t_1; elseif (z <= -1.1e-132) tmp = x; elseif (z <= -3.4e-251) tmp = y * t; elseif (z <= 9e-195) tmp = x; elseif (z <= 6.8e+55) tmp = y * t; else tmp = t_1; end tmp_2 = tmp; end
code[x_, y_, z_, t_] := Block[{t$95$1 = N[(z * (-t)), $MachinePrecision]}, If[LessEqual[z, -1.7e-22], t$95$1, If[LessEqual[z, -1.1e-132], x, If[LessEqual[z, -3.4e-251], N[(y * t), $MachinePrecision], If[LessEqual[z, 9e-195], x, If[LessEqual[z, 6.8e+55], N[(y * t), $MachinePrecision], t$95$1]]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := z \cdot \left(-t\right)\\
\mathbf{if}\;z \leq -1.7 \cdot 10^{-22}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;z \leq -1.1 \cdot 10^{-132}:\\
\;\;\;\;x\\
\mathbf{elif}\;z \leq -3.4 \cdot 10^{-251}:\\
\;\;\;\;y \cdot t\\
\mathbf{elif}\;z \leq 9 \cdot 10^{-195}:\\
\;\;\;\;x\\
\mathbf{elif}\;z \leq 6.8 \cdot 10^{+55}:\\
\;\;\;\;y \cdot t\\
\mathbf{else}:\\
\;\;\;\;t\_1\\
\end{array}
\end{array}
if z < -1.6999999999999999e-22 or 6.7999999999999996e55 < z Initial program 100.0%
Taylor expanded in x around 0 95.8%
fma-define98.3%
+-commutative98.3%
mul-1-neg98.3%
Simplified98.3%
Taylor expanded in z around inf 82.0%
mul-1-neg82.0%
sub-neg82.0%
Simplified82.0%
Taylor expanded in x around 0 48.9%
mul-1-neg48.9%
*-commutative48.9%
distribute-rgt-neg-in48.9%
Simplified48.9%
if -1.6999999999999999e-22 < z < -1.09999999999999995e-132 or -3.40000000000000017e-251 < z < 9e-195Initial program 100.0%
Taylor expanded in y around inf 95.7%
*-commutative95.7%
Simplified95.7%
Taylor expanded in y around 0 47.5%
if -1.09999999999999995e-132 < z < -3.40000000000000017e-251 or 9e-195 < z < 6.7999999999999996e55Initial program 99.9%
Taylor expanded in x around 0 97.0%
fma-define98.4%
+-commutative98.4%
mul-1-neg98.4%
Simplified98.4%
Taylor expanded in t around inf 55.6%
Taylor expanded in y around inf 48.4%
Final simplification48.4%
(FPCore (x y z t)
:precision binary64
(if (<= z -3.05e+16)
(* z x)
(if (<= z -2.9e-133)
x
(if (<= z -1.9e-251)
(* y t)
(if (<= z 3e-194) x (if (<= z 7.2e+55) (* y t) (* z x)))))))
double code(double x, double y, double z, double t) {
double tmp;
if (z <= -3.05e+16) {
tmp = z * x;
} else if (z <= -2.9e-133) {
tmp = x;
} else if (z <= -1.9e-251) {
tmp = y * t;
} else if (z <= 3e-194) {
tmp = x;
} else if (z <= 7.2e+55) {
tmp = y * t;
} 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) :: tmp
if (z <= (-3.05d+16)) then
tmp = z * x
else if (z <= (-2.9d-133)) then
tmp = x
else if (z <= (-1.9d-251)) then
tmp = y * t
else if (z <= 3d-194) then
tmp = x
else if (z <= 7.2d+55) then
tmp = y * t
else
tmp = z * x
end if
code = tmp
end function
public static double code(double x, double y, double z, double t) {
double tmp;
if (z <= -3.05e+16) {
tmp = z * x;
} else if (z <= -2.9e-133) {
tmp = x;
} else if (z <= -1.9e-251) {
tmp = y * t;
} else if (z <= 3e-194) {
tmp = x;
} else if (z <= 7.2e+55) {
tmp = y * t;
} else {
tmp = z * x;
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if z <= -3.05e+16: tmp = z * x elif z <= -2.9e-133: tmp = x elif z <= -1.9e-251: tmp = y * t elif z <= 3e-194: tmp = x elif z <= 7.2e+55: tmp = y * t else: tmp = z * x return tmp
function code(x, y, z, t) tmp = 0.0 if (z <= -3.05e+16) tmp = Float64(z * x); elseif (z <= -2.9e-133) tmp = x; elseif (z <= -1.9e-251) tmp = Float64(y * t); elseif (z <= 3e-194) tmp = x; elseif (z <= 7.2e+55) tmp = Float64(y * t); else tmp = Float64(z * x); end return tmp end
function tmp_2 = code(x, y, z, t) tmp = 0.0; if (z <= -3.05e+16) tmp = z * x; elseif (z <= -2.9e-133) tmp = x; elseif (z <= -1.9e-251) tmp = y * t; elseif (z <= 3e-194) tmp = x; elseif (z <= 7.2e+55) tmp = y * t; else tmp = z * x; end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[LessEqual[z, -3.05e+16], N[(z * x), $MachinePrecision], If[LessEqual[z, -2.9e-133], x, If[LessEqual[z, -1.9e-251], N[(y * t), $MachinePrecision], If[LessEqual[z, 3e-194], x, If[LessEqual[z, 7.2e+55], N[(y * t), $MachinePrecision], N[(z * x), $MachinePrecision]]]]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \leq -3.05 \cdot 10^{+16}:\\
\;\;\;\;z \cdot x\\
\mathbf{elif}\;z \leq -2.9 \cdot 10^{-133}:\\
\;\;\;\;x\\
\mathbf{elif}\;z \leq -1.9 \cdot 10^{-251}:\\
\;\;\;\;y \cdot t\\
\mathbf{elif}\;z \leq 3 \cdot 10^{-194}:\\
\;\;\;\;x\\
\mathbf{elif}\;z \leq 7.2 \cdot 10^{+55}:\\
\;\;\;\;y \cdot t\\
\mathbf{else}:\\
\;\;\;\;z \cdot x\\
\end{array}
\end{array}
if z < -3.05e16 or 7.19999999999999975e55 < z Initial program 100.0%
Taylor expanded in x around 0 95.6%
fma-define98.2%
+-commutative98.2%
mul-1-neg98.2%
Simplified98.2%
Taylor expanded in z around inf 82.8%
mul-1-neg82.8%
sub-neg82.8%
Simplified82.8%
Taylor expanded in x around inf 43.2%
*-commutative43.2%
Simplified43.2%
if -3.05e16 < z < -2.8999999999999998e-133 or -1.8999999999999999e-251 < z < 3e-194Initial program 100.0%
Taylor expanded in y around inf 90.9%
*-commutative90.9%
Simplified90.9%
Taylor expanded in y around 0 44.7%
if -2.8999999999999998e-133 < z < -1.8999999999999999e-251 or 3e-194 < z < 7.19999999999999975e55Initial program 99.9%
Taylor expanded in x around 0 97.0%
fma-define98.4%
+-commutative98.4%
mul-1-neg98.4%
Simplified98.4%
Taylor expanded in t around inf 55.6%
Taylor expanded in y around inf 48.4%
Final simplification45.0%
(FPCore (x y z t) :precision binary64 (if (or (<= (- y z) -7e-44) (not (<= (- y z) 1e-22))) (* (- y z) t) x))
double code(double x, double y, double z, double t) {
double tmp;
if (((y - z) <= -7e-44) || !((y - z) <= 1e-22)) {
tmp = (y - z) * t;
} else {
tmp = x;
}
return tmp;
}
real(8) function code(x, y, z, t)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
real(8) :: tmp
if (((y - z) <= (-7d-44)) .or. (.not. ((y - z) <= 1d-22))) then
tmp = (y - z) * t
else
tmp = x
end if
code = tmp
end function
public static double code(double x, double y, double z, double t) {
double tmp;
if (((y - z) <= -7e-44) || !((y - z) <= 1e-22)) {
tmp = (y - z) * t;
} else {
tmp = x;
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if ((y - z) <= -7e-44) or not ((y - z) <= 1e-22): tmp = (y - z) * t else: tmp = x return tmp
function code(x, y, z, t) tmp = 0.0 if ((Float64(y - z) <= -7e-44) || !(Float64(y - z) <= 1e-22)) tmp = Float64(Float64(y - z) * t); else tmp = x; end return tmp end
function tmp_2 = code(x, y, z, t) tmp = 0.0; if (((y - z) <= -7e-44) || ~(((y - z) <= 1e-22))) tmp = (y - z) * t; else tmp = x; end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[Or[LessEqual[N[(y - z), $MachinePrecision], -7e-44], N[Not[LessEqual[N[(y - z), $MachinePrecision], 1e-22]], $MachinePrecision]], N[(N[(y - z), $MachinePrecision] * t), $MachinePrecision], x]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;y - z \leq -7 \cdot 10^{-44} \lor \neg \left(y - z \leq 10^{-22}\right):\\
\;\;\;\;\left(y - z\right) \cdot t\\
\mathbf{else}:\\
\;\;\;\;x\\
\end{array}
\end{array}
if (-.f64 y z) < -6.9999999999999995e-44 or 1e-22 < (-.f64 y z) Initial program 100.0%
Taylor expanded in x around 0 96.6%
fma-define98.5%
+-commutative98.5%
mul-1-neg98.5%
Simplified98.5%
Taylor expanded in t around inf 54.3%
if -6.9999999999999995e-44 < (-.f64 y z) < 1e-22Initial program 100.0%
Taylor expanded in y around inf 92.1%
*-commutative92.1%
Simplified92.1%
Taylor expanded in y around 0 78.0%
Final simplification58.7%
(FPCore (x y z t) :precision binary64 (if (or (<= z -1.9e-22) (not (<= z 0.0175))) (+ x (* z (- x t))) (+ x (* y (- t x)))))
double code(double x, double y, double z, double t) {
double tmp;
if ((z <= -1.9e-22) || !(z <= 0.0175)) {
tmp = x + (z * (x - t));
} 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 <= (-1.9d-22)) .or. (.not. (z <= 0.0175d0))) then
tmp = x + (z * (x - t))
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 <= -1.9e-22) || !(z <= 0.0175)) {
tmp = x + (z * (x - t));
} else {
tmp = x + (y * (t - x));
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if (z <= -1.9e-22) or not (z <= 0.0175): tmp = x + (z * (x - t)) else: tmp = x + (y * (t - x)) return tmp
function code(x, y, z, t) tmp = 0.0 if ((z <= -1.9e-22) || !(z <= 0.0175)) tmp = Float64(x + Float64(z * Float64(x - t))); 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 <= -1.9e-22) || ~((z <= 0.0175))) tmp = x + (z * (x - t)); else tmp = x + (y * (t - x)); end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[Or[LessEqual[z, -1.9e-22], N[Not[LessEqual[z, 0.0175]], $MachinePrecision]], N[(x + N[(z * N[(x - t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(x + N[(y * N[(t - x), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \leq -1.9 \cdot 10^{-22} \lor \neg \left(z \leq 0.0175\right):\\
\;\;\;\;x + z \cdot \left(x - t\right)\\
\mathbf{else}:\\
\;\;\;\;x + y \cdot \left(t - x\right)\\
\end{array}
\end{array}
if z < -1.90000000000000012e-22 or 0.017500000000000002 < z Initial program 100.0%
Taylor expanded in y around 0 81.2%
mul-1-neg81.2%
unsub-neg81.2%
Simplified81.2%
if -1.90000000000000012e-22 < z < 0.017500000000000002Initial program 100.0%
Taylor expanded in y around inf 95.4%
*-commutative95.4%
Simplified95.4%
Final simplification88.2%
(FPCore (x y z t) :precision binary64 (if (or (<= z -1.95e-22) (not (<= z 1.95))) (* z (- x t)) (+ x (* y (- t x)))))
double code(double x, double y, double z, double t) {
double tmp;
if ((z <= -1.95e-22) || !(z <= 1.95)) {
tmp = z * (x - t);
} 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 <= (-1.95d-22)) .or. (.not. (z <= 1.95d0))) then
tmp = z * (x - t)
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 <= -1.95e-22) || !(z <= 1.95)) {
tmp = z * (x - t);
} else {
tmp = x + (y * (t - x));
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if (z <= -1.95e-22) or not (z <= 1.95): tmp = z * (x - t) else: tmp = x + (y * (t - x)) return tmp
function code(x, y, z, t) tmp = 0.0 if ((z <= -1.95e-22) || !(z <= 1.95)) tmp = Float64(z * Float64(x - t)); 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 <= -1.95e-22) || ~((z <= 1.95))) tmp = z * (x - t); else tmp = x + (y * (t - x)); end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[Or[LessEqual[z, -1.95e-22], N[Not[LessEqual[z, 1.95]], $MachinePrecision]], N[(z * N[(x - t), $MachinePrecision]), $MachinePrecision], N[(x + N[(y * N[(t - x), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \leq -1.95 \cdot 10^{-22} \lor \neg \left(z \leq 1.95\right):\\
\;\;\;\;z \cdot \left(x - t\right)\\
\mathbf{else}:\\
\;\;\;\;x + y \cdot \left(t - x\right)\\
\end{array}
\end{array}
if z < -1.94999999999999999e-22 or 1.94999999999999996 < z Initial program 100.0%
Taylor expanded in x around 0 96.1%
fma-define98.4%
+-commutative98.4%
mul-1-neg98.4%
Simplified98.4%
Taylor expanded in z around inf 79.3%
mul-1-neg79.3%
sub-neg79.3%
Simplified79.3%
if -1.94999999999999999e-22 < z < 1.94999999999999996Initial program 100.0%
Taylor expanded in y around inf 95.4%
*-commutative95.4%
Simplified95.4%
Final simplification87.2%
(FPCore (x y z t) :precision binary64 (if (or (<= x -1.2e-19) (not (<= x 6.4e-125))) (* x (+ (- z y) 1.0)) (* (- y z) t)))
double code(double x, double y, double z, double t) {
double tmp;
if ((x <= -1.2e-19) || !(x <= 6.4e-125)) {
tmp = x * ((z - y) + 1.0);
} else {
tmp = (y - z) * t;
}
return tmp;
}
real(8) function code(x, y, z, t)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
real(8) :: tmp
if ((x <= (-1.2d-19)) .or. (.not. (x <= 6.4d-125))) then
tmp = x * ((z - y) + 1.0d0)
else
tmp = (y - z) * t
end if
code = tmp
end function
public static double code(double x, double y, double z, double t) {
double tmp;
if ((x <= -1.2e-19) || !(x <= 6.4e-125)) {
tmp = x * ((z - y) + 1.0);
} else {
tmp = (y - z) * t;
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if (x <= -1.2e-19) or not (x <= 6.4e-125): tmp = x * ((z - y) + 1.0) else: tmp = (y - z) * t return tmp
function code(x, y, z, t) tmp = 0.0 if ((x <= -1.2e-19) || !(x <= 6.4e-125)) tmp = Float64(x * Float64(Float64(z - y) + 1.0)); else tmp = Float64(Float64(y - z) * t); end return tmp end
function tmp_2 = code(x, y, z, t) tmp = 0.0; if ((x <= -1.2e-19) || ~((x <= 6.4e-125))) tmp = x * ((z - y) + 1.0); else tmp = (y - z) * t; end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[Or[LessEqual[x, -1.2e-19], N[Not[LessEqual[x, 6.4e-125]], $MachinePrecision]], N[(x * N[(N[(z - y), $MachinePrecision] + 1.0), $MachinePrecision]), $MachinePrecision], N[(N[(y - z), $MachinePrecision] * t), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x \leq -1.2 \cdot 10^{-19} \lor \neg \left(x \leq 6.4 \cdot 10^{-125}\right):\\
\;\;\;\;x \cdot \left(\left(z - y\right) + 1\right)\\
\mathbf{else}:\\
\;\;\;\;\left(y - z\right) \cdot t\\
\end{array}
\end{array}
if x < -1.20000000000000011e-19 or 6.3999999999999997e-125 < x Initial program 100.0%
Taylor expanded in x around inf 78.3%
mul-1-neg78.3%
unsub-neg78.3%
Simplified78.3%
if -1.20000000000000011e-19 < x < 6.3999999999999997e-125Initial program 100.0%
Taylor expanded in x around 0 99.9%
fma-define99.9%
+-commutative99.9%
mul-1-neg99.9%
Simplified99.9%
Taylor expanded in t around inf 78.0%
Final simplification78.2%
(FPCore (x y z t) :precision binary64 (if (or (<= z -1.95e-22) (not (<= z 3.5e-7))) (* z (- x t)) (+ x (* y t))))
double code(double x, double y, double z, double t) {
double tmp;
if ((z <= -1.95e-22) || !(z <= 3.5e-7)) {
tmp = z * (x - t);
} 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 ((z <= (-1.95d-22)) .or. (.not. (z <= 3.5d-7))) then
tmp = z * (x - t)
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 ((z <= -1.95e-22) || !(z <= 3.5e-7)) {
tmp = z * (x - t);
} else {
tmp = x + (y * t);
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if (z <= -1.95e-22) or not (z <= 3.5e-7): tmp = z * (x - t) else: tmp = x + (y * t) return tmp
function code(x, y, z, t) tmp = 0.0 if ((z <= -1.95e-22) || !(z <= 3.5e-7)) tmp = Float64(z * Float64(x - t)); else tmp = Float64(x + Float64(y * t)); end return tmp end
function tmp_2 = code(x, y, z, t) tmp = 0.0; if ((z <= -1.95e-22) || ~((z <= 3.5e-7))) tmp = z * (x - t); else tmp = x + (y * t); end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[Or[LessEqual[z, -1.95e-22], N[Not[LessEqual[z, 3.5e-7]], $MachinePrecision]], N[(z * N[(x - t), $MachinePrecision]), $MachinePrecision], N[(x + N[(y * t), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \leq -1.95 \cdot 10^{-22} \lor \neg \left(z \leq 3.5 \cdot 10^{-7}\right):\\
\;\;\;\;z \cdot \left(x - t\right)\\
\mathbf{else}:\\
\;\;\;\;x + y \cdot t\\
\end{array}
\end{array}
if z < -1.94999999999999999e-22 or 3.49999999999999984e-7 < z Initial program 100.0%
Taylor expanded in x around 0 95.4%
fma-define98.4%
+-commutative98.4%
mul-1-neg98.4%
Simplified98.4%
Taylor expanded in z around inf 78.7%
mul-1-neg78.7%
sub-neg78.7%
Simplified78.7%
if -1.94999999999999999e-22 < z < 3.49999999999999984e-7Initial program 100.0%
Taylor expanded in y around inf 95.4%
*-commutative95.4%
Simplified95.4%
Taylor expanded in t around inf 68.7%
*-commutative68.7%
Simplified68.7%
Final simplification73.8%
(FPCore (x y z t) :precision binary64 (if (or (<= t -9.0) (not (<= t 1.1e-73))) (* (- y z) t) (* x (- 1.0 y))))
double code(double x, double y, double z, double t) {
double tmp;
if ((t <= -9.0) || !(t <= 1.1e-73)) {
tmp = (y - z) * t;
} else {
tmp = x * (1.0 - y);
}
return tmp;
}
real(8) function code(x, y, z, t)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
real(8) :: tmp
if ((t <= (-9.0d0)) .or. (.not. (t <= 1.1d-73))) then
tmp = (y - z) * t
else
tmp = x * (1.0d0 - y)
end if
code = tmp
end function
public static double code(double x, double y, double z, double t) {
double tmp;
if ((t <= -9.0) || !(t <= 1.1e-73)) {
tmp = (y - z) * t;
} else {
tmp = x * (1.0 - y);
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if (t <= -9.0) or not (t <= 1.1e-73): tmp = (y - z) * t else: tmp = x * (1.0 - y) return tmp
function code(x, y, z, t) tmp = 0.0 if ((t <= -9.0) || !(t <= 1.1e-73)) tmp = Float64(Float64(y - z) * t); else tmp = Float64(x * Float64(1.0 - y)); end return tmp end
function tmp_2 = code(x, y, z, t) tmp = 0.0; if ((t <= -9.0) || ~((t <= 1.1e-73))) tmp = (y - z) * t; else tmp = x * (1.0 - y); end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[Or[LessEqual[t, -9.0], N[Not[LessEqual[t, 1.1e-73]], $MachinePrecision]], N[(N[(y - z), $MachinePrecision] * t), $MachinePrecision], N[(x * N[(1.0 - y), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;t \leq -9 \lor \neg \left(t \leq 1.1 \cdot 10^{-73}\right):\\
\;\;\;\;\left(y - z\right) \cdot t\\
\mathbf{else}:\\
\;\;\;\;x \cdot \left(1 - y\right)\\
\end{array}
\end{array}
if t < -9 or 1.1e-73 < t Initial program 100.0%
Taylor expanded in x around 0 95.5%
fma-define98.1%
+-commutative98.1%
mul-1-neg98.1%
Simplified98.1%
Taylor expanded in t around inf 69.7%
if -9 < t < 1.1e-73Initial program 100.0%
Taylor expanded in x around inf 81.5%
mul-1-neg81.5%
unsub-neg81.5%
Simplified81.5%
Taylor expanded in y around inf 58.0%
Final simplification65.1%
(FPCore (x y z t) :precision binary64 (if (or (<= y -7.5e-44) (not (<= y 3.6e-32))) (* y t) x))
double code(double x, double y, double z, double t) {
double tmp;
if ((y <= -7.5e-44) || !(y <= 3.6e-32)) {
tmp = y * t;
} else {
tmp = x;
}
return tmp;
}
real(8) function code(x, y, z, t)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
real(8) :: tmp
if ((y <= (-7.5d-44)) .or. (.not. (y <= 3.6d-32))) then
tmp = y * t
else
tmp = x
end if
code = tmp
end function
public static double code(double x, double y, double z, double t) {
double tmp;
if ((y <= -7.5e-44) || !(y <= 3.6e-32)) {
tmp = y * t;
} else {
tmp = x;
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if (y <= -7.5e-44) or not (y <= 3.6e-32): tmp = y * t else: tmp = x return tmp
function code(x, y, z, t) tmp = 0.0 if ((y <= -7.5e-44) || !(y <= 3.6e-32)) tmp = Float64(y * t); else tmp = x; end return tmp end
function tmp_2 = code(x, y, z, t) tmp = 0.0; if ((y <= -7.5e-44) || ~((y <= 3.6e-32))) tmp = y * t; else tmp = x; end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[Or[LessEqual[y, -7.5e-44], N[Not[LessEqual[y, 3.6e-32]], $MachinePrecision]], N[(y * t), $MachinePrecision], x]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;y \leq -7.5 \cdot 10^{-44} \lor \neg \left(y \leq 3.6 \cdot 10^{-32}\right):\\
\;\;\;\;y \cdot t\\
\mathbf{else}:\\
\;\;\;\;x\\
\end{array}
\end{array}
if y < -7.50000000000000008e-44 or 3.59999999999999993e-32 < y Initial program 100.0%
Taylor expanded in x around 0 95.9%
fma-define97.9%
+-commutative97.9%
mul-1-neg97.9%
Simplified97.9%
Taylor expanded in t around inf 54.7%
Taylor expanded in y around inf 40.6%
if -7.50000000000000008e-44 < y < 3.59999999999999993e-32Initial program 100.0%
Taylor expanded in y around inf 43.6%
*-commutative43.6%
Simplified43.6%
Taylor expanded in y around 0 38.2%
Final simplification39.6%
(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%
(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 inf 61.6%
*-commutative61.6%
Simplified61.6%
Taylor expanded in y around 0 18.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 2024137
(FPCore (x y z t)
:name "Data.Metrics.Snapshot:quantile from metrics-0.3.0.2"
:precision binary64
:alt
(! :herbie-platform default (+ x (+ (* t (- y z)) (* (- x) (- y z)))))
(+ x (* (- y z) (- t x))))