
(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 15 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 z around 0 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 -6.5e-23)
t_1
(if (<= z -6.2e-133)
x
(if (<= z -3.2e-251)
(* y t)
(if (<= z 1.4e-193) x (if (<= z 2.8e+61) (* y t) t_1)))))))
double code(double x, double y, double z, double t) {
double t_1 = z * -t;
double tmp;
if (z <= -6.5e-23) {
tmp = t_1;
} else if (z <= -6.2e-133) {
tmp = x;
} else if (z <= -3.2e-251) {
tmp = y * t;
} else if (z <= 1.4e-193) {
tmp = x;
} else if (z <= 2.8e+61) {
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 <= (-6.5d-23)) then
tmp = t_1
else if (z <= (-6.2d-133)) then
tmp = x
else if (z <= (-3.2d-251)) then
tmp = y * t
else if (z <= 1.4d-193) then
tmp = x
else if (z <= 2.8d+61) 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 <= -6.5e-23) {
tmp = t_1;
} else if (z <= -6.2e-133) {
tmp = x;
} else if (z <= -3.2e-251) {
tmp = y * t;
} else if (z <= 1.4e-193) {
tmp = x;
} else if (z <= 2.8e+61) {
tmp = y * t;
} else {
tmp = t_1;
}
return tmp;
}
def code(x, y, z, t): t_1 = z * -t tmp = 0 if z <= -6.5e-23: tmp = t_1 elif z <= -6.2e-133: tmp = x elif z <= -3.2e-251: tmp = y * t elif z <= 1.4e-193: tmp = x elif z <= 2.8e+61: 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 <= -6.5e-23) tmp = t_1; elseif (z <= -6.2e-133) tmp = x; elseif (z <= -3.2e-251) tmp = Float64(y * t); elseif (z <= 1.4e-193) tmp = x; elseif (z <= 2.8e+61) 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 <= -6.5e-23) tmp = t_1; elseif (z <= -6.2e-133) tmp = x; elseif (z <= -3.2e-251) tmp = y * t; elseif (z <= 1.4e-193) tmp = x; elseif (z <= 2.8e+61) 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, -6.5e-23], t$95$1, If[LessEqual[z, -6.2e-133], x, If[LessEqual[z, -3.2e-251], N[(y * t), $MachinePrecision], If[LessEqual[z, 1.4e-193], x, If[LessEqual[z, 2.8e+61], N[(y * t), $MachinePrecision], t$95$1]]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := z \cdot \left(-t\right)\\
\mathbf{if}\;z \leq -6.5 \cdot 10^{-23}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;z \leq -6.2 \cdot 10^{-133}:\\
\;\;\;\;x\\
\mathbf{elif}\;z \leq -3.2 \cdot 10^{-251}:\\
\;\;\;\;y \cdot t\\
\mathbf{elif}\;z \leq 1.4 \cdot 10^{-193}:\\
\;\;\;\;x\\
\mathbf{elif}\;z \leq 2.8 \cdot 10^{+61}:\\
\;\;\;\;y \cdot t\\
\mathbf{else}:\\
\;\;\;\;t\_1\\
\end{array}
\end{array}
if z < -6.5e-23 or 2.8000000000000001e61 < 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 t around inf 56.3%
Taylor expanded in y around 0 48.9%
mul-1-neg48.9%
*-commutative48.9%
distribute-rgt-neg-in48.9%
Simplified48.9%
if -6.5e-23 < z < -6.20000000000000032e-133 or -3.19999999999999982e-251 < z < 1.4000000000000001e-193Initial program 100.0%
Taylor expanded in y around inf 95.7%
*-commutative95.7%
Simplified95.7%
Taylor expanded in y around 0 47.5%
if -6.20000000000000032e-133 < z < -3.19999999999999982e-251 or 1.4000000000000001e-193 < z < 2.8000000000000001e61Initial 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 y around inf 70.2%
neg-mul-170.2%
sub-neg70.2%
Simplified70.2%
Taylor expanded in t around inf 48.4%
(FPCore (x y z t)
:precision binary64
(if (<= z -3.05e+16)
(* z x)
(if (<= z -3.15e-133)
x
(if (<= z -3.1e-251)
(* y t)
(if (<= z 2e-193) x (if (<= z 7.8e+64) (* 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 <= -3.15e-133) {
tmp = x;
} else if (z <= -3.1e-251) {
tmp = y * t;
} else if (z <= 2e-193) {
tmp = x;
} else if (z <= 7.8e+64) {
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 <= (-3.15d-133)) then
tmp = x
else if (z <= (-3.1d-251)) then
tmp = y * t
else if (z <= 2d-193) then
tmp = x
else if (z <= 7.8d+64) 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 <= -3.15e-133) {
tmp = x;
} else if (z <= -3.1e-251) {
tmp = y * t;
} else if (z <= 2e-193) {
tmp = x;
} else if (z <= 7.8e+64) {
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 <= -3.15e-133: tmp = x elif z <= -3.1e-251: tmp = y * t elif z <= 2e-193: tmp = x elif z <= 7.8e+64: 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 <= -3.15e-133) tmp = x; elseif (z <= -3.1e-251) tmp = Float64(y * t); elseif (z <= 2e-193) tmp = x; elseif (z <= 7.8e+64) 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 <= -3.15e-133) tmp = x; elseif (z <= -3.1e-251) tmp = y * t; elseif (z <= 2e-193) tmp = x; elseif (z <= 7.8e+64) 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, -3.15e-133], x, If[LessEqual[z, -3.1e-251], N[(y * t), $MachinePrecision], If[LessEqual[z, 2e-193], x, If[LessEqual[z, 7.8e+64], 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 -3.15 \cdot 10^{-133}:\\
\;\;\;\;x\\
\mathbf{elif}\;z \leq -3.1 \cdot 10^{-251}:\\
\;\;\;\;y \cdot t\\
\mathbf{elif}\;z \leq 2 \cdot 10^{-193}:\\
\;\;\;\;x\\
\mathbf{elif}\;z \leq 7.8 \cdot 10^{+64}:\\
\;\;\;\;y \cdot t\\
\mathbf{else}:\\
\;\;\;\;z \cdot x\\
\end{array}
\end{array}
if z < -3.05e16 or 7.7999999999999996e64 < z Initial program 100.0%
Taylor expanded in x around inf 53.3%
mul-1-neg53.3%
unsub-neg53.3%
Simplified53.3%
Taylor expanded in z around inf 43.2%
if -3.05e16 < z < -3.1500000000000001e-133 or -3.10000000000000003e-251 < z < 2.0000000000000001e-193Initial program 100.0%
Taylor expanded in y around inf 90.9%
*-commutative90.9%
Simplified90.9%
Taylor expanded in y around 0 44.7%
if -3.1500000000000001e-133 < z < -3.10000000000000003e-251 or 2.0000000000000001e-193 < z < 7.7999999999999996e64Initial 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 y around inf 70.2%
neg-mul-170.2%
sub-neg70.2%
Simplified70.2%
Taylor expanded in t 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 (- x t)))))
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 * (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 <= (-1.9d-22)) .or. (.not. (z <= 0.0175d0))) 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 <= -1.9e-22) || !(z <= 0.0175)) {
tmp = x + (z * (x - t));
} else {
tmp = x - (y * (x - t));
}
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 * (x - t)) 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(x - t))); 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 * (x - t)); 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[(x - t), $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(x - t\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 (- x t)))))
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 * (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 <= (-1.95d-22)) .or. (.not. (z <= 1.95d0))) then
tmp = 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 <= -1.95e-22) || !(z <= 1.95)) {
tmp = z * (x - t);
} else {
tmp = x - (y * (x - t));
}
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 * (x - t)) 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(x - t))); 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 * (x - t)); 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[(x - t), $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(x - t\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 (<= y -7.5e-44) (not (<= y 3.7e-31))) (* y (- t x)) (* x (+ z 1.0))))
double code(double x, double y, double z, double t) {
double tmp;
if ((y <= -7.5e-44) || !(y <= 3.7e-31)) {
tmp = y * (t - x);
} 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 ((y <= (-7.5d-44)) .or. (.not. (y <= 3.7d-31))) then
tmp = y * (t - x)
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 ((y <= -7.5e-44) || !(y <= 3.7e-31)) {
tmp = y * (t - x);
} else {
tmp = x * (z + 1.0);
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if (y <= -7.5e-44) or not (y <= 3.7e-31): tmp = y * (t - x) else: tmp = x * (z + 1.0) return tmp
function code(x, y, z, t) tmp = 0.0 if ((y <= -7.5e-44) || !(y <= 3.7e-31)) tmp = Float64(y * Float64(t - x)); else tmp = Float64(x * Float64(z + 1.0)); end return tmp end
function tmp_2 = code(x, y, z, t) tmp = 0.0; if ((y <= -7.5e-44) || ~((y <= 3.7e-31))) tmp = y * (t - x); else tmp = x * (z + 1.0); end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[Or[LessEqual[y, -7.5e-44], N[Not[LessEqual[y, 3.7e-31]], $MachinePrecision]], N[(y * N[(t - x), $MachinePrecision]), $MachinePrecision], N[(x * N[(z + 1.0), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;y \leq -7.5 \cdot 10^{-44} \lor \neg \left(y \leq 3.7 \cdot 10^{-31}\right):\\
\;\;\;\;y \cdot \left(t - x\right)\\
\mathbf{else}:\\
\;\;\;\;x \cdot \left(z + 1\right)\\
\end{array}
\end{array}
if y < -7.50000000000000008e-44 or 3.6999999999999998e-31 < 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 y around inf 70.9%
neg-mul-170.9%
sub-neg70.9%
Simplified70.9%
if -7.50000000000000008e-44 < y < 3.6999999999999998e-31Initial program 100.0%
Taylor expanded in x around inf 66.0%
mul-1-neg66.0%
unsub-neg66.0%
Simplified66.0%
Taylor expanded in y around 0 66.0%
Final simplification68.9%
(FPCore (x y z t) :precision binary64 (if (or (<= x -2.15e+99) (not (<= x 4.4e+57))) (* x (+ z 1.0)) (* (- y z) t)))
double code(double x, double y, double z, double t) {
double tmp;
if ((x <= -2.15e+99) || !(x <= 4.4e+57)) {
tmp = x * (z + 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 <= (-2.15d+99)) .or. (.not. (x <= 4.4d+57))) then
tmp = x * (z + 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 <= -2.15e+99) || !(x <= 4.4e+57)) {
tmp = x * (z + 1.0);
} else {
tmp = (y - z) * t;
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if (x <= -2.15e+99) or not (x <= 4.4e+57): tmp = x * (z + 1.0) else: tmp = (y - z) * t return tmp
function code(x, y, z, t) tmp = 0.0 if ((x <= -2.15e+99) || !(x <= 4.4e+57)) tmp = Float64(x * Float64(z + 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 <= -2.15e+99) || ~((x <= 4.4e+57))) tmp = x * (z + 1.0); else tmp = (y - z) * t; end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[Or[LessEqual[x, -2.15e+99], N[Not[LessEqual[x, 4.4e+57]], $MachinePrecision]], N[(x * N[(z + 1.0), $MachinePrecision]), $MachinePrecision], N[(N[(y - z), $MachinePrecision] * t), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x \leq -2.15 \cdot 10^{+99} \lor \neg \left(x \leq 4.4 \cdot 10^{+57}\right):\\
\;\;\;\;x \cdot \left(z + 1\right)\\
\mathbf{else}:\\
\;\;\;\;\left(y - z\right) \cdot t\\
\end{array}
\end{array}
if x < -2.1500000000000001e99 or 4.4000000000000001e57 < x Initial program 100.0%
Taylor expanded in x around inf 89.7%
mul-1-neg89.7%
unsub-neg89.7%
Simplified89.7%
Taylor expanded in y around 0 66.2%
if -2.1500000000000001e99 < x < 4.4000000000000001e57Initial program 100.0%
Taylor expanded in x around 0 99.3%
fma-define99.3%
+-commutative99.3%
mul-1-neg99.3%
Simplified99.3%
Taylor expanded in t around inf 65.7%
Final simplification65.9%
(FPCore (x y z t) :precision binary64 (if (<= x -9.5e+99) (* x (+ z 1.0)) (if (<= x 6.2e+72) (* (- y z) t) (* x (- 1.0 y)))))
double code(double x, double y, double z, double t) {
double tmp;
if (x <= -9.5e+99) {
tmp = x * (z + 1.0);
} else if (x <= 6.2e+72) {
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 (x <= (-9.5d+99)) then
tmp = x * (z + 1.0d0)
else if (x <= 6.2d+72) 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 (x <= -9.5e+99) {
tmp = x * (z + 1.0);
} else if (x <= 6.2e+72) {
tmp = (y - z) * t;
} else {
tmp = x * (1.0 - y);
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if x <= -9.5e+99: tmp = x * (z + 1.0) elif x <= 6.2e+72: tmp = (y - z) * t else: tmp = x * (1.0 - y) return tmp
function code(x, y, z, t) tmp = 0.0 if (x <= -9.5e+99) tmp = Float64(x * Float64(z + 1.0)); elseif (x <= 6.2e+72) 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 (x <= -9.5e+99) tmp = x * (z + 1.0); elseif (x <= 6.2e+72) tmp = (y - z) * t; else tmp = x * (1.0 - y); end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[LessEqual[x, -9.5e+99], N[(x * N[(z + 1.0), $MachinePrecision]), $MachinePrecision], If[LessEqual[x, 6.2e+72], N[(N[(y - z), $MachinePrecision] * t), $MachinePrecision], N[(x * N[(1.0 - y), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x \leq -9.5 \cdot 10^{+99}:\\
\;\;\;\;x \cdot \left(z + 1\right)\\
\mathbf{elif}\;x \leq 6.2 \cdot 10^{+72}:\\
\;\;\;\;\left(y - z\right) \cdot t\\
\mathbf{else}:\\
\;\;\;\;x \cdot \left(1 - y\right)\\
\end{array}
\end{array}
if x < -9.49999999999999908e99Initial program 100.0%
Taylor expanded in x around inf 93.6%
mul-1-neg93.6%
unsub-neg93.6%
Simplified93.6%
Taylor expanded in y around 0 71.4%
if -9.49999999999999908e99 < x < 6.19999999999999977e72Initial program 100.0%
Taylor expanded in x around 0 99.3%
fma-define99.3%
+-commutative99.3%
mul-1-neg99.3%
Simplified99.3%
Taylor expanded in t around inf 65.5%
if 6.19999999999999977e72 < x Initial program 100.0%
Taylor expanded in x around inf 87.8%
mul-1-neg87.8%
unsub-neg87.8%
Simplified87.8%
Taylor expanded in z around 0 65.5%
Final simplification66.6%
(FPCore (x y z t) :precision binary64 (if (or (<= z -3.05e+16) (not (<= z 1.0))) (* z x) x))
double code(double x, double y, double z, double t) {
double tmp;
if ((z <= -3.05e+16) || !(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 <= (-3.05d+16)) .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 <= -3.05e+16) || !(z <= 1.0)) {
tmp = z * x;
} else {
tmp = x;
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if (z <= -3.05e+16) or not (z <= 1.0): tmp = z * x else: tmp = x return tmp
function code(x, y, z, t) tmp = 0.0 if ((z <= -3.05e+16) || !(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 <= -3.05e+16) || ~((z <= 1.0))) tmp = z * x; else tmp = x; end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[Or[LessEqual[z, -3.05e+16], N[Not[LessEqual[z, 1.0]], $MachinePrecision]], N[(z * x), $MachinePrecision], x]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \leq -3.05 \cdot 10^{+16} \lor \neg \left(z \leq 1\right):\\
\;\;\;\;z \cdot x\\
\mathbf{else}:\\
\;\;\;\;x\\
\end{array}
\end{array}
if z < -3.05e16 or 1 < z Initial program 100.0%
Taylor expanded in x around inf 52.2%
mul-1-neg52.2%
unsub-neg52.2%
Simplified52.2%
Taylor expanded in z around inf 41.6%
if -3.05e16 < z < 1Initial program 100.0%
Taylor expanded in y around inf 92.8%
*-commutative92.8%
Simplified92.8%
Taylor expanded in y around 0 33.8%
Final simplification37.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))))