
(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 10 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 (if (or (<= z -1.45e-7) (not (<= z 2.4e-8))) (* z (- x t)) (- x (* y (- x t)))))
double code(double x, double y, double z, double t) {
double tmp;
if ((z <= -1.45e-7) || !(z <= 2.4e-8)) {
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.45d-7)) .or. (.not. (z <= 2.4d-8))) 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.45e-7) || !(z <= 2.4e-8)) {
tmp = z * (x - t);
} else {
tmp = x - (y * (x - t));
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if (z <= -1.45e-7) or not (z <= 2.4e-8): tmp = z * (x - t) else: tmp = x - (y * (x - t)) return tmp
function code(x, y, z, t) tmp = 0.0 if ((z <= -1.45e-7) || !(z <= 2.4e-8)) 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.45e-7) || ~((z <= 2.4e-8))) 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.45e-7], N[Not[LessEqual[z, 2.4e-8]], $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.45 \cdot 10^{-7} \lor \neg \left(z \leq 2.4 \cdot 10^{-8}\right):\\
\;\;\;\;z \cdot \left(x - t\right)\\
\mathbf{else}:\\
\;\;\;\;x - y \cdot \left(x - t\right)\\
\end{array}
\end{array}
if z < -1.4499999999999999e-7 or 2.39999999999999998e-8 < z Initial program 100.0%
Taylor expanded in y around 0 83.5%
mul-1-neg83.5%
unsub-neg83.5%
Simplified83.5%
Taylor expanded in z around inf 82.3%
if -1.4499999999999999e-7 < z < 2.39999999999999998e-8Initial program 100.0%
Taylor expanded in y around inf 94.5%
*-commutative94.5%
Simplified94.5%
Final simplification88.0%
(FPCore (x y z t) :precision binary64 (let* ((t_1 (* z (- x t)))) (if (<= z -1.85e-7) t_1 (if (<= z 1.7e-9) (- x (* y (- x t))) (+ x t_1)))))
double code(double x, double y, double z, double t) {
double t_1 = z * (x - t);
double tmp;
if (z <= -1.85e-7) {
tmp = t_1;
} else if (z <= 1.7e-9) {
tmp = x - (y * (x - t));
} else {
tmp = x + 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 * (x - t)
if (z <= (-1.85d-7)) then
tmp = t_1
else if (z <= 1.7d-9) then
tmp = x - (y * (x - t))
else
tmp = x + 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 tmp;
if (z <= -1.85e-7) {
tmp = t_1;
} else if (z <= 1.7e-9) {
tmp = x - (y * (x - t));
} else {
tmp = x + t_1;
}
return tmp;
}
def code(x, y, z, t): t_1 = z * (x - t) tmp = 0 if z <= -1.85e-7: tmp = t_1 elif z <= 1.7e-9: tmp = x - (y * (x - t)) else: tmp = x + t_1 return tmp
function code(x, y, z, t) t_1 = Float64(z * Float64(x - t)) tmp = 0.0 if (z <= -1.85e-7) tmp = t_1; elseif (z <= 1.7e-9) tmp = Float64(x - Float64(y * Float64(x - t))); else tmp = Float64(x + t_1); end return tmp end
function tmp_2 = code(x, y, z, t) t_1 = z * (x - t); tmp = 0.0; if (z <= -1.85e-7) tmp = t_1; elseif (z <= 1.7e-9) tmp = x - (y * (x - t)); else tmp = x + t_1; end tmp_2 = tmp; end
code[x_, y_, z_, t_] := Block[{t$95$1 = N[(z * N[(x - t), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[z, -1.85e-7], t$95$1, If[LessEqual[z, 1.7e-9], N[(x - N[(y * N[(x - t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(x + t$95$1), $MachinePrecision]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := z \cdot \left(x - t\right)\\
\mathbf{if}\;z \leq -1.85 \cdot 10^{-7}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;z \leq 1.7 \cdot 10^{-9}:\\
\;\;\;\;x - y \cdot \left(x - t\right)\\
\mathbf{else}:\\
\;\;\;\;x + t\_1\\
\end{array}
\end{array}
if z < -1.85000000000000002e-7Initial program 100.0%
Taylor expanded in y around 0 80.5%
mul-1-neg80.5%
unsub-neg80.5%
Simplified80.5%
Taylor expanded in z around inf 80.5%
if -1.85000000000000002e-7 < z < 1.6999999999999999e-9Initial program 100.0%
Taylor expanded in y around inf 94.5%
*-commutative94.5%
Simplified94.5%
if 1.6999999999999999e-9 < z Initial program 100.0%
Taylor expanded in y around 0 85.5%
mul-1-neg85.5%
unsub-neg85.5%
Simplified85.5%
Final simplification88.6%
(FPCore (x y z t) :precision binary64 (if (or (<= z -1.75e-7) (not (<= z 1.3e-8))) (* z (- x t)) (+ x (* y t))))
double code(double x, double y, double z, double t) {
double tmp;
if ((z <= -1.75e-7) || !(z <= 1.3e-8)) {
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.75d-7)) .or. (.not. (z <= 1.3d-8))) 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.75e-7) || !(z <= 1.3e-8)) {
tmp = z * (x - t);
} else {
tmp = x + (y * t);
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if (z <= -1.75e-7) or not (z <= 1.3e-8): tmp = z * (x - t) else: tmp = x + (y * t) return tmp
function code(x, y, z, t) tmp = 0.0 if ((z <= -1.75e-7) || !(z <= 1.3e-8)) 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.75e-7) || ~((z <= 1.3e-8))) tmp = z * (x - t); else tmp = x + (y * t); end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[Or[LessEqual[z, -1.75e-7], N[Not[LessEqual[z, 1.3e-8]], $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.75 \cdot 10^{-7} \lor \neg \left(z \leq 1.3 \cdot 10^{-8}\right):\\
\;\;\;\;z \cdot \left(x - t\right)\\
\mathbf{else}:\\
\;\;\;\;x + y \cdot t\\
\end{array}
\end{array}
if z < -1.74999999999999992e-7 or 1.3000000000000001e-8 < z Initial program 100.0%
Taylor expanded in y around 0 83.5%
mul-1-neg83.5%
unsub-neg83.5%
Simplified83.5%
Taylor expanded in z around inf 82.3%
if -1.74999999999999992e-7 < z < 1.3000000000000001e-8Initial program 100.0%
Taylor expanded in t around inf 77.0%
Taylor expanded in y around inf 71.5%
Final simplification77.3%
(FPCore (x y z t) :precision binary64 (if (or (<= z -7.6e-8) (not (<= z 2.75e-65))) (* z (- x t)) (* x (- 1.0 y))))
double code(double x, double y, double z, double t) {
double tmp;
if ((z <= -7.6e-8) || !(z <= 2.75e-65)) {
tmp = z * (x - 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 ((z <= (-7.6d-8)) .or. (.not. (z <= 2.75d-65))) then
tmp = z * (x - 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 ((z <= -7.6e-8) || !(z <= 2.75e-65)) {
tmp = z * (x - t);
} else {
tmp = x * (1.0 - y);
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if (z <= -7.6e-8) or not (z <= 2.75e-65): tmp = z * (x - t) else: tmp = x * (1.0 - y) return tmp
function code(x, y, z, t) tmp = 0.0 if ((z <= -7.6e-8) || !(z <= 2.75e-65)) tmp = Float64(z * Float64(x - 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 ((z <= -7.6e-8) || ~((z <= 2.75e-65))) tmp = z * (x - t); else tmp = x * (1.0 - y); end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[Or[LessEqual[z, -7.6e-8], N[Not[LessEqual[z, 2.75e-65]], $MachinePrecision]], N[(z * N[(x - t), $MachinePrecision]), $MachinePrecision], N[(x * N[(1.0 - y), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \leq -7.6 \cdot 10^{-8} \lor \neg \left(z \leq 2.75 \cdot 10^{-65}\right):\\
\;\;\;\;z \cdot \left(x - t\right)\\
\mathbf{else}:\\
\;\;\;\;x \cdot \left(1 - y\right)\\
\end{array}
\end{array}
if z < -7.60000000000000056e-8 or 2.7499999999999999e-65 < z Initial program 100.0%
Taylor expanded in y around 0 81.6%
mul-1-neg81.6%
unsub-neg81.6%
Simplified81.6%
Taylor expanded in z around inf 79.9%
if -7.60000000000000056e-8 < z < 2.7499999999999999e-65Initial program 100.0%
Taylor expanded in t around 0 56.0%
mul-1-neg56.0%
distribute-rgt-neg-in56.0%
sub-neg56.0%
+-commutative56.0%
distribute-neg-in56.0%
remove-double-neg56.0%
sub-neg56.0%
Simplified56.0%
Taylor expanded in z around 0 56.0%
*-rgt-identity56.0%
mul-1-neg56.0%
distribute-rgt-neg-out56.0%
distribute-lft-in56.0%
unsub-neg56.0%
Simplified56.0%
Final simplification69.4%
(FPCore (x y z t) :precision binary64 (if (<= z -1.25e-19) (* z x) (if (<= z 2.75e-65) (* x (- 1.0 y)) (* z (- t)))))
double code(double x, double y, double z, double t) {
double tmp;
if (z <= -1.25e-19) {
tmp = z * x;
} else if (z <= 2.75e-65) {
tmp = x * (1.0 - y);
} else {
tmp = 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 (z <= (-1.25d-19)) then
tmp = z * x
else if (z <= 2.75d-65) then
tmp = x * (1.0d0 - y)
else
tmp = z * -t
end if
code = tmp
end function
public static double code(double x, double y, double z, double t) {
double tmp;
if (z <= -1.25e-19) {
tmp = z * x;
} else if (z <= 2.75e-65) {
tmp = x * (1.0 - y);
} else {
tmp = z * -t;
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if z <= -1.25e-19: tmp = z * x elif z <= 2.75e-65: tmp = x * (1.0 - y) else: tmp = z * -t return tmp
function code(x, y, z, t) tmp = 0.0 if (z <= -1.25e-19) tmp = Float64(z * x); elseif (z <= 2.75e-65) tmp = Float64(x * Float64(1.0 - y)); else tmp = Float64(z * Float64(-t)); end return tmp end
function tmp_2 = code(x, y, z, t) tmp = 0.0; if (z <= -1.25e-19) tmp = z * x; elseif (z <= 2.75e-65) tmp = x * (1.0 - y); else tmp = z * -t; end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[LessEqual[z, -1.25e-19], N[(z * x), $MachinePrecision], If[LessEqual[z, 2.75e-65], N[(x * N[(1.0 - y), $MachinePrecision]), $MachinePrecision], N[(z * (-t)), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \leq -1.25 \cdot 10^{-19}:\\
\;\;\;\;z \cdot x\\
\mathbf{elif}\;z \leq 2.75 \cdot 10^{-65}:\\
\;\;\;\;x \cdot \left(1 - y\right)\\
\mathbf{else}:\\
\;\;\;\;z \cdot \left(-t\right)\\
\end{array}
\end{array}
if z < -1.2500000000000001e-19Initial program 100.0%
Taylor expanded in y around 0 79.1%
mul-1-neg79.1%
unsub-neg79.1%
Simplified79.1%
Taylor expanded in z around inf 79.1%
Taylor expanded in x around inf 43.4%
*-commutative43.4%
Simplified43.4%
if -1.2500000000000001e-19 < z < 2.7499999999999999e-65Initial program 100.0%
Taylor expanded in t around 0 56.5%
mul-1-neg56.5%
distribute-rgt-neg-in56.5%
sub-neg56.5%
+-commutative56.5%
distribute-neg-in56.5%
remove-double-neg56.5%
sub-neg56.5%
Simplified56.5%
Taylor expanded in z around 0 56.5%
*-rgt-identity56.5%
mul-1-neg56.5%
distribute-rgt-neg-out56.5%
distribute-lft-in56.5%
unsub-neg56.5%
Simplified56.5%
if 2.7499999999999999e-65 < z Initial program 100.0%
Taylor expanded in y around 0 82.2%
mul-1-neg82.2%
unsub-neg82.2%
Simplified82.2%
Taylor expanded in z around inf 79.4%
Taylor expanded in x around 0 54.6%
neg-mul-154.6%
Simplified54.6%
(FPCore (x y z t) :precision binary64 (if (<= z -1.25e-19) (* z x) (if (<= z 1.45e-91) x (* z (- t)))))
double code(double x, double y, double z, double t) {
double tmp;
if (z <= -1.25e-19) {
tmp = z * x;
} else if (z <= 1.45e-91) {
tmp = x;
} else {
tmp = 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 (z <= (-1.25d-19)) then
tmp = z * x
else if (z <= 1.45d-91) then
tmp = x
else
tmp = z * -t
end if
code = tmp
end function
public static double code(double x, double y, double z, double t) {
double tmp;
if (z <= -1.25e-19) {
tmp = z * x;
} else if (z <= 1.45e-91) {
tmp = x;
} else {
tmp = z * -t;
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if z <= -1.25e-19: tmp = z * x elif z <= 1.45e-91: tmp = x else: tmp = z * -t return tmp
function code(x, y, z, t) tmp = 0.0 if (z <= -1.25e-19) tmp = Float64(z * x); elseif (z <= 1.45e-91) tmp = x; else tmp = Float64(z * Float64(-t)); end return tmp end
function tmp_2 = code(x, y, z, t) tmp = 0.0; if (z <= -1.25e-19) tmp = z * x; elseif (z <= 1.45e-91) tmp = x; else tmp = z * -t; end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[LessEqual[z, -1.25e-19], N[(z * x), $MachinePrecision], If[LessEqual[z, 1.45e-91], x, N[(z * (-t)), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \leq -1.25 \cdot 10^{-19}:\\
\;\;\;\;z \cdot x\\
\mathbf{elif}\;z \leq 1.45 \cdot 10^{-91}:\\
\;\;\;\;x\\
\mathbf{else}:\\
\;\;\;\;z \cdot \left(-t\right)\\
\end{array}
\end{array}
if z < -1.2500000000000001e-19Initial program 100.0%
Taylor expanded in y around 0 79.1%
mul-1-neg79.1%
unsub-neg79.1%
Simplified79.1%
Taylor expanded in z around inf 79.1%
Taylor expanded in x around inf 43.4%
*-commutative43.4%
Simplified43.4%
if -1.2500000000000001e-19 < z < 1.45e-91Initial program 100.0%
Taylor expanded in y around inf 97.3%
*-commutative97.3%
Simplified97.3%
Taylor expanded in y around 0 33.2%
if 1.45e-91 < z Initial program 100.0%
Taylor expanded in y around 0 79.3%
mul-1-neg79.3%
unsub-neg79.3%
Simplified79.3%
Taylor expanded in z around inf 75.7%
Taylor expanded in x around 0 52.4%
neg-mul-152.4%
Simplified52.4%
(FPCore (x y z t) :precision binary64 (if (or (<= z -1.25e-19) (not (<= z 2.1e-16))) (* z x) x))
double code(double x, double y, double z, double t) {
double tmp;
if ((z <= -1.25e-19) || !(z <= 2.1e-16)) {
tmp = z * x;
} else {
tmp = x;
}
return tmp;
}
real(8) function code(x, y, z, t)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
real(8) :: tmp
if ((z <= (-1.25d-19)) .or. (.not. (z <= 2.1d-16))) then
tmp = z * x
else
tmp = x
end if
code = tmp
end function
public static double code(double x, double y, double z, double t) {
double tmp;
if ((z <= -1.25e-19) || !(z <= 2.1e-16)) {
tmp = z * x;
} else {
tmp = x;
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if (z <= -1.25e-19) or not (z <= 2.1e-16): tmp = z * x else: tmp = x return tmp
function code(x, y, z, t) tmp = 0.0 if ((z <= -1.25e-19) || !(z <= 2.1e-16)) tmp = Float64(z * x); else tmp = x; end return tmp end
function tmp_2 = code(x, y, z, t) tmp = 0.0; if ((z <= -1.25e-19) || ~((z <= 2.1e-16))) tmp = z * x; else tmp = x; end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[Or[LessEqual[z, -1.25e-19], N[Not[LessEqual[z, 2.1e-16]], $MachinePrecision]], N[(z * x), $MachinePrecision], x]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \leq -1.25 \cdot 10^{-19} \lor \neg \left(z \leq 2.1 \cdot 10^{-16}\right):\\
\;\;\;\;z \cdot x\\
\mathbf{else}:\\
\;\;\;\;x\\
\end{array}
\end{array}
if z < -1.2500000000000001e-19 or 2.1000000000000001e-16 < z Initial program 100.0%
Taylor expanded in y around 0 82.3%
mul-1-neg82.3%
unsub-neg82.3%
Simplified82.3%
Taylor expanded in z around inf 81.2%
Taylor expanded in x around inf 36.2%
*-commutative36.2%
Simplified36.2%
if -1.2500000000000001e-19 < z < 2.1000000000000001e-16Initial program 100.0%
Taylor expanded in y around inf 94.4%
*-commutative94.4%
Simplified94.4%
Taylor expanded in y around 0 31.5%
Final simplification34.1%
(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 58.4%
*-commutative58.4%
Simplified58.4%
Taylor expanded in y around 0 16.0%
(FPCore (x y z t) :precision binary64 (+ x (+ (* t (- y z)) (* (- x) (- y z)))))
double code(double x, double y, double z, double t) {
return x + ((t * (y - z)) + (-x * (y - z)));
}
real(8) function code(x, y, z, t)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
code = x + ((t * (y - z)) + (-x * (y - z)))
end function
public static double code(double x, double y, double z, double t) {
return x + ((t * (y - z)) + (-x * (y - z)));
}
def code(x, y, z, t): return x + ((t * (y - z)) + (-x * (y - z)))
function code(x, y, z, t) return Float64(x + Float64(Float64(t * Float64(y - z)) + Float64(Float64(-x) * Float64(y - z)))) end
function tmp = code(x, y, z, t) tmp = x + ((t * (y - z)) + (-x * (y - z))); end
code[x_, y_, z_, t_] := N[(x + N[(N[(t * N[(y - z), $MachinePrecision]), $MachinePrecision] + N[((-x) * N[(y - z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
x + \left(t \cdot \left(y - z\right) + \left(-x\right) \cdot \left(y - z\right)\right)
\end{array}
herbie shell --seed 2024143
(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))))