
(FPCore (x y z t a) :precision binary64 (+ x (/ (* (- y x) (- z t)) (- a t))))
double code(double x, double y, double z, double t, double a) {
return x + (((y - x) * (z - t)) / (a - t));
}
real(8) function code(x, y, z, t, a)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
real(8), intent (in) :: a
code = x + (((y - x) * (z - t)) / (a - t))
end function
public static double code(double x, double y, double z, double t, double a) {
return x + (((y - x) * (z - t)) / (a - t));
}
def code(x, y, z, t, a): return x + (((y - x) * (z - t)) / (a - t))
function code(x, y, z, t, a) return Float64(x + Float64(Float64(Float64(y - x) * Float64(z - t)) / Float64(a - t))) end
function tmp = code(x, y, z, t, a) tmp = x + (((y - x) * (z - t)) / (a - t)); end
code[x_, y_, z_, t_, a_] := N[(x + N[(N[(N[(y - x), $MachinePrecision] * N[(z - t), $MachinePrecision]), $MachinePrecision] / N[(a - t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
x + \frac{\left(y - x\right) \cdot \left(z - t\right)}{a - t}
\end{array}
Sampling outcomes in binary64 precision:
Herbie found 10 alternatives:
| Alternative | Accuracy | Speedup |
|---|
(FPCore (x y z t a) :precision binary64 (+ x (/ (* (- y x) (- z t)) (- a t))))
double code(double x, double y, double z, double t, double a) {
return x + (((y - x) * (z - t)) / (a - t));
}
real(8) function code(x, y, z, t, a)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
real(8), intent (in) :: a
code = x + (((y - x) * (z - t)) / (a - t))
end function
public static double code(double x, double y, double z, double t, double a) {
return x + (((y - x) * (z - t)) / (a - t));
}
def code(x, y, z, t, a): return x + (((y - x) * (z - t)) / (a - t))
function code(x, y, z, t, a) return Float64(x + Float64(Float64(Float64(y - x) * Float64(z - t)) / Float64(a - t))) end
function tmp = code(x, y, z, t, a) tmp = x + (((y - x) * (z - t)) / (a - t)); end
code[x_, y_, z_, t_, a_] := N[(x + N[(N[(N[(y - x), $MachinePrecision] * N[(z - t), $MachinePrecision]), $MachinePrecision] / N[(a - t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
x + \frac{\left(y - x\right) \cdot \left(z - t\right)}{a - t}
\end{array}
(FPCore (x y z t a)
:precision binary64
(let* ((t_1 (+ x (/ (* (- y x) (- z t)) (- a t)))))
(if (or (<= t_1 -1e-303) (not (<= t_1 0.0)))
(+ x (/ (- y x) (/ (- a t) (- z t))))
(- y (/ (* (- z a) (- y x)) t)))))
double code(double x, double y, double z, double t, double a) {
double t_1 = x + (((y - x) * (z - t)) / (a - t));
double tmp;
if ((t_1 <= -1e-303) || !(t_1 <= 0.0)) {
tmp = x + ((y - x) / ((a - t) / (z - t)));
} else {
tmp = y - (((z - a) * (y - x)) / t);
}
return tmp;
}
real(8) function code(x, y, z, t, a)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
real(8), intent (in) :: a
real(8) :: t_1
real(8) :: tmp
t_1 = x + (((y - x) * (z - t)) / (a - t))
if ((t_1 <= (-1d-303)) .or. (.not. (t_1 <= 0.0d0))) then
tmp = x + ((y - x) / ((a - t) / (z - t)))
else
tmp = y - (((z - a) * (y - x)) / t)
end if
code = tmp
end function
public static double code(double x, double y, double z, double t, double a) {
double t_1 = x + (((y - x) * (z - t)) / (a - t));
double tmp;
if ((t_1 <= -1e-303) || !(t_1 <= 0.0)) {
tmp = x + ((y - x) / ((a - t) / (z - t)));
} else {
tmp = y - (((z - a) * (y - x)) / t);
}
return tmp;
}
def code(x, y, z, t, a): t_1 = x + (((y - x) * (z - t)) / (a - t)) tmp = 0 if (t_1 <= -1e-303) or not (t_1 <= 0.0): tmp = x + ((y - x) / ((a - t) / (z - t))) else: tmp = y - (((z - a) * (y - x)) / t) return tmp
function code(x, y, z, t, a) t_1 = Float64(x + Float64(Float64(Float64(y - x) * Float64(z - t)) / Float64(a - t))) tmp = 0.0 if ((t_1 <= -1e-303) || !(t_1 <= 0.0)) tmp = Float64(x + Float64(Float64(y - x) / Float64(Float64(a - t) / Float64(z - t)))); else tmp = Float64(y - Float64(Float64(Float64(z - a) * Float64(y - x)) / t)); end return tmp end
function tmp_2 = code(x, y, z, t, a) t_1 = x + (((y - x) * (z - t)) / (a - t)); tmp = 0.0; if ((t_1 <= -1e-303) || ~((t_1 <= 0.0))) tmp = x + ((y - x) / ((a - t) / (z - t))); else tmp = y - (((z - a) * (y - x)) / t); end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_] := Block[{t$95$1 = N[(x + N[(N[(N[(y - x), $MachinePrecision] * N[(z - t), $MachinePrecision]), $MachinePrecision] / N[(a - t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, If[Or[LessEqual[t$95$1, -1e-303], N[Not[LessEqual[t$95$1, 0.0]], $MachinePrecision]], N[(x + N[(N[(y - x), $MachinePrecision] / N[(N[(a - t), $MachinePrecision] / N[(z - t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(y - N[(N[(N[(z - a), $MachinePrecision] * N[(y - x), $MachinePrecision]), $MachinePrecision] / t), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := x + \frac{\left(y - x\right) \cdot \left(z - t\right)}{a - t}\\
\mathbf{if}\;t\_1 \leq -1 \cdot 10^{-303} \lor \neg \left(t\_1 \leq 0\right):\\
\;\;\;\;x + \frac{y - x}{\frac{a - t}{z - t}}\\
\mathbf{else}:\\
\;\;\;\;y - \frac{\left(z - a\right) \cdot \left(y - x\right)}{t}\\
\end{array}
\end{array}
if (+.f64 x (/.f64 (*.f64 (-.f64 y x) (-.f64 z t)) (-.f64 a t))) < -9.99999999999999931e-304 or 0.0 < (+.f64 x (/.f64 (*.f64 (-.f64 y x) (-.f64 z t)) (-.f64 a t))) Initial program 69.9%
lift-/.f64N/A
lift-*.f64N/A
associate-/l*N/A
clear-numN/A
un-div-invN/A
lower-/.f64N/A
lower-/.f6492.5
Applied rewrites92.5%
if -9.99999999999999931e-304 < (+.f64 x (/.f64 (*.f64 (-.f64 y x) (-.f64 z t)) (-.f64 a t))) < 0.0Initial program 4.2%
Taylor expanded in t around -inf
mul-1-negN/A
unsub-negN/A
lower--.f64N/A
lower-/.f64N/A
Applied rewrites94.7%
Taylor expanded in t around inf
Applied rewrites99.7%
Final simplification93.0%
(FPCore (x y z t a)
:precision binary64
(let* ((t_1 (fma (- z t) (/ (- y x) (- a t)) x))
(t_2 (+ x (/ (* (- y x) (- z t)) (- a t)))))
(if (<= t_2 (- INFINITY))
t_1
(if (<= t_2 -1e-303)
t_2
(if (<= t_2 0.0) (- y (/ (* (- z a) (- y x)) t)) t_1)))))
double code(double x, double y, double z, double t, double a) {
double t_1 = fma((z - t), ((y - x) / (a - t)), x);
double t_2 = x + (((y - x) * (z - t)) / (a - t));
double tmp;
if (t_2 <= -((double) INFINITY)) {
tmp = t_1;
} else if (t_2 <= -1e-303) {
tmp = t_2;
} else if (t_2 <= 0.0) {
tmp = y - (((z - a) * (y - x)) / t);
} else {
tmp = t_1;
}
return tmp;
}
function code(x, y, z, t, a) t_1 = fma(Float64(z - t), Float64(Float64(y - x) / Float64(a - t)), x) t_2 = Float64(x + Float64(Float64(Float64(y - x) * Float64(z - t)) / Float64(a - t))) tmp = 0.0 if (t_2 <= Float64(-Inf)) tmp = t_1; elseif (t_2 <= -1e-303) tmp = t_2; elseif (t_2 <= 0.0) tmp = Float64(y - Float64(Float64(Float64(z - a) * Float64(y - x)) / t)); else tmp = t_1; end return tmp end
code[x_, y_, z_, t_, a_] := Block[{t$95$1 = N[(N[(z - t), $MachinePrecision] * N[(N[(y - x), $MachinePrecision] / N[(a - t), $MachinePrecision]), $MachinePrecision] + x), $MachinePrecision]}, Block[{t$95$2 = N[(x + N[(N[(N[(y - x), $MachinePrecision] * N[(z - t), $MachinePrecision]), $MachinePrecision] / N[(a - t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[t$95$2, (-Infinity)], t$95$1, If[LessEqual[t$95$2, -1e-303], t$95$2, If[LessEqual[t$95$2, 0.0], N[(y - N[(N[(N[(z - a), $MachinePrecision] * N[(y - x), $MachinePrecision]), $MachinePrecision] / t), $MachinePrecision]), $MachinePrecision], t$95$1]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := \mathsf{fma}\left(z - t, \frac{y - x}{a - t}, x\right)\\
t_2 := x + \frac{\left(y - x\right) \cdot \left(z - t\right)}{a - t}\\
\mathbf{if}\;t\_2 \leq -\infty:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;t\_2 \leq -1 \cdot 10^{-303}:\\
\;\;\;\;t\_2\\
\mathbf{elif}\;t\_2 \leq 0:\\
\;\;\;\;y - \frac{\left(z - a\right) \cdot \left(y - x\right)}{t}\\
\mathbf{else}:\\
\;\;\;\;t\_1\\
\end{array}
\end{array}
if (+.f64 x (/.f64 (*.f64 (-.f64 y x) (-.f64 z t)) (-.f64 a t))) < -inf.0 or 0.0 < (+.f64 x (/.f64 (*.f64 (-.f64 y x) (-.f64 z t)) (-.f64 a t))) Initial program 57.4%
lift-+.f64N/A
+-commutativeN/A
lift-/.f64N/A
lift-*.f64N/A
*-commutativeN/A
associate-/l*N/A
lower-fma.f64N/A
lower-/.f6486.9
Applied rewrites86.9%
if -inf.0 < (+.f64 x (/.f64 (*.f64 (-.f64 y x) (-.f64 z t)) (-.f64 a t))) < -9.99999999999999931e-304Initial program 99.7%
if -9.99999999999999931e-304 < (+.f64 x (/.f64 (*.f64 (-.f64 y x) (-.f64 z t)) (-.f64 a t))) < 0.0Initial program 4.2%
Taylor expanded in t around -inf
mul-1-negN/A
unsub-negN/A
lower--.f64N/A
lower-/.f64N/A
Applied rewrites94.7%
Taylor expanded in t around inf
Applied rewrites99.7%
(FPCore (x y z t a) :precision binary64 (if (or (<= t -6.4e+165) (not (<= t 2.5e+179))) (fma (- x y) (/ (- z a) t) y) (fma (- z t) (/ (- y x) (- a t)) x)))
double code(double x, double y, double z, double t, double a) {
double tmp;
if ((t <= -6.4e+165) || !(t <= 2.5e+179)) {
tmp = fma((x - y), ((z - a) / t), y);
} else {
tmp = fma((z - t), ((y - x) / (a - t)), x);
}
return tmp;
}
function code(x, y, z, t, a) tmp = 0.0 if ((t <= -6.4e+165) || !(t <= 2.5e+179)) tmp = fma(Float64(x - y), Float64(Float64(z - a) / t), y); else tmp = fma(Float64(z - t), Float64(Float64(y - x) / Float64(a - t)), x); end return tmp end
code[x_, y_, z_, t_, a_] := If[Or[LessEqual[t, -6.4e+165], N[Not[LessEqual[t, 2.5e+179]], $MachinePrecision]], N[(N[(x - y), $MachinePrecision] * N[(N[(z - a), $MachinePrecision] / t), $MachinePrecision] + y), $MachinePrecision], N[(N[(z - t), $MachinePrecision] * N[(N[(y - x), $MachinePrecision] / N[(a - t), $MachinePrecision]), $MachinePrecision] + x), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;t \leq -6.4 \cdot 10^{+165} \lor \neg \left(t \leq 2.5 \cdot 10^{+179}\right):\\
\;\;\;\;\mathsf{fma}\left(x - y, \frac{z - a}{t}, y\right)\\
\mathbf{else}:\\
\;\;\;\;\mathsf{fma}\left(z - t, \frac{y - x}{a - t}, x\right)\\
\end{array}
\end{array}
if t < -6.4e165 or 2.5e179 < t Initial program 27.9%
Taylor expanded in t around inf
associate--l+N/A
distribute-lft-out--N/A
div-subN/A
+-commutativeN/A
mul-1-negN/A
distribute-rgt-out--N/A
associate-/l*N/A
distribute-lft-neg-inN/A
mul-1-negN/A
lower-fma.f64N/A
Applied rewrites92.3%
if -6.4e165 < t < 2.5e179Initial program 77.4%
lift-+.f64N/A
+-commutativeN/A
lift-/.f64N/A
lift-*.f64N/A
*-commutativeN/A
associate-/l*N/A
lower-fma.f64N/A
lower-/.f6488.6
Applied rewrites88.6%
Final simplification89.5%
(FPCore (x y z t a) :precision binary64 (if (or (<= t -5e+65) (not (<= t 0.175))) (fma (- x y) (/ (- z a) t) y) (+ x (/ (* (- y x) z) (- a t)))))
double code(double x, double y, double z, double t, double a) {
double tmp;
if ((t <= -5e+65) || !(t <= 0.175)) {
tmp = fma((x - y), ((z - a) / t), y);
} else {
tmp = x + (((y - x) * z) / (a - t));
}
return tmp;
}
function code(x, y, z, t, a) tmp = 0.0 if ((t <= -5e+65) || !(t <= 0.175)) tmp = fma(Float64(x - y), Float64(Float64(z - a) / t), y); else tmp = Float64(x + Float64(Float64(Float64(y - x) * z) / Float64(a - t))); end return tmp end
code[x_, y_, z_, t_, a_] := If[Or[LessEqual[t, -5e+65], N[Not[LessEqual[t, 0.175]], $MachinePrecision]], N[(N[(x - y), $MachinePrecision] * N[(N[(z - a), $MachinePrecision] / t), $MachinePrecision] + y), $MachinePrecision], N[(x + N[(N[(N[(y - x), $MachinePrecision] * z), $MachinePrecision] / N[(a - t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;t \leq -5 \cdot 10^{+65} \lor \neg \left(t \leq 0.175\right):\\
\;\;\;\;\mathsf{fma}\left(x - y, \frac{z - a}{t}, y\right)\\
\mathbf{else}:\\
\;\;\;\;x + \frac{\left(y - x\right) \cdot z}{a - t}\\
\end{array}
\end{array}
if t < -4.99999999999999973e65 or 0.17499999999999999 < t Initial program 36.3%
Taylor expanded in t around inf
associate--l+N/A
distribute-lft-out--N/A
div-subN/A
+-commutativeN/A
mul-1-negN/A
distribute-rgt-out--N/A
associate-/l*N/A
distribute-lft-neg-inN/A
mul-1-negN/A
lower-fma.f64N/A
Applied rewrites77.3%
if -4.99999999999999973e65 < t < 0.17499999999999999Initial program 89.6%
Taylor expanded in z around inf
*-commutativeN/A
lower-*.f64N/A
lower--.f6481.9
Applied rewrites81.9%
Final simplification79.8%
(FPCore (x y z t a) :precision binary64 (if (or (<= t -3.8e+65) (not (<= t 5.8e-18))) (fma (- x y) (/ (- z a) t) y) (fma (- y x) (/ z a) x)))
double code(double x, double y, double z, double t, double a) {
double tmp;
if ((t <= -3.8e+65) || !(t <= 5.8e-18)) {
tmp = fma((x - y), ((z - a) / t), y);
} else {
tmp = fma((y - x), (z / a), x);
}
return tmp;
}
function code(x, y, z, t, a) tmp = 0.0 if ((t <= -3.8e+65) || !(t <= 5.8e-18)) tmp = fma(Float64(x - y), Float64(Float64(z - a) / t), y); else tmp = fma(Float64(y - x), Float64(z / a), x); end return tmp end
code[x_, y_, z_, t_, a_] := If[Or[LessEqual[t, -3.8e+65], N[Not[LessEqual[t, 5.8e-18]], $MachinePrecision]], N[(N[(x - y), $MachinePrecision] * N[(N[(z - a), $MachinePrecision] / t), $MachinePrecision] + y), $MachinePrecision], N[(N[(y - x), $MachinePrecision] * N[(z / a), $MachinePrecision] + x), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;t \leq -3.8 \cdot 10^{+65} \lor \neg \left(t \leq 5.8 \cdot 10^{-18}\right):\\
\;\;\;\;\mathsf{fma}\left(x - y, \frac{z - a}{t}, y\right)\\
\mathbf{else}:\\
\;\;\;\;\mathsf{fma}\left(y - x, \frac{z}{a}, x\right)\\
\end{array}
\end{array}
if t < -3.80000000000000011e65 or 5.8e-18 < t Initial program 39.9%
Taylor expanded in t around inf
associate--l+N/A
distribute-lft-out--N/A
div-subN/A
+-commutativeN/A
mul-1-negN/A
distribute-rgt-out--N/A
associate-/l*N/A
distribute-lft-neg-inN/A
mul-1-negN/A
lower-fma.f64N/A
Applied rewrites76.2%
if -3.80000000000000011e65 < t < 5.8e-18Initial program 89.0%
Taylor expanded in t around 0
+-commutativeN/A
associate-/l*N/A
*-commutativeN/A
lower-fma.f64N/A
lower-/.f64N/A
lower--.f6476.6
Applied rewrites76.6%
Applied rewrites79.8%
Final simplification78.1%
(FPCore (x y z t a) :precision binary64 (if (or (<= t -3.8e+65) (not (<= t 1.65e+72))) (fma (- x y) (/ z t) y) (fma (- y x) (/ z a) x)))
double code(double x, double y, double z, double t, double a) {
double tmp;
if ((t <= -3.8e+65) || !(t <= 1.65e+72)) {
tmp = fma((x - y), (z / t), y);
} else {
tmp = fma((y - x), (z / a), x);
}
return tmp;
}
function code(x, y, z, t, a) tmp = 0.0 if ((t <= -3.8e+65) || !(t <= 1.65e+72)) tmp = fma(Float64(x - y), Float64(z / t), y); else tmp = fma(Float64(y - x), Float64(z / a), x); end return tmp end
code[x_, y_, z_, t_, a_] := If[Or[LessEqual[t, -3.8e+65], N[Not[LessEqual[t, 1.65e+72]], $MachinePrecision]], N[(N[(x - y), $MachinePrecision] * N[(z / t), $MachinePrecision] + y), $MachinePrecision], N[(N[(y - x), $MachinePrecision] * N[(z / a), $MachinePrecision] + x), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;t \leq -3.8 \cdot 10^{+65} \lor \neg \left(t \leq 1.65 \cdot 10^{+72}\right):\\
\;\;\;\;\mathsf{fma}\left(x - y, \frac{z}{t}, y\right)\\
\mathbf{else}:\\
\;\;\;\;\mathsf{fma}\left(y - x, \frac{z}{a}, x\right)\\
\end{array}
\end{array}
if t < -3.80000000000000011e65 or 1.65e72 < t Initial program 35.3%
Taylor expanded in t around inf
associate--l+N/A
distribute-lft-out--N/A
div-subN/A
+-commutativeN/A
mul-1-negN/A
distribute-rgt-out--N/A
associate-/l*N/A
distribute-lft-neg-inN/A
mul-1-negN/A
lower-fma.f64N/A
Applied rewrites79.7%
Taylor expanded in z around inf
Applied rewrites72.5%
if -3.80000000000000011e65 < t < 1.65e72Initial program 87.0%
Taylor expanded in t around 0
+-commutativeN/A
associate-/l*N/A
*-commutativeN/A
lower-fma.f64N/A
lower-/.f64N/A
lower--.f6473.8
Applied rewrites73.8%
Applied rewrites76.6%
Final simplification74.9%
(FPCore (x y z t a) :precision binary64 (if (or (<= a -8e-37) (not (<= a 5.2e+45))) (fma (/ y a) z x) (fma (- x y) (/ z t) y)))
double code(double x, double y, double z, double t, double a) {
double tmp;
if ((a <= -8e-37) || !(a <= 5.2e+45)) {
tmp = fma((y / a), z, x);
} else {
tmp = fma((x - y), (z / t), y);
}
return tmp;
}
function code(x, y, z, t, a) tmp = 0.0 if ((a <= -8e-37) || !(a <= 5.2e+45)) tmp = fma(Float64(y / a), z, x); else tmp = fma(Float64(x - y), Float64(z / t), y); end return tmp end
code[x_, y_, z_, t_, a_] := If[Or[LessEqual[a, -8e-37], N[Not[LessEqual[a, 5.2e+45]], $MachinePrecision]], N[(N[(y / a), $MachinePrecision] * z + x), $MachinePrecision], N[(N[(x - y), $MachinePrecision] * N[(z / t), $MachinePrecision] + y), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;a \leq -8 \cdot 10^{-37} \lor \neg \left(a \leq 5.2 \cdot 10^{+45}\right):\\
\;\;\;\;\mathsf{fma}\left(\frac{y}{a}, z, x\right)\\
\mathbf{else}:\\
\;\;\;\;\mathsf{fma}\left(x - y, \frac{z}{t}, y\right)\\
\end{array}
\end{array}
if a < -8.00000000000000053e-37 or 5.20000000000000014e45 < a Initial program 66.4%
Taylor expanded in t around 0
+-commutativeN/A
associate-/l*N/A
*-commutativeN/A
lower-fma.f64N/A
lower-/.f64N/A
lower--.f6467.2
Applied rewrites67.2%
Taylor expanded in x around 0
Applied rewrites60.7%
if -8.00000000000000053e-37 < a < 5.20000000000000014e45Initial program 63.6%
Taylor expanded in t around inf
associate--l+N/A
distribute-lft-out--N/A
div-subN/A
+-commutativeN/A
mul-1-negN/A
distribute-rgt-out--N/A
associate-/l*N/A
distribute-lft-neg-inN/A
mul-1-negN/A
lower-fma.f64N/A
Applied rewrites76.9%
Taylor expanded in z around inf
Applied rewrites75.7%
Final simplification68.1%
(FPCore (x y z t a) :precision binary64 (if (or (<= t -1.9e+162) (not (<= t 3.9e+74))) (+ x (/ (- y x) 1.0)) (fma (/ y a) z x)))
double code(double x, double y, double z, double t, double a) {
double tmp;
if ((t <= -1.9e+162) || !(t <= 3.9e+74)) {
tmp = x + ((y - x) / 1.0);
} else {
tmp = fma((y / a), z, x);
}
return tmp;
}
function code(x, y, z, t, a) tmp = 0.0 if ((t <= -1.9e+162) || !(t <= 3.9e+74)) tmp = Float64(x + Float64(Float64(y - x) / 1.0)); else tmp = fma(Float64(y / a), z, x); end return tmp end
code[x_, y_, z_, t_, a_] := If[Or[LessEqual[t, -1.9e+162], N[Not[LessEqual[t, 3.9e+74]], $MachinePrecision]], N[(x + N[(N[(y - x), $MachinePrecision] / 1.0), $MachinePrecision]), $MachinePrecision], N[(N[(y / a), $MachinePrecision] * z + x), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;t \leq -1.9 \cdot 10^{+162} \lor \neg \left(t \leq 3.9 \cdot 10^{+74}\right):\\
\;\;\;\;x + \frac{y - x}{1}\\
\mathbf{else}:\\
\;\;\;\;\mathsf{fma}\left(\frac{y}{a}, z, x\right)\\
\end{array}
\end{array}
if t < -1.90000000000000012e162 or 3.90000000000000008e74 < t Initial program 33.6%
lift-/.f64N/A
lift-*.f64N/A
associate-/l*N/A
clear-numN/A
un-div-invN/A
lower-/.f64N/A
lower-/.f6471.7
Applied rewrites71.7%
Taylor expanded in t around inf
Applied rewrites44.1%
if -1.90000000000000012e162 < t < 3.90000000000000008e74Initial program 83.2%
Taylor expanded in t around 0
+-commutativeN/A
associate-/l*N/A
*-commutativeN/A
lower-fma.f64N/A
lower-/.f64N/A
lower--.f6470.5
Applied rewrites70.5%
Taylor expanded in x around 0
Applied rewrites58.3%
Final simplification53.1%
(FPCore (x y z t a) :precision binary64 (fma (/ y a) z x))
double code(double x, double y, double z, double t, double a) {
return fma((y / a), z, x);
}
function code(x, y, z, t, a) return fma(Float64(y / a), z, x) end
code[x_, y_, z_, t_, a_] := N[(N[(y / a), $MachinePrecision] * z + x), $MachinePrecision]
\begin{array}{l}
\\
\mathsf{fma}\left(\frac{y}{a}, z, x\right)
\end{array}
Initial program 65.0%
Taylor expanded in t around 0
+-commutativeN/A
associate-/l*N/A
*-commutativeN/A
lower-fma.f64N/A
lower-/.f64N/A
lower--.f6449.5
Applied rewrites49.5%
Taylor expanded in x around 0
Applied rewrites41.5%
(FPCore (x y z t a) :precision binary64 (* y (/ z a)))
double code(double x, double y, double z, double t, double a) {
return y * (z / a);
}
real(8) function code(x, y, z, t, a)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
real(8), intent (in) :: a
code = y * (z / a)
end function
public static double code(double x, double y, double z, double t, double a) {
return y * (z / a);
}
def code(x, y, z, t, a): return y * (z / a)
function code(x, y, z, t, a) return Float64(y * Float64(z / a)) end
function tmp = code(x, y, z, t, a) tmp = y * (z / a); end
code[x_, y_, z_, t_, a_] := N[(y * N[(z / a), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
y \cdot \frac{z}{a}
\end{array}
Initial program 65.0%
Taylor expanded in t around 0
+-commutativeN/A
associate-/l*N/A
*-commutativeN/A
lower-fma.f64N/A
lower-/.f64N/A
lower--.f6449.5
Applied rewrites49.5%
Taylor expanded in x around 0
Applied rewrites18.4%
Applied rewrites20.3%
(FPCore (x y z t a)
:precision binary64
(let* ((t_1 (+ x (* (/ (- y x) 1.0) (/ (- z t) (- a t))))))
(if (< a -1.6153062845442575e-142)
t_1
(if (< a 3.774403170083174e-182) (- y (* (/ z t) (- y x))) t_1))))
double code(double x, double y, double z, double t, double a) {
double t_1 = x + (((y - x) / 1.0) * ((z - t) / (a - t)));
double tmp;
if (a < -1.6153062845442575e-142) {
tmp = t_1;
} else if (a < 3.774403170083174e-182) {
tmp = y - ((z / t) * (y - x));
} else {
tmp = t_1;
}
return tmp;
}
real(8) function code(x, y, z, t, a)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
real(8), intent (in) :: a
real(8) :: t_1
real(8) :: tmp
t_1 = x + (((y - x) / 1.0d0) * ((z - t) / (a - t)))
if (a < (-1.6153062845442575d-142)) then
tmp = t_1
else if (a < 3.774403170083174d-182) then
tmp = y - ((z / t) * (y - x))
else
tmp = t_1
end if
code = tmp
end function
public static double code(double x, double y, double z, double t, double a) {
double t_1 = x + (((y - x) / 1.0) * ((z - t) / (a - t)));
double tmp;
if (a < -1.6153062845442575e-142) {
tmp = t_1;
} else if (a < 3.774403170083174e-182) {
tmp = y - ((z / t) * (y - x));
} else {
tmp = t_1;
}
return tmp;
}
def code(x, y, z, t, a): t_1 = x + (((y - x) / 1.0) * ((z - t) / (a - t))) tmp = 0 if a < -1.6153062845442575e-142: tmp = t_1 elif a < 3.774403170083174e-182: tmp = y - ((z / t) * (y - x)) else: tmp = t_1 return tmp
function code(x, y, z, t, a) t_1 = Float64(x + Float64(Float64(Float64(y - x) / 1.0) * Float64(Float64(z - t) / Float64(a - t)))) tmp = 0.0 if (a < -1.6153062845442575e-142) tmp = t_1; elseif (a < 3.774403170083174e-182) tmp = Float64(y - Float64(Float64(z / t) * Float64(y - x))); else tmp = t_1; end return tmp end
function tmp_2 = code(x, y, z, t, a) t_1 = x + (((y - x) / 1.0) * ((z - t) / (a - t))); tmp = 0.0; if (a < -1.6153062845442575e-142) tmp = t_1; elseif (a < 3.774403170083174e-182) tmp = y - ((z / t) * (y - x)); else tmp = t_1; end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_] := Block[{t$95$1 = N[(x + N[(N[(N[(y - x), $MachinePrecision] / 1.0), $MachinePrecision] * N[(N[(z - t), $MachinePrecision] / N[(a - t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, If[Less[a, -1.6153062845442575e-142], t$95$1, If[Less[a, 3.774403170083174e-182], N[(y - N[(N[(z / t), $MachinePrecision] * N[(y - x), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], t$95$1]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := x + \frac{y - x}{1} \cdot \frac{z - t}{a - t}\\
\mathbf{if}\;a < -1.6153062845442575 \cdot 10^{-142}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;a < 3.774403170083174 \cdot 10^{-182}:\\
\;\;\;\;y - \frac{z}{t} \cdot \left(y - x\right)\\
\mathbf{else}:\\
\;\;\;\;t\_1\\
\end{array}
\end{array}
herbie shell --seed 2024313
(FPCore (x y z t a)
:name "Graphics.Rendering.Chart.Axis.Types:linMap from Chart-1.5.3"
:precision binary64
:alt
(! :herbie-platform default (if (< a -646122513817703/4000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000) (+ x (* (/ (- y x) 1) (/ (- z t) (- a t)))) (if (< a 1887201585041587/50000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000) (- y (* (/ z t) (- y x))) (+ x (* (/ (- y x) 1) (/ (- z t) (- a t)))))))
(+ x (/ (* (- y x) (- z t)) (- a t))))