
(FPCore (x y z t a) :precision binary64 (+ x (/ (* (- y z) (- t x)) (- a z))))
double code(double x, double y, double z, double t, double a) {
return x + (((y - z) * (t - x)) / (a - z));
}
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 - z) * (t - x)) / (a - z))
end function
public static double code(double x, double y, double z, double t, double a) {
return x + (((y - z) * (t - x)) / (a - z));
}
def code(x, y, z, t, a): return x + (((y - z) * (t - x)) / (a - z))
function code(x, y, z, t, a) return Float64(x + Float64(Float64(Float64(y - z) * Float64(t - x)) / Float64(a - z))) end
function tmp = code(x, y, z, t, a) tmp = x + (((y - z) * (t - x)) / (a - z)); end
code[x_, y_, z_, t_, a_] := N[(x + N[(N[(N[(y - z), $MachinePrecision] * N[(t - x), $MachinePrecision]), $MachinePrecision] / N[(a - z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
x + \frac{\left(y - z\right) \cdot \left(t - x\right)}{a - z}
\end{array}
Sampling outcomes in binary64 precision:
Herbie found 15 alternatives:
| Alternative | Accuracy | Speedup |
|---|
(FPCore (x y z t a) :precision binary64 (+ x (/ (* (- y z) (- t x)) (- a z))))
double code(double x, double y, double z, double t, double a) {
return x + (((y - z) * (t - x)) / (a - z));
}
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 - z) * (t - x)) / (a - z))
end function
public static double code(double x, double y, double z, double t, double a) {
return x + (((y - z) * (t - x)) / (a - z));
}
def code(x, y, z, t, a): return x + (((y - z) * (t - x)) / (a - z))
function code(x, y, z, t, a) return Float64(x + Float64(Float64(Float64(y - z) * Float64(t - x)) / Float64(a - z))) end
function tmp = code(x, y, z, t, a) tmp = x + (((y - z) * (t - x)) / (a - z)); end
code[x_, y_, z_, t_, a_] := N[(x + N[(N[(N[(y - z), $MachinePrecision] * N[(t - x), $MachinePrecision]), $MachinePrecision] / N[(a - z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
x + \frac{\left(y - z\right) \cdot \left(t - x\right)}{a - z}
\end{array}
(FPCore (x y z t a)
:precision binary64
(let* ((t_1 (fma (/ (- y a) z) (- x t) t)))
(if (<= z -3.2e+175)
t_1
(if (<= z 4.2e+111) (fma (- t x) (/ (- y z) (- a z)) x) t_1))))
double code(double x, double y, double z, double t, double a) {
double t_1 = fma(((y - a) / z), (x - t), t);
double tmp;
if (z <= -3.2e+175) {
tmp = t_1;
} else if (z <= 4.2e+111) {
tmp = fma((t - x), ((y - z) / (a - z)), x);
} else {
tmp = t_1;
}
return tmp;
}
function code(x, y, z, t, a) t_1 = fma(Float64(Float64(y - a) / z), Float64(x - t), t) tmp = 0.0 if (z <= -3.2e+175) tmp = t_1; elseif (z <= 4.2e+111) tmp = fma(Float64(t - x), Float64(Float64(y - z) / Float64(a - z)), x); else tmp = t_1; end return tmp end
code[x_, y_, z_, t_, a_] := Block[{t$95$1 = N[(N[(N[(y - a), $MachinePrecision] / z), $MachinePrecision] * N[(x - t), $MachinePrecision] + t), $MachinePrecision]}, If[LessEqual[z, -3.2e+175], t$95$1, If[LessEqual[z, 4.2e+111], N[(N[(t - x), $MachinePrecision] * N[(N[(y - z), $MachinePrecision] / N[(a - z), $MachinePrecision]), $MachinePrecision] + x), $MachinePrecision], t$95$1]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := \mathsf{fma}\left(\frac{y - a}{z}, x - t, t\right)\\
\mathbf{if}\;z \leq -3.2 \cdot 10^{+175}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;z \leq 4.2 \cdot 10^{+111}:\\
\;\;\;\;\mathsf{fma}\left(t - x, \frac{y - z}{a - z}, x\right)\\
\mathbf{else}:\\
\;\;\;\;t\_1\\
\end{array}
\end{array}
if z < -3.20000000000000022e175 or 4.1999999999999999e111 < z Initial program 17.5%
Taylor expanded in z 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 rewrites86.6%
Applied rewrites86.6%
if -3.20000000000000022e175 < z < 4.1999999999999999e111Initial program 81.4%
lift-+.f64N/A
+-commutativeN/A
lift-/.f64N/A
lift-*.f64N/A
*-commutativeN/A
associate-/l*N/A
lower-fma.f64N/A
lower-/.f6493.8
Applied rewrites93.8%
(FPCore (x y z t a) :precision binary64 (let* ((t_1 (fma (/ (- y a) z) (- x t) t))) (if (<= z -2.8e+71) t_1 (if (<= z 2.3) (fma (- t x) (/ (- y z) a) x) t_1))))
double code(double x, double y, double z, double t, double a) {
double t_1 = fma(((y - a) / z), (x - t), t);
double tmp;
if (z <= -2.8e+71) {
tmp = t_1;
} else if (z <= 2.3) {
tmp = fma((t - x), ((y - z) / a), x);
} else {
tmp = t_1;
}
return tmp;
}
function code(x, y, z, t, a) t_1 = fma(Float64(Float64(y - a) / z), Float64(x - t), t) tmp = 0.0 if (z <= -2.8e+71) tmp = t_1; elseif (z <= 2.3) tmp = fma(Float64(t - x), Float64(Float64(y - z) / a), x); else tmp = t_1; end return tmp end
code[x_, y_, z_, t_, a_] := Block[{t$95$1 = N[(N[(N[(y - a), $MachinePrecision] / z), $MachinePrecision] * N[(x - t), $MachinePrecision] + t), $MachinePrecision]}, If[LessEqual[z, -2.8e+71], t$95$1, If[LessEqual[z, 2.3], N[(N[(t - x), $MachinePrecision] * N[(N[(y - z), $MachinePrecision] / a), $MachinePrecision] + x), $MachinePrecision], t$95$1]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := \mathsf{fma}\left(\frac{y - a}{z}, x - t, t\right)\\
\mathbf{if}\;z \leq -2.8 \cdot 10^{+71}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;z \leq 2.3:\\
\;\;\;\;\mathsf{fma}\left(t - x, \frac{y - z}{a}, x\right)\\
\mathbf{else}:\\
\;\;\;\;t\_1\\
\end{array}
\end{array}
if z < -2.80000000000000002e71 or 2.2999999999999998 < z Initial program 31.1%
Taylor expanded in z 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 rewrites80.5%
Applied rewrites80.5%
if -2.80000000000000002e71 < z < 2.2999999999999998Initial program 86.7%
lift-+.f64N/A
+-commutativeN/A
lift-/.f64N/A
lift-*.f64N/A
*-commutativeN/A
associate-/l*N/A
lower-fma.f64N/A
lower-/.f6494.9
Applied rewrites94.9%
Taylor expanded in a around inf
lower-/.f64N/A
lower--.f6478.8
Applied rewrites78.8%
(FPCore (x y z t a) :precision binary64 (let* ((t_1 (fma (/ (- y a) z) (- x t) t))) (if (<= z -1.3e+71) t_1 (if (<= z 2.3) (fma (- y z) (/ (- t x) a) x) t_1))))
double code(double x, double y, double z, double t, double a) {
double t_1 = fma(((y - a) / z), (x - t), t);
double tmp;
if (z <= -1.3e+71) {
tmp = t_1;
} else if (z <= 2.3) {
tmp = fma((y - z), ((t - x) / a), x);
} else {
tmp = t_1;
}
return tmp;
}
function code(x, y, z, t, a) t_1 = fma(Float64(Float64(y - a) / z), Float64(x - t), t) tmp = 0.0 if (z <= -1.3e+71) tmp = t_1; elseif (z <= 2.3) tmp = fma(Float64(y - z), Float64(Float64(t - x) / a), x); else tmp = t_1; end return tmp end
code[x_, y_, z_, t_, a_] := Block[{t$95$1 = N[(N[(N[(y - a), $MachinePrecision] / z), $MachinePrecision] * N[(x - t), $MachinePrecision] + t), $MachinePrecision]}, If[LessEqual[z, -1.3e+71], t$95$1, If[LessEqual[z, 2.3], N[(N[(y - z), $MachinePrecision] * N[(N[(t - x), $MachinePrecision] / a), $MachinePrecision] + x), $MachinePrecision], t$95$1]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := \mathsf{fma}\left(\frac{y - a}{z}, x - t, t\right)\\
\mathbf{if}\;z \leq -1.3 \cdot 10^{+71}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;z \leq 2.3:\\
\;\;\;\;\mathsf{fma}\left(y - z, \frac{t - x}{a}, x\right)\\
\mathbf{else}:\\
\;\;\;\;t\_1\\
\end{array}
\end{array}
if z < -1.29999999999999996e71 or 2.2999999999999998 < z Initial program 31.1%
Taylor expanded in z 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 rewrites80.5%
Applied rewrites80.5%
if -1.29999999999999996e71 < z < 2.2999999999999998Initial program 86.7%
Taylor expanded in a around inf
+-commutativeN/A
*-commutativeN/A
associate-/l*N/A
lower-fma.f64N/A
lower--.f64N/A
lower-/.f64N/A
lower--.f6477.7
Applied rewrites77.7%
(FPCore (x y z t a) :precision binary64 (let* ((t_1 (fma (- y z) (/ (- t x) a) x))) (if (<= a -1.45e+19) t_1 (if (<= a 1.38e-9) (fma (- x t) (/ y z) t) t_1))))
double code(double x, double y, double z, double t, double a) {
double t_1 = fma((y - z), ((t - x) / a), x);
double tmp;
if (a <= -1.45e+19) {
tmp = t_1;
} else if (a <= 1.38e-9) {
tmp = fma((x - t), (y / z), t);
} else {
tmp = t_1;
}
return tmp;
}
function code(x, y, z, t, a) t_1 = fma(Float64(y - z), Float64(Float64(t - x) / a), x) tmp = 0.0 if (a <= -1.45e+19) tmp = t_1; elseif (a <= 1.38e-9) tmp = fma(Float64(x - t), Float64(y / z), t); else tmp = t_1; end return tmp end
code[x_, y_, z_, t_, a_] := Block[{t$95$1 = N[(N[(y - z), $MachinePrecision] * N[(N[(t - x), $MachinePrecision] / a), $MachinePrecision] + x), $MachinePrecision]}, If[LessEqual[a, -1.45e+19], t$95$1, If[LessEqual[a, 1.38e-9], N[(N[(x - t), $MachinePrecision] * N[(y / z), $MachinePrecision] + t), $MachinePrecision], t$95$1]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := \mathsf{fma}\left(y - z, \frac{t - x}{a}, x\right)\\
\mathbf{if}\;a \leq -1.45 \cdot 10^{+19}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;a \leq 1.38 \cdot 10^{-9}:\\
\;\;\;\;\mathsf{fma}\left(x - t, \frac{y}{z}, t\right)\\
\mathbf{else}:\\
\;\;\;\;t\_1\\
\end{array}
\end{array}
if a < -1.45e19 or 1.37999999999999999e-9 < a Initial program 63.3%
Taylor expanded in a around inf
+-commutativeN/A
*-commutativeN/A
associate-/l*N/A
lower-fma.f64N/A
lower--.f64N/A
lower-/.f64N/A
lower--.f6473.5
Applied rewrites73.5%
if -1.45e19 < a < 1.37999999999999999e-9Initial program 60.9%
Taylor expanded in z 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 rewrites80.5%
Taylor expanded in y around inf
Applied rewrites75.7%
Final simplification74.5%
(FPCore (x y z t a) :precision binary64 (if (<= a -1.45e+19) (fma (- t x) (/ y a) x) (if (<= a 5.2e-9) (fma (- x t) (/ y z) t) (fma y (/ (- t x) a) x))))
double code(double x, double y, double z, double t, double a) {
double tmp;
if (a <= -1.45e+19) {
tmp = fma((t - x), (y / a), x);
} else if (a <= 5.2e-9) {
tmp = fma((x - t), (y / z), t);
} else {
tmp = fma(y, ((t - x) / a), x);
}
return tmp;
}
function code(x, y, z, t, a) tmp = 0.0 if (a <= -1.45e+19) tmp = fma(Float64(t - x), Float64(y / a), x); elseif (a <= 5.2e-9) tmp = fma(Float64(x - t), Float64(y / z), t); else tmp = fma(y, Float64(Float64(t - x) / a), x); end return tmp end
code[x_, y_, z_, t_, a_] := If[LessEqual[a, -1.45e+19], N[(N[(t - x), $MachinePrecision] * N[(y / a), $MachinePrecision] + x), $MachinePrecision], If[LessEqual[a, 5.2e-9], N[(N[(x - t), $MachinePrecision] * N[(y / z), $MachinePrecision] + t), $MachinePrecision], N[(y * N[(N[(t - x), $MachinePrecision] / a), $MachinePrecision] + x), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;a \leq -1.45 \cdot 10^{+19}:\\
\;\;\;\;\mathsf{fma}\left(t - x, \frac{y}{a}, x\right)\\
\mathbf{elif}\;a \leq 5.2 \cdot 10^{-9}:\\
\;\;\;\;\mathsf{fma}\left(x - t, \frac{y}{z}, t\right)\\
\mathbf{else}:\\
\;\;\;\;\mathsf{fma}\left(y, \frac{t - x}{a}, x\right)\\
\end{array}
\end{array}
if a < -1.45e19Initial program 69.0%
lift-+.f64N/A
+-commutativeN/A
lift-/.f64N/A
lift-*.f64N/A
*-commutativeN/A
associate-/l*N/A
lower-fma.f64N/A
lower-/.f6490.4
Applied rewrites90.4%
Taylor expanded in z around 0
lower-/.f6468.6
Applied rewrites68.6%
if -1.45e19 < a < 5.2000000000000002e-9Initial program 60.9%
Taylor expanded in z 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 rewrites80.5%
Taylor expanded in y around inf
Applied rewrites75.7%
if 5.2000000000000002e-9 < a Initial program 57.7%
Taylor expanded in z around 0
+-commutativeN/A
associate-/l*N/A
lower-fma.f64N/A
lower-/.f64N/A
lower--.f6466.1
Applied rewrites66.1%
Final simplification71.2%
(FPCore (x y z t a) :precision binary64 (if (<= a -1.45e+19) (fma (- t x) (/ y a) x) (if (<= a 5.2e-9) (fma y (/ (- x t) z) t) (fma y (/ (- t x) a) x))))
double code(double x, double y, double z, double t, double a) {
double tmp;
if (a <= -1.45e+19) {
tmp = fma((t - x), (y / a), x);
} else if (a <= 5.2e-9) {
tmp = fma(y, ((x - t) / z), t);
} else {
tmp = fma(y, ((t - x) / a), x);
}
return tmp;
}
function code(x, y, z, t, a) tmp = 0.0 if (a <= -1.45e+19) tmp = fma(Float64(t - x), Float64(y / a), x); elseif (a <= 5.2e-9) tmp = fma(y, Float64(Float64(x - t) / z), t); else tmp = fma(y, Float64(Float64(t - x) / a), x); end return tmp end
code[x_, y_, z_, t_, a_] := If[LessEqual[a, -1.45e+19], N[(N[(t - x), $MachinePrecision] * N[(y / a), $MachinePrecision] + x), $MachinePrecision], If[LessEqual[a, 5.2e-9], N[(y * N[(N[(x - t), $MachinePrecision] / z), $MachinePrecision] + t), $MachinePrecision], N[(y * N[(N[(t - x), $MachinePrecision] / a), $MachinePrecision] + x), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;a \leq -1.45 \cdot 10^{+19}:\\
\;\;\;\;\mathsf{fma}\left(t - x, \frac{y}{a}, x\right)\\
\mathbf{elif}\;a \leq 5.2 \cdot 10^{-9}:\\
\;\;\;\;\mathsf{fma}\left(y, \frac{x - t}{z}, t\right)\\
\mathbf{else}:\\
\;\;\;\;\mathsf{fma}\left(y, \frac{t - x}{a}, x\right)\\
\end{array}
\end{array}
if a < -1.45e19Initial program 69.0%
lift-+.f64N/A
+-commutativeN/A
lift-/.f64N/A
lift-*.f64N/A
*-commutativeN/A
associate-/l*N/A
lower-fma.f64N/A
lower-/.f6490.4
Applied rewrites90.4%
Taylor expanded in z around 0
lower-/.f6468.6
Applied rewrites68.6%
if -1.45e19 < a < 5.2000000000000002e-9Initial program 60.9%
Taylor expanded in z 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 rewrites80.5%
Taylor expanded in a around 0
Applied rewrites73.0%
if 5.2000000000000002e-9 < a Initial program 57.7%
Taylor expanded in z around 0
+-commutativeN/A
associate-/l*N/A
lower-fma.f64N/A
lower-/.f64N/A
lower--.f6466.1
Applied rewrites66.1%
(FPCore (x y z t a) :precision binary64 (let* ((t_1 (fma y (/ (- t x) a) x))) (if (<= a -1.45e+19) t_1 (if (<= a 5.2e-9) (fma y (/ (- x t) z) t) t_1))))
double code(double x, double y, double z, double t, double a) {
double t_1 = fma(y, ((t - x) / a), x);
double tmp;
if (a <= -1.45e+19) {
tmp = t_1;
} else if (a <= 5.2e-9) {
tmp = fma(y, ((x - t) / z), t);
} else {
tmp = t_1;
}
return tmp;
}
function code(x, y, z, t, a) t_1 = fma(y, Float64(Float64(t - x) / a), x) tmp = 0.0 if (a <= -1.45e+19) tmp = t_1; elseif (a <= 5.2e-9) tmp = fma(y, Float64(Float64(x - t) / z), t); else tmp = t_1; end return tmp end
code[x_, y_, z_, t_, a_] := Block[{t$95$1 = N[(y * N[(N[(t - x), $MachinePrecision] / a), $MachinePrecision] + x), $MachinePrecision]}, If[LessEqual[a, -1.45e+19], t$95$1, If[LessEqual[a, 5.2e-9], N[(y * N[(N[(x - t), $MachinePrecision] / z), $MachinePrecision] + t), $MachinePrecision], t$95$1]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := \mathsf{fma}\left(y, \frac{t - x}{a}, x\right)\\
\mathbf{if}\;a \leq -1.45 \cdot 10^{+19}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;a \leq 5.2 \cdot 10^{-9}:\\
\;\;\;\;\mathsf{fma}\left(y, \frac{x - t}{z}, t\right)\\
\mathbf{else}:\\
\;\;\;\;t\_1\\
\end{array}
\end{array}
if a < -1.45e19 or 5.2000000000000002e-9 < a Initial program 63.3%
Taylor expanded in z around 0
+-commutativeN/A
associate-/l*N/A
lower-fma.f64N/A
lower-/.f64N/A
lower--.f6466.6
Applied rewrites66.6%
if -1.45e19 < a < 5.2000000000000002e-9Initial program 60.9%
Taylor expanded in z 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 rewrites80.5%
Taylor expanded in a around 0
Applied rewrites73.0%
(FPCore (x y z t a) :precision binary64 (if (<= a -1.55e+25) (fma (- x) (/ y a) x) (if (<= a 6.9e-9) (fma y (/ (- x t) z) t) (+ x (/ (* y t) a)))))
double code(double x, double y, double z, double t, double a) {
double tmp;
if (a <= -1.55e+25) {
tmp = fma(-x, (y / a), x);
} else if (a <= 6.9e-9) {
tmp = fma(y, ((x - t) / z), t);
} else {
tmp = x + ((y * t) / a);
}
return tmp;
}
function code(x, y, z, t, a) tmp = 0.0 if (a <= -1.55e+25) tmp = fma(Float64(-x), Float64(y / a), x); elseif (a <= 6.9e-9) tmp = fma(y, Float64(Float64(x - t) / z), t); else tmp = Float64(x + Float64(Float64(y * t) / a)); end return tmp end
code[x_, y_, z_, t_, a_] := If[LessEqual[a, -1.55e+25], N[((-x) * N[(y / a), $MachinePrecision] + x), $MachinePrecision], If[LessEqual[a, 6.9e-9], N[(y * N[(N[(x - t), $MachinePrecision] / z), $MachinePrecision] + t), $MachinePrecision], N[(x + N[(N[(y * t), $MachinePrecision] / a), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;a \leq -1.55 \cdot 10^{+25}:\\
\;\;\;\;\mathsf{fma}\left(-x, \frac{y}{a}, x\right)\\
\mathbf{elif}\;a \leq 6.9 \cdot 10^{-9}:\\
\;\;\;\;\mathsf{fma}\left(y, \frac{x - t}{z}, t\right)\\
\mathbf{else}:\\
\;\;\;\;x + \frac{y \cdot t}{a}\\
\end{array}
\end{array}
if a < -1.5499999999999999e25Initial program 68.5%
lift-+.f64N/A
+-commutativeN/A
lift-/.f64N/A
lift-*.f64N/A
*-commutativeN/A
associate-/l*N/A
lower-fma.f64N/A
lower-/.f6490.2
Applied rewrites90.2%
Taylor expanded in z around 0
lower-/.f6468.1
Applied rewrites68.1%
Taylor expanded in t around 0
mul-1-negN/A
lower-neg.f6458.8
Applied rewrites58.8%
if -1.5499999999999999e25 < a < 6.89999999999999975e-9Initial program 61.2%
Taylor expanded in z 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.9%
Taylor expanded in a around 0
Applied rewrites72.5%
if 6.89999999999999975e-9 < a Initial program 57.7%
Taylor expanded in z around 0
lower-/.f64N/A
lower-*.f64N/A
lower--.f6452.4
Applied rewrites52.4%
Taylor expanded in t around inf
Applied rewrites53.6%
(FPCore (x y z t a) :precision binary64 (if (<= a -5.1e-27) (fma (- x) (/ y a) x) (if (<= a 1.26e-9) (* y (/ (- x t) z)) (+ x (/ (* y t) a)))))
double code(double x, double y, double z, double t, double a) {
double tmp;
if (a <= -5.1e-27) {
tmp = fma(-x, (y / a), x);
} else if (a <= 1.26e-9) {
tmp = y * ((x - t) / z);
} else {
tmp = x + ((y * t) / a);
}
return tmp;
}
function code(x, y, z, t, a) tmp = 0.0 if (a <= -5.1e-27) tmp = fma(Float64(-x), Float64(y / a), x); elseif (a <= 1.26e-9) tmp = Float64(y * Float64(Float64(x - t) / z)); else tmp = Float64(x + Float64(Float64(y * t) / a)); end return tmp end
code[x_, y_, z_, t_, a_] := If[LessEqual[a, -5.1e-27], N[((-x) * N[(y / a), $MachinePrecision] + x), $MachinePrecision], If[LessEqual[a, 1.26e-9], N[(y * N[(N[(x - t), $MachinePrecision] / z), $MachinePrecision]), $MachinePrecision], N[(x + N[(N[(y * t), $MachinePrecision] / a), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;a \leq -5.1 \cdot 10^{-27}:\\
\;\;\;\;\mathsf{fma}\left(-x, \frac{y}{a}, x\right)\\
\mathbf{elif}\;a \leq 1.26 \cdot 10^{-9}:\\
\;\;\;\;y \cdot \frac{x - t}{z}\\
\mathbf{else}:\\
\;\;\;\;x + \frac{y \cdot t}{a}\\
\end{array}
\end{array}
if a < -5.0999999999999999e-27Initial program 67.7%
lift-+.f64N/A
+-commutativeN/A
lift-/.f64N/A
lift-*.f64N/A
*-commutativeN/A
associate-/l*N/A
lower-fma.f64N/A
lower-/.f6489.0
Applied rewrites89.0%
Taylor expanded in z around 0
lower-/.f6463.5
Applied rewrites63.5%
Taylor expanded in t around 0
mul-1-negN/A
lower-neg.f6453.8
Applied rewrites53.8%
if -5.0999999999999999e-27 < a < 1.25999999999999999e-9Initial program 61.1%
Taylor expanded in z 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 rewrites81.6%
Taylor expanded in y around inf
Applied rewrites43.3%
if 1.25999999999999999e-9 < a Initial program 57.7%
Taylor expanded in z around 0
lower-/.f64N/A
lower-*.f64N/A
lower--.f6452.4
Applied rewrites52.4%
Taylor expanded in t around inf
Applied rewrites53.6%
(FPCore (x y z t a) :precision binary64 (let* ((t_1 (+ x (/ (* y t) a)))) (if (<= a -1.75e-27) t_1 (if (<= a 1.26e-9) (* y (/ (- x t) z)) t_1))))
double code(double x, double y, double z, double t, double a) {
double t_1 = x + ((y * t) / a);
double tmp;
if (a <= -1.75e-27) {
tmp = t_1;
} else if (a <= 1.26e-9) {
tmp = y * ((x - t) / z);
} 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 * t) / a)
if (a <= (-1.75d-27)) then
tmp = t_1
else if (a <= 1.26d-9) then
tmp = y * ((x - t) / z)
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 * t) / a);
double tmp;
if (a <= -1.75e-27) {
tmp = t_1;
} else if (a <= 1.26e-9) {
tmp = y * ((x - t) / z);
} else {
tmp = t_1;
}
return tmp;
}
def code(x, y, z, t, a): t_1 = x + ((y * t) / a) tmp = 0 if a <= -1.75e-27: tmp = t_1 elif a <= 1.26e-9: tmp = y * ((x - t) / z) else: tmp = t_1 return tmp
function code(x, y, z, t, a) t_1 = Float64(x + Float64(Float64(y * t) / a)) tmp = 0.0 if (a <= -1.75e-27) tmp = t_1; elseif (a <= 1.26e-9) tmp = Float64(y * Float64(Float64(x - t) / z)); else tmp = t_1; end return tmp end
function tmp_2 = code(x, y, z, t, a) t_1 = x + ((y * t) / a); tmp = 0.0; if (a <= -1.75e-27) tmp = t_1; elseif (a <= 1.26e-9) tmp = y * ((x - t) / z); else tmp = t_1; end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_] := Block[{t$95$1 = N[(x + N[(N[(y * t), $MachinePrecision] / a), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[a, -1.75e-27], t$95$1, If[LessEqual[a, 1.26e-9], N[(y * N[(N[(x - t), $MachinePrecision] / z), $MachinePrecision]), $MachinePrecision], t$95$1]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := x + \frac{y \cdot t}{a}\\
\mathbf{if}\;a \leq -1.75 \cdot 10^{-27}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;a \leq 1.26 \cdot 10^{-9}:\\
\;\;\;\;y \cdot \frac{x - t}{z}\\
\mathbf{else}:\\
\;\;\;\;t\_1\\
\end{array}
\end{array}
if a < -1.7500000000000001e-27 or 1.25999999999999999e-9 < a Initial program 63.0%
Taylor expanded in z around 0
lower-/.f64N/A
lower-*.f64N/A
lower--.f6455.1
Applied rewrites55.1%
Taylor expanded in t around inf
Applied rewrites52.1%
if -1.7500000000000001e-27 < a < 1.25999999999999999e-9Initial program 61.1%
Taylor expanded in z 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 rewrites81.6%
Taylor expanded in y around inf
Applied rewrites43.3%
(FPCore (x y z t a) :precision binary64 (let* ((t_1 (+ x (- t x)))) (if (<= t -4.2e+103) t_1 (if (<= t 4.3e+86) (* x (/ (- y a) z)) t_1))))
double code(double x, double y, double z, double t, double a) {
double t_1 = x + (t - x);
double tmp;
if (t <= -4.2e+103) {
tmp = t_1;
} else if (t <= 4.3e+86) {
tmp = x * ((y - a) / z);
} 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 + (t - x)
if (t <= (-4.2d+103)) then
tmp = t_1
else if (t <= 4.3d+86) then
tmp = x * ((y - a) / z)
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 + (t - x);
double tmp;
if (t <= -4.2e+103) {
tmp = t_1;
} else if (t <= 4.3e+86) {
tmp = x * ((y - a) / z);
} else {
tmp = t_1;
}
return tmp;
}
def code(x, y, z, t, a): t_1 = x + (t - x) tmp = 0 if t <= -4.2e+103: tmp = t_1 elif t <= 4.3e+86: tmp = x * ((y - a) / z) else: tmp = t_1 return tmp
function code(x, y, z, t, a) t_1 = Float64(x + Float64(t - x)) tmp = 0.0 if (t <= -4.2e+103) tmp = t_1; elseif (t <= 4.3e+86) tmp = Float64(x * Float64(Float64(y - a) / z)); else tmp = t_1; end return tmp end
function tmp_2 = code(x, y, z, t, a) t_1 = x + (t - x); tmp = 0.0; if (t <= -4.2e+103) tmp = t_1; elseif (t <= 4.3e+86) tmp = x * ((y - a) / z); else tmp = t_1; end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_] := Block[{t$95$1 = N[(x + N[(t - x), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[t, -4.2e+103], t$95$1, If[LessEqual[t, 4.3e+86], N[(x * N[(N[(y - a), $MachinePrecision] / z), $MachinePrecision]), $MachinePrecision], t$95$1]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := x + \left(t - x\right)\\
\mathbf{if}\;t \leq -4.2 \cdot 10^{+103}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;t \leq 4.3 \cdot 10^{+86}:\\
\;\;\;\;x \cdot \frac{y - a}{z}\\
\mathbf{else}:\\
\;\;\;\;t\_1\\
\end{array}
\end{array}
if t < -4.2000000000000003e103 or 4.3000000000000002e86 < t Initial program 58.3%
Taylor expanded in z around inf
lower--.f6432.7
Applied rewrites32.7%
if -4.2000000000000003e103 < t < 4.3000000000000002e86Initial program 64.1%
Taylor expanded in z 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 rewrites51.0%
Taylor expanded in x around inf
Applied rewrites32.2%
(FPCore (x y z t a) :precision binary64 (let* ((t_1 (+ x (- t x)))) (if (<= t -2.05e+18) t_1 (if (<= t 3.8e+33) (* x (/ y z)) t_1))))
double code(double x, double y, double z, double t, double a) {
double t_1 = x + (t - x);
double tmp;
if (t <= -2.05e+18) {
tmp = t_1;
} else if (t <= 3.8e+33) {
tmp = x * (y / z);
} 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 + (t - x)
if (t <= (-2.05d+18)) then
tmp = t_1
else if (t <= 3.8d+33) then
tmp = x * (y / z)
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 + (t - x);
double tmp;
if (t <= -2.05e+18) {
tmp = t_1;
} else if (t <= 3.8e+33) {
tmp = x * (y / z);
} else {
tmp = t_1;
}
return tmp;
}
def code(x, y, z, t, a): t_1 = x + (t - x) tmp = 0 if t <= -2.05e+18: tmp = t_1 elif t <= 3.8e+33: tmp = x * (y / z) else: tmp = t_1 return tmp
function code(x, y, z, t, a) t_1 = Float64(x + Float64(t - x)) tmp = 0.0 if (t <= -2.05e+18) tmp = t_1; elseif (t <= 3.8e+33) tmp = Float64(x * Float64(y / z)); else tmp = t_1; end return tmp end
function tmp_2 = code(x, y, z, t, a) t_1 = x + (t - x); tmp = 0.0; if (t <= -2.05e+18) tmp = t_1; elseif (t <= 3.8e+33) tmp = x * (y / z); else tmp = t_1; end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_] := Block[{t$95$1 = N[(x + N[(t - x), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[t, -2.05e+18], t$95$1, If[LessEqual[t, 3.8e+33], N[(x * N[(y / z), $MachinePrecision]), $MachinePrecision], t$95$1]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := x + \left(t - x\right)\\
\mathbf{if}\;t \leq -2.05 \cdot 10^{+18}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;t \leq 3.8 \cdot 10^{+33}:\\
\;\;\;\;x \cdot \frac{y}{z}\\
\mathbf{else}:\\
\;\;\;\;t\_1\\
\end{array}
\end{array}
if t < -2.05e18 or 3.80000000000000002e33 < t Initial program 60.3%
Taylor expanded in z around inf
lower--.f6429.1
Applied rewrites29.1%
if -2.05e18 < t < 3.80000000000000002e33Initial program 63.5%
Taylor expanded in z 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 rewrites51.9%
Taylor expanded in x around inf
Applied rewrites34.3%
Taylor expanded in y around inf
Applied rewrites23.2%
(FPCore (x y z t a) :precision binary64 (let* ((t_1 (+ x (- t x)))) (if (<= t -8600000000000.0) t_1 (if (<= t 2.8e+33) (/ (* x y) z) t_1))))
double code(double x, double y, double z, double t, double a) {
double t_1 = x + (t - x);
double tmp;
if (t <= -8600000000000.0) {
tmp = t_1;
} else if (t <= 2.8e+33) {
tmp = (x * y) / z;
} 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 + (t - x)
if (t <= (-8600000000000.0d0)) then
tmp = t_1
else if (t <= 2.8d+33) then
tmp = (x * y) / z
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 + (t - x);
double tmp;
if (t <= -8600000000000.0) {
tmp = t_1;
} else if (t <= 2.8e+33) {
tmp = (x * y) / z;
} else {
tmp = t_1;
}
return tmp;
}
def code(x, y, z, t, a): t_1 = x + (t - x) tmp = 0 if t <= -8600000000000.0: tmp = t_1 elif t <= 2.8e+33: tmp = (x * y) / z else: tmp = t_1 return tmp
function code(x, y, z, t, a) t_1 = Float64(x + Float64(t - x)) tmp = 0.0 if (t <= -8600000000000.0) tmp = t_1; elseif (t <= 2.8e+33) tmp = Float64(Float64(x * y) / z); else tmp = t_1; end return tmp end
function tmp_2 = code(x, y, z, t, a) t_1 = x + (t - x); tmp = 0.0; if (t <= -8600000000000.0) tmp = t_1; elseif (t <= 2.8e+33) tmp = (x * y) / z; else tmp = t_1; end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_] := Block[{t$95$1 = N[(x + N[(t - x), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[t, -8600000000000.0], t$95$1, If[LessEqual[t, 2.8e+33], N[(N[(x * y), $MachinePrecision] / z), $MachinePrecision], t$95$1]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := x + \left(t - x\right)\\
\mathbf{if}\;t \leq -8600000000000:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;t \leq 2.8 \cdot 10^{+33}:\\
\;\;\;\;\frac{x \cdot y}{z}\\
\mathbf{else}:\\
\;\;\;\;t\_1\\
\end{array}
\end{array}
if t < -8.6e12 or 2.8000000000000001e33 < t Initial program 60.3%
Taylor expanded in z around inf
lower--.f6429.1
Applied rewrites29.1%
if -8.6e12 < t < 2.8000000000000001e33Initial program 63.5%
Taylor expanded in z 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 rewrites51.9%
Taylor expanded in x around inf
Applied rewrites34.3%
Taylor expanded in y around inf
Applied rewrites19.4%
Final simplification23.4%
(FPCore (x y z t a) :precision binary64 (+ x (- t x)))
double code(double x, double y, double z, double t, double a) {
return x + (t - x);
}
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 + (t - x)
end function
public static double code(double x, double y, double z, double t, double a) {
return x + (t - x);
}
def code(x, y, z, t, a): return x + (t - x)
function code(x, y, z, t, a) return Float64(x + Float64(t - x)) end
function tmp = code(x, y, z, t, a) tmp = x + (t - x); end
code[x_, y_, z_, t_, a_] := N[(x + N[(t - x), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
x + \left(t - x\right)
\end{array}
Initial program 62.2%
Taylor expanded in z around inf
lower--.f6416.8
Applied rewrites16.8%
(FPCore (x y z t a) :precision binary64 (+ x (- x)))
double code(double x, double y, double z, double t, double a) {
return x + -x;
}
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 + -x
end function
public static double code(double x, double y, double z, double t, double a) {
return x + -x;
}
def code(x, y, z, t, a): return x + -x
function code(x, y, z, t, a) return Float64(x + Float64(-x)) end
function tmp = code(x, y, z, t, a) tmp = x + -x; end
code[x_, y_, z_, t_, a_] := N[(x + (-x)), $MachinePrecision]
\begin{array}{l}
\\
x + \left(-x\right)
\end{array}
Initial program 62.2%
Taylor expanded in z around inf
lower--.f6416.8
Applied rewrites16.8%
Taylor expanded in t around 0
Applied rewrites2.9%
(FPCore (x y z t a)
:precision binary64
(let* ((t_1 (- t (* (/ y z) (- t x)))))
(if (< z -1.2536131056095036e+188)
t_1
(if (< z 4.446702369113811e+64)
(+ x (/ (- y z) (/ (- a z) (- t x))))
t_1))))
double code(double x, double y, double z, double t, double a) {
double t_1 = t - ((y / z) * (t - x));
double tmp;
if (z < -1.2536131056095036e+188) {
tmp = t_1;
} else if (z < 4.446702369113811e+64) {
tmp = x + ((y - z) / ((a - z) / (t - 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 = t - ((y / z) * (t - x))
if (z < (-1.2536131056095036d+188)) then
tmp = t_1
else if (z < 4.446702369113811d+64) then
tmp = x + ((y - z) / ((a - z) / (t - 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 = t - ((y / z) * (t - x));
double tmp;
if (z < -1.2536131056095036e+188) {
tmp = t_1;
} else if (z < 4.446702369113811e+64) {
tmp = x + ((y - z) / ((a - z) / (t - x)));
} else {
tmp = t_1;
}
return tmp;
}
def code(x, y, z, t, a): t_1 = t - ((y / z) * (t - x)) tmp = 0 if z < -1.2536131056095036e+188: tmp = t_1 elif z < 4.446702369113811e+64: tmp = x + ((y - z) / ((a - z) / (t - x))) else: tmp = t_1 return tmp
function code(x, y, z, t, a) t_1 = Float64(t - Float64(Float64(y / z) * Float64(t - x))) tmp = 0.0 if (z < -1.2536131056095036e+188) tmp = t_1; elseif (z < 4.446702369113811e+64) tmp = Float64(x + Float64(Float64(y - z) / Float64(Float64(a - z) / Float64(t - x)))); else tmp = t_1; end return tmp end
function tmp_2 = code(x, y, z, t, a) t_1 = t - ((y / z) * (t - x)); tmp = 0.0; if (z < -1.2536131056095036e+188) tmp = t_1; elseif (z < 4.446702369113811e+64) tmp = x + ((y - z) / ((a - z) / (t - x))); else tmp = t_1; end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_] := Block[{t$95$1 = N[(t - N[(N[(y / z), $MachinePrecision] * N[(t - x), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, If[Less[z, -1.2536131056095036e+188], t$95$1, If[Less[z, 4.446702369113811e+64], N[(x + N[(N[(y - z), $MachinePrecision] / N[(N[(a - z), $MachinePrecision] / N[(t - x), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], t$95$1]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := t - \frac{y}{z} \cdot \left(t - x\right)\\
\mathbf{if}\;z < -1.2536131056095036 \cdot 10^{+188}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;z < 4.446702369113811 \cdot 10^{+64}:\\
\;\;\;\;x + \frac{y - z}{\frac{a - z}{t - x}}\\
\mathbf{else}:\\
\;\;\;\;t\_1\\
\end{array}
\end{array}
herbie shell --seed 2024220
(FPCore (x y z t a)
:name "Graphics.Rendering.Chart.Axis.Types:invLinMap from Chart-1.5.3"
:precision binary64
:alt
(! :herbie-platform default (if (< z -125361310560950360000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000) (- t (* (/ y z) (- t x))) (if (< z 44467023691138110000000000000000000000000000000000000000000000000) (+ x (/ (- y z) (/ (- a z) (- t x)))) (- t (* (/ y z) (- t x))))))
(+ x (/ (* (- y z) (- t x)) (- a z))))