
(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-define100.0%
Simplified100.0%
(FPCore (x y z t)
:precision binary64
(let* ((t_1 (* z (- x t))) (t_2 (* (- y z) t)))
(if (<= z -9.2e+70)
t_1
(if (<= z -2.9e-132)
t_2
(if (<= z -2.8e-302) x (if (<= z 4.5e+109) t_2 t_1))))))
double code(double x, double y, double z, double t) {
double t_1 = z * (x - t);
double t_2 = (y - z) * t;
double tmp;
if (z <= -9.2e+70) {
tmp = t_1;
} else if (z <= -2.9e-132) {
tmp = t_2;
} else if (z <= -2.8e-302) {
tmp = x;
} else if (z <= 4.5e+109) {
tmp = t_2;
} else {
tmp = t_1;
}
return tmp;
}
real(8) function code(x, y, z, t)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
real(8) :: t_1
real(8) :: t_2
real(8) :: tmp
t_1 = z * (x - t)
t_2 = (y - z) * t
if (z <= (-9.2d+70)) then
tmp = t_1
else if (z <= (-2.9d-132)) then
tmp = t_2
else if (z <= (-2.8d-302)) then
tmp = x
else if (z <= 4.5d+109) then
tmp = t_2
else
tmp = t_1
end if
code = tmp
end function
public static double code(double x, double y, double z, double t) {
double t_1 = z * (x - t);
double t_2 = (y - z) * t;
double tmp;
if (z <= -9.2e+70) {
tmp = t_1;
} else if (z <= -2.9e-132) {
tmp = t_2;
} else if (z <= -2.8e-302) {
tmp = x;
} else if (z <= 4.5e+109) {
tmp = t_2;
} else {
tmp = t_1;
}
return tmp;
}
def code(x, y, z, t): t_1 = z * (x - t) t_2 = (y - z) * t tmp = 0 if z <= -9.2e+70: tmp = t_1 elif z <= -2.9e-132: tmp = t_2 elif z <= -2.8e-302: tmp = x elif z <= 4.5e+109: tmp = t_2 else: tmp = t_1 return tmp
function code(x, y, z, t) t_1 = Float64(z * Float64(x - t)) t_2 = Float64(Float64(y - z) * t) tmp = 0.0 if (z <= -9.2e+70) tmp = t_1; elseif (z <= -2.9e-132) tmp = t_2; elseif (z <= -2.8e-302) tmp = x; elseif (z <= 4.5e+109) tmp = t_2; else tmp = t_1; end return tmp end
function tmp_2 = code(x, y, z, t) t_1 = z * (x - t); t_2 = (y - z) * t; tmp = 0.0; if (z <= -9.2e+70) tmp = t_1; elseif (z <= -2.9e-132) tmp = t_2; elseif (z <= -2.8e-302) tmp = x; elseif (z <= 4.5e+109) tmp = t_2; else tmp = t_1; end tmp_2 = tmp; end
code[x_, y_, z_, t_] := Block[{t$95$1 = N[(z * N[(x - t), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$2 = N[(N[(y - z), $MachinePrecision] * t), $MachinePrecision]}, If[LessEqual[z, -9.2e+70], t$95$1, If[LessEqual[z, -2.9e-132], t$95$2, If[LessEqual[z, -2.8e-302], x, If[LessEqual[z, 4.5e+109], t$95$2, t$95$1]]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := z \cdot \left(x - t\right)\\
t_2 := \left(y - z\right) \cdot t\\
\mathbf{if}\;z \leq -9.2 \cdot 10^{+70}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;z \leq -2.9 \cdot 10^{-132}:\\
\;\;\;\;t\_2\\
\mathbf{elif}\;z \leq -2.8 \cdot 10^{-302}:\\
\;\;\;\;x\\
\mathbf{elif}\;z \leq 4.5 \cdot 10^{+109}:\\
\;\;\;\;t\_2\\
\mathbf{else}:\\
\;\;\;\;t\_1\\
\end{array}
\end{array}
if z < -9.19999999999999975e70 or 4.4999999999999996e109 < z Initial program 100.0%
Taylor expanded in y around 0 85.4%
mul-1-neg85.4%
unsub-neg85.4%
Simplified85.4%
Taylor expanded in x around 0 77.6%
*-commutative77.6%
neg-mul-177.6%
Simplified77.6%
Taylor expanded in z around inf 85.4%
if -9.19999999999999975e70 < z < -2.89999999999999983e-132 or -2.8e-302 < z < 4.4999999999999996e109Initial program 100.0%
Taylor expanded in t around inf 73.6%
Taylor expanded in t around inf 72.0%
associate--l+72.0%
Simplified72.0%
Taylor expanded in x around 0 48.6%
if -2.89999999999999983e-132 < z < -2.8e-302Initial program 99.9%
Taylor expanded in t around inf 77.0%
Taylor expanded in x around inf 51.9%
Final simplification61.8%
(FPCore (x y z t)
:precision binary64
(if (<= z -1.4e+79)
(* z x)
(if (<= z -9.5e-71)
(* z (- t))
(if (<= z 4.4e-48) x (if (<= z 4.5e+109) (* y t) (* z x))))))
double code(double x, double y, double z, double t) {
double tmp;
if (z <= -1.4e+79) {
tmp = z * x;
} else if (z <= -9.5e-71) {
tmp = z * -t;
} else if (z <= 4.4e-48) {
tmp = x;
} else if (z <= 4.5e+109) {
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 <= (-1.4d+79)) then
tmp = z * x
else if (z <= (-9.5d-71)) then
tmp = z * -t
else if (z <= 4.4d-48) then
tmp = x
else if (z <= 4.5d+109) 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 <= -1.4e+79) {
tmp = z * x;
} else if (z <= -9.5e-71) {
tmp = z * -t;
} else if (z <= 4.4e-48) {
tmp = x;
} else if (z <= 4.5e+109) {
tmp = y * t;
} else {
tmp = z * x;
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if z <= -1.4e+79: tmp = z * x elif z <= -9.5e-71: tmp = z * -t elif z <= 4.4e-48: tmp = x elif z <= 4.5e+109: tmp = y * t else: tmp = z * x return tmp
function code(x, y, z, t) tmp = 0.0 if (z <= -1.4e+79) tmp = Float64(z * x); elseif (z <= -9.5e-71) tmp = Float64(z * Float64(-t)); elseif (z <= 4.4e-48) tmp = x; elseif (z <= 4.5e+109) 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 <= -1.4e+79) tmp = z * x; elseif (z <= -9.5e-71) tmp = z * -t; elseif (z <= 4.4e-48) tmp = x; elseif (z <= 4.5e+109) tmp = y * t; else tmp = z * x; end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[LessEqual[z, -1.4e+79], N[(z * x), $MachinePrecision], If[LessEqual[z, -9.5e-71], N[(z * (-t)), $MachinePrecision], If[LessEqual[z, 4.4e-48], x, If[LessEqual[z, 4.5e+109], N[(y * t), $MachinePrecision], N[(z * x), $MachinePrecision]]]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \leq -1.4 \cdot 10^{+79}:\\
\;\;\;\;z \cdot x\\
\mathbf{elif}\;z \leq -9.5 \cdot 10^{-71}:\\
\;\;\;\;z \cdot \left(-t\right)\\
\mathbf{elif}\;z \leq 4.4 \cdot 10^{-48}:\\
\;\;\;\;x\\
\mathbf{elif}\;z \leq 4.5 \cdot 10^{+109}:\\
\;\;\;\;y \cdot t\\
\mathbf{else}:\\
\;\;\;\;z \cdot x\\
\end{array}
\end{array}
if z < -1.4000000000000001e79 or 4.4999999999999996e109 < z Initial program 100.0%
Taylor expanded in t around 0 69.5%
mul-1-neg69.5%
distribute-rgt-neg-in69.5%
sub-neg69.5%
+-commutative69.5%
distribute-neg-in69.5%
remove-double-neg69.5%
sub-neg69.5%
Simplified69.5%
Taylor expanded in y around 0 57.6%
*-commutative57.6%
Simplified57.6%
Taylor expanded in z around inf 57.6%
if -1.4000000000000001e79 < z < -9.4999999999999994e-71Initial program 100.0%
Taylor expanded in t around inf 67.9%
Taylor expanded in y around 0 38.3%
mul-1-neg38.3%
unsub-neg38.3%
Simplified38.3%
Taylor expanded in x around 0 36.2%
associate-*r*36.2%
neg-mul-136.2%
*-commutative36.2%
Simplified36.2%
if -9.4999999999999994e-71 < z < 4.40000000000000025e-48Initial program 99.9%
Taylor expanded in t around inf 76.7%
Taylor expanded in x around inf 42.7%
if 4.40000000000000025e-48 < z < 4.4999999999999996e109Initial program 99.9%
Taylor expanded in t around inf 67.5%
Taylor expanded in t around inf 69.2%
associate--l+69.2%
Simplified69.2%
Taylor expanded in y around inf 43.5%
Final simplification47.2%
(FPCore (x y z t)
:precision binary64
(if (<= z -1.2e+71)
(* z x)
(if (<= z -6.8e-126)
(* y t)
(if (<= z 1.6e-47) x (if (<= z 3.2e+111) (* y t) (* z x))))))
double code(double x, double y, double z, double t) {
double tmp;
if (z <= -1.2e+71) {
tmp = z * x;
} else if (z <= -6.8e-126) {
tmp = y * t;
} else if (z <= 1.6e-47) {
tmp = x;
} else if (z <= 3.2e+111) {
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 <= (-1.2d+71)) then
tmp = z * x
else if (z <= (-6.8d-126)) then
tmp = y * t
else if (z <= 1.6d-47) then
tmp = x
else if (z <= 3.2d+111) 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 <= -1.2e+71) {
tmp = z * x;
} else if (z <= -6.8e-126) {
tmp = y * t;
} else if (z <= 1.6e-47) {
tmp = x;
} else if (z <= 3.2e+111) {
tmp = y * t;
} else {
tmp = z * x;
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if z <= -1.2e+71: tmp = z * x elif z <= -6.8e-126: tmp = y * t elif z <= 1.6e-47: tmp = x elif z <= 3.2e+111: tmp = y * t else: tmp = z * x return tmp
function code(x, y, z, t) tmp = 0.0 if (z <= -1.2e+71) tmp = Float64(z * x); elseif (z <= -6.8e-126) tmp = Float64(y * t); elseif (z <= 1.6e-47) tmp = x; elseif (z <= 3.2e+111) 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 <= -1.2e+71) tmp = z * x; elseif (z <= -6.8e-126) tmp = y * t; elseif (z <= 1.6e-47) tmp = x; elseif (z <= 3.2e+111) tmp = y * t; else tmp = z * x; end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[LessEqual[z, -1.2e+71], N[(z * x), $MachinePrecision], If[LessEqual[z, -6.8e-126], N[(y * t), $MachinePrecision], If[LessEqual[z, 1.6e-47], x, If[LessEqual[z, 3.2e+111], N[(y * t), $MachinePrecision], N[(z * x), $MachinePrecision]]]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \leq -1.2 \cdot 10^{+71}:\\
\;\;\;\;z \cdot x\\
\mathbf{elif}\;z \leq -6.8 \cdot 10^{-126}:\\
\;\;\;\;y \cdot t\\
\mathbf{elif}\;z \leq 1.6 \cdot 10^{-47}:\\
\;\;\;\;x\\
\mathbf{elif}\;z \leq 3.2 \cdot 10^{+111}:\\
\;\;\;\;y \cdot t\\
\mathbf{else}:\\
\;\;\;\;z \cdot x\\
\end{array}
\end{array}
if z < -1.1999999999999999e71 or 3.2000000000000001e111 < z Initial program 100.0%
Taylor expanded in t around 0 68.3%
mul-1-neg68.3%
distribute-rgt-neg-in68.3%
sub-neg68.3%
+-commutative68.3%
distribute-neg-in68.3%
remove-double-neg68.3%
sub-neg68.3%
Simplified68.3%
Taylor expanded in y around 0 56.8%
*-commutative56.8%
Simplified56.8%
Taylor expanded in z around inf 56.8%
if -1.1999999999999999e71 < z < -6.8e-126 or 1.6e-47 < z < 3.2000000000000001e111Initial program 100.0%
Taylor expanded in t around inf 69.1%
Taylor expanded in t around inf 68.0%
associate--l+68.0%
Simplified68.0%
Taylor expanded in y around inf 40.3%
if -6.8e-126 < z < 1.6e-47Initial program 99.9%
Taylor expanded in t around inf 76.7%
Taylor expanded in x around inf 42.9%
Final simplification47.2%
(FPCore (x y z t) :precision binary64 (if (or (<= (- y z) -2e-47) (not (<= (- y z) 5e-41))) (* (- y z) t) x))
double code(double x, double y, double z, double t) {
double tmp;
if (((y - z) <= -2e-47) || !((y - z) <= 5e-41)) {
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) <= (-2d-47)) .or. (.not. ((y - z) <= 5d-41))) 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) <= -2e-47) || !((y - z) <= 5e-41)) {
tmp = (y - z) * t;
} else {
tmp = x;
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if ((y - z) <= -2e-47) or not ((y - z) <= 5e-41): tmp = (y - z) * t else: tmp = x return tmp
function code(x, y, z, t) tmp = 0.0 if ((Float64(y - z) <= -2e-47) || !(Float64(y - z) <= 5e-41)) 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) <= -2e-47) || ~(((y - z) <= 5e-41))) tmp = (y - z) * t; else tmp = x; end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[Or[LessEqual[N[(y - z), $MachinePrecision], -2e-47], N[Not[LessEqual[N[(y - z), $MachinePrecision], 5e-41]], $MachinePrecision]], N[(N[(y - z), $MachinePrecision] * t), $MachinePrecision], x]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;y - z \leq -2 \cdot 10^{-47} \lor \neg \left(y - z \leq 5 \cdot 10^{-41}\right):\\
\;\;\;\;\left(y - z\right) \cdot t\\
\mathbf{else}:\\
\;\;\;\;x\\
\end{array}
\end{array}
if (-.f64 y z) < -1.9999999999999999e-47 or 4.9999999999999996e-41 < (-.f64 y z) Initial program 100.0%
Taylor expanded in t around inf 52.3%
Taylor expanded in t around inf 56.1%
associate--l+56.1%
Simplified56.1%
Taylor expanded in x around 0 49.3%
if -1.9999999999999999e-47 < (-.f64 y z) < 4.9999999999999996e-41Initial program 99.9%
Taylor expanded in t around inf 99.9%
Taylor expanded in x around inf 79.5%
Final simplification56.2%
(FPCore (x y z t) :precision binary64 (if (or (<= t -4.5e-69) (not (<= t 3.9e-19))) (+ x (* (- y z) t)) (+ x (* x (- z y)))))
double code(double x, double y, double z, double t) {
double tmp;
if ((t <= -4.5e-69) || !(t <= 3.9e-19)) {
tmp = x + ((y - z) * t);
} else {
tmp = x + (x * (z - y));
}
return tmp;
}
real(8) function code(x, y, z, t)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
real(8) :: tmp
if ((t <= (-4.5d-69)) .or. (.not. (t <= 3.9d-19))) then
tmp = x + ((y - z) * t)
else
tmp = x + (x * (z - y))
end if
code = tmp
end function
public static double code(double x, double y, double z, double t) {
double tmp;
if ((t <= -4.5e-69) || !(t <= 3.9e-19)) {
tmp = x + ((y - z) * t);
} else {
tmp = x + (x * (z - y));
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if (t <= -4.5e-69) or not (t <= 3.9e-19): tmp = x + ((y - z) * t) else: tmp = x + (x * (z - y)) return tmp
function code(x, y, z, t) tmp = 0.0 if ((t <= -4.5e-69) || !(t <= 3.9e-19)) tmp = Float64(x + Float64(Float64(y - z) * t)); else tmp = Float64(x + Float64(x * Float64(z - y))); end return tmp end
function tmp_2 = code(x, y, z, t) tmp = 0.0; if ((t <= -4.5e-69) || ~((t <= 3.9e-19))) tmp = x + ((y - z) * t); else tmp = x + (x * (z - y)); end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[Or[LessEqual[t, -4.5e-69], N[Not[LessEqual[t, 3.9e-19]], $MachinePrecision]], N[(x + N[(N[(y - z), $MachinePrecision] * t), $MachinePrecision]), $MachinePrecision], N[(x + N[(x * N[(z - y), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;t \leq -4.5 \cdot 10^{-69} \lor \neg \left(t \leq 3.9 \cdot 10^{-19}\right):\\
\;\;\;\;x + \left(y - z\right) \cdot t\\
\mathbf{else}:\\
\;\;\;\;x + x \cdot \left(z - y\right)\\
\end{array}
\end{array}
if t < -4.50000000000000009e-69 or 3.89999999999999995e-19 < t Initial program 99.9%
Taylor expanded in t around inf 85.5%
if -4.50000000000000009e-69 < t < 3.89999999999999995e-19Initial program 100.0%
Taylor expanded in t around 0 91.6%
mul-1-neg91.6%
distribute-rgt-neg-in91.6%
sub-neg91.6%
+-commutative91.6%
distribute-neg-in91.6%
remove-double-neg91.6%
sub-neg91.6%
Simplified91.6%
Final simplification88.2%
(FPCore (x y z t) :precision binary64 (if (or (<= z -3.4e+33) (not (<= z 2.2e+113))) (* z (- x t)) (+ x (* y (- t x)))))
double code(double x, double y, double z, double t) {
double tmp;
if ((z <= -3.4e+33) || !(z <= 2.2e+113)) {
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 <= (-3.4d+33)) .or. (.not. (z <= 2.2d+113))) 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 <= -3.4e+33) || !(z <= 2.2e+113)) {
tmp = z * (x - t);
} else {
tmp = x + (y * (t - x));
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if (z <= -3.4e+33) or not (z <= 2.2e+113): tmp = z * (x - t) else: tmp = x + (y * (t - x)) return tmp
function code(x, y, z, t) tmp = 0.0 if ((z <= -3.4e+33) || !(z <= 2.2e+113)) 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 <= -3.4e+33) || ~((z <= 2.2e+113))) tmp = z * (x - t); else tmp = x + (y * (t - x)); end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[Or[LessEqual[z, -3.4e+33], N[Not[LessEqual[z, 2.2e+113]], $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 -3.4 \cdot 10^{+33} \lor \neg \left(z \leq 2.2 \cdot 10^{+113}\right):\\
\;\;\;\;z \cdot \left(x - t\right)\\
\mathbf{else}:\\
\;\;\;\;x + y \cdot \left(t - x\right)\\
\end{array}
\end{array}
if z < -3.3999999999999999e33 or 2.2000000000000001e113 < z Initial program 100.0%
Taylor expanded in y around 0 84.2%
mul-1-neg84.2%
unsub-neg84.2%
Simplified84.2%
Taylor expanded in x around 0 76.7%
*-commutative76.7%
neg-mul-176.7%
Simplified76.7%
Taylor expanded in z around inf 84.2%
if -3.3999999999999999e33 < z < 2.2000000000000001e113Initial program 100.0%
Taylor expanded in y around inf 88.8%
*-commutative88.8%
Simplified88.8%
Final simplification87.1%
(FPCore (x y z t) :precision binary64 (if (or (<= x -1.4e-66) (not (<= x 4.2e-40))) (+ x (* x (- z y))) (* (- y z) t)))
double code(double x, double y, double z, double t) {
double tmp;
if ((x <= -1.4e-66) || !(x <= 4.2e-40)) {
tmp = x + (x * (z - y));
} 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.4d-66)) .or. (.not. (x <= 4.2d-40))) then
tmp = x + (x * (z - y))
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.4e-66) || !(x <= 4.2e-40)) {
tmp = x + (x * (z - y));
} else {
tmp = (y - z) * t;
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if (x <= -1.4e-66) or not (x <= 4.2e-40): tmp = x + (x * (z - y)) else: tmp = (y - z) * t return tmp
function code(x, y, z, t) tmp = 0.0 if ((x <= -1.4e-66) || !(x <= 4.2e-40)) tmp = Float64(x + Float64(x * Float64(z - y))); 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.4e-66) || ~((x <= 4.2e-40))) tmp = x + (x * (z - y)); else tmp = (y - z) * t; end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[Or[LessEqual[x, -1.4e-66], N[Not[LessEqual[x, 4.2e-40]], $MachinePrecision]], N[(x + N[(x * N[(z - y), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(y - z), $MachinePrecision] * t), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x \leq -1.4 \cdot 10^{-66} \lor \neg \left(x \leq 4.2 \cdot 10^{-40}\right):\\
\;\;\;\;x + x \cdot \left(z - y\right)\\
\mathbf{else}:\\
\;\;\;\;\left(y - z\right) \cdot t\\
\end{array}
\end{array}
if x < -1.4e-66 or 4.20000000000000036e-40 < x Initial program 100.0%
Taylor expanded in t around 0 84.4%
mul-1-neg84.4%
distribute-rgt-neg-in84.4%
sub-neg84.4%
+-commutative84.4%
distribute-neg-in84.4%
remove-double-neg84.4%
sub-neg84.4%
Simplified84.4%
if -1.4e-66 < x < 4.20000000000000036e-40Initial program 99.9%
Taylor expanded in t around inf 91.2%
Taylor expanded in t around inf 91.2%
associate--l+91.2%
Simplified91.2%
Taylor expanded in x around 0 77.2%
Final simplification81.8%
(FPCore (x y z t) :precision binary64 (if (or (<= z -1.05e+14) (not (<= z 2.1e+58))) (* z (- x t)) (+ x (* y t))))
double code(double x, double y, double z, double t) {
double tmp;
if ((z <= -1.05e+14) || !(z <= 2.1e+58)) {
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.05d+14)) .or. (.not. (z <= 2.1d+58))) 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.05e+14) || !(z <= 2.1e+58)) {
tmp = z * (x - t);
} else {
tmp = x + (y * t);
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if (z <= -1.05e+14) or not (z <= 2.1e+58): tmp = z * (x - t) else: tmp = x + (y * t) return tmp
function code(x, y, z, t) tmp = 0.0 if ((z <= -1.05e+14) || !(z <= 2.1e+58)) 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.05e+14) || ~((z <= 2.1e+58))) tmp = z * (x - t); else tmp = x + (y * t); end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[Or[LessEqual[z, -1.05e+14], N[Not[LessEqual[z, 2.1e+58]], $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.05 \cdot 10^{+14} \lor \neg \left(z \leq 2.1 \cdot 10^{+58}\right):\\
\;\;\;\;z \cdot \left(x - t\right)\\
\mathbf{else}:\\
\;\;\;\;x + y \cdot t\\
\end{array}
\end{array}
if z < -1.05e14 or 2.10000000000000012e58 < z Initial program 100.0%
Taylor expanded in y around 0 79.0%
mul-1-neg79.0%
unsub-neg79.0%
Simplified79.0%
Taylor expanded in x around 0 72.4%
*-commutative72.4%
neg-mul-172.4%
Simplified72.4%
Taylor expanded in z around inf 79.0%
if -1.05e14 < z < 2.10000000000000012e58Initial program 99.9%
Taylor expanded in t around inf 76.4%
Taylor expanded in y around inf 69.9%
Final simplification73.7%
(FPCore (x y z t) :precision binary64 (if (or (<= y -7.5e-50) (not (<= y 1.85e-5))) (* y t) x))
double code(double x, double y, double z, double t) {
double tmp;
if ((y <= -7.5e-50) || !(y <= 1.85e-5)) {
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-50)) .or. (.not. (y <= 1.85d-5))) 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-50) || !(y <= 1.85e-5)) {
tmp = y * t;
} else {
tmp = x;
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if (y <= -7.5e-50) or not (y <= 1.85e-5): tmp = y * t else: tmp = x return tmp
function code(x, y, z, t) tmp = 0.0 if ((y <= -7.5e-50) || !(y <= 1.85e-5)) 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-50) || ~((y <= 1.85e-5))) tmp = y * t; else tmp = x; end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[Or[LessEqual[y, -7.5e-50], N[Not[LessEqual[y, 1.85e-5]], $MachinePrecision]], N[(y * t), $MachinePrecision], x]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;y \leq -7.5 \cdot 10^{-50} \lor \neg \left(y \leq 1.85 \cdot 10^{-5}\right):\\
\;\;\;\;y \cdot t\\
\mathbf{else}:\\
\;\;\;\;x\\
\end{array}
\end{array}
if y < -7.5e-50 or 1.84999999999999991e-5 < y Initial program 100.0%
Taylor expanded in t around inf 52.4%
Taylor expanded in t around inf 54.5%
associate--l+54.5%
Simplified54.5%
Taylor expanded in y around inf 40.0%
if -7.5e-50 < y < 1.84999999999999991e-5Initial program 100.0%
Taylor expanded in t around inf 76.6%
Taylor expanded in x around inf 45.3%
Final simplification42.3%
(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 t around inf 63.1%
Taylor expanded in x around inf 22.2%
(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 2024179
(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))))