
(FPCore (x y z t a) :precision binary64 (+ x (/ (* (- y z) t) (- a z))))
double code(double x, double y, double z, double t, double a) {
return x + (((y - z) * t) / (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) / (a - z))
end function
public static double code(double x, double y, double z, double t, double a) {
return x + (((y - z) * t) / (a - z));
}
def code(x, y, z, t, a): return x + (((y - z) * t) / (a - z))
function code(x, y, z, t, a) return Float64(x + Float64(Float64(Float64(y - z) * t) / Float64(a - z))) end
function tmp = code(x, y, z, t, a) tmp = x + (((y - z) * t) / (a - z)); end
code[x_, y_, z_, t_, a_] := N[(x + N[(N[(N[(y - z), $MachinePrecision] * t), $MachinePrecision] / N[(a - z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
x + \frac{\left(y - z\right) \cdot t}{a - z}
\end{array}
Sampling outcomes in binary64 precision:
Herbie found 12 alternatives:
| Alternative | Accuracy | Speedup |
|---|
(FPCore (x y z t a) :precision binary64 (+ x (/ (* (- y z) t) (- a z))))
double code(double x, double y, double z, double t, double a) {
return x + (((y - z) * t) / (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) / (a - z))
end function
public static double code(double x, double y, double z, double t, double a) {
return x + (((y - z) * t) / (a - z));
}
def code(x, y, z, t, a): return x + (((y - z) * t) / (a - z))
function code(x, y, z, t, a) return Float64(x + Float64(Float64(Float64(y - z) * t) / Float64(a - z))) end
function tmp = code(x, y, z, t, a) tmp = x + (((y - z) * t) / (a - z)); end
code[x_, y_, z_, t_, a_] := N[(x + N[(N[(N[(y - z), $MachinePrecision] * t), $MachinePrecision] / N[(a - z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
x + \frac{\left(y - z\right) \cdot t}{a - z}
\end{array}
(FPCore (x y z t a) :precision binary64 (fma (/ (- y z) (- a z)) t x))
double code(double x, double y, double z, double t, double a) {
return fma(((y - z) / (a - z)), t, x);
}
function code(x, y, z, t, a) return fma(Float64(Float64(y - z) / Float64(a - z)), t, x) end
code[x_, y_, z_, t_, a_] := N[(N[(N[(y - z), $MachinePrecision] / N[(a - z), $MachinePrecision]), $MachinePrecision] * t + x), $MachinePrecision]
\begin{array}{l}
\\
\mathsf{fma}\left(\frac{y - z}{a - z}, t, x\right)
\end{array}
Initial program 87.4%
lift-+.f64N/A
+-commutativeN/A
lift-/.f64N/A
lift-*.f64N/A
*-commutativeN/A
associate-/l*N/A
*-commutativeN/A
lower-fma.f64N/A
lower-/.f6497.7
Applied rewrites97.7%
(FPCore (x y z t a) :precision binary64 (if (<= (/ (* (- y z) t) (- a z)) -1e+170) (* t (/ y a)) (+ t x)))
double code(double x, double y, double z, double t, double a) {
double tmp;
if ((((y - z) * t) / (a - z)) <= -1e+170) {
tmp = t * (y / a);
} else {
tmp = t + x;
}
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) :: tmp
if ((((y - z) * t) / (a - z)) <= (-1d+170)) then
tmp = t * (y / a)
else
tmp = t + x
end if
code = tmp
end function
public static double code(double x, double y, double z, double t, double a) {
double tmp;
if ((((y - z) * t) / (a - z)) <= -1e+170) {
tmp = t * (y / a);
} else {
tmp = t + x;
}
return tmp;
}
def code(x, y, z, t, a): tmp = 0 if (((y - z) * t) / (a - z)) <= -1e+170: tmp = t * (y / a) else: tmp = t + x return tmp
function code(x, y, z, t, a) tmp = 0.0 if (Float64(Float64(Float64(y - z) * t) / Float64(a - z)) <= -1e+170) tmp = Float64(t * Float64(y / a)); else tmp = Float64(t + x); end return tmp end
function tmp_2 = code(x, y, z, t, a) tmp = 0.0; if ((((y - z) * t) / (a - z)) <= -1e+170) tmp = t * (y / a); else tmp = t + x; end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_] := If[LessEqual[N[(N[(N[(y - z), $MachinePrecision] * t), $MachinePrecision] / N[(a - z), $MachinePrecision]), $MachinePrecision], -1e+170], N[(t * N[(y / a), $MachinePrecision]), $MachinePrecision], N[(t + x), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;\frac{\left(y - z\right) \cdot t}{a - z} \leq -1 \cdot 10^{+170}:\\
\;\;\;\;t \cdot \frac{y}{a}\\
\mathbf{else}:\\
\;\;\;\;t + x\\
\end{array}
\end{array}
if (/.f64 (*.f64 (-.f64 y z) t) (-.f64 a z)) < -1.00000000000000003e170Initial program 48.2%
lift-+.f64N/A
+-commutativeN/A
lift-/.f64N/A
lift-*.f64N/A
*-commutativeN/A
associate-/l*N/A
*-commutativeN/A
lower-fma.f64N/A
lower-/.f6499.7
Applied rewrites99.7%
Taylor expanded in y around inf
lower-/.f64N/A
lower-*.f64N/A
lower--.f6445.1
Applied rewrites45.1%
Taylor expanded in a around inf
Applied rewrites49.4%
if -1.00000000000000003e170 < (/.f64 (*.f64 (-.f64 y z) t) (-.f64 a z)) Initial program 93.8%
Taylor expanded in z around inf
lower-+.f6465.4
Applied rewrites65.4%
(FPCore (x y z t a)
:precision binary64
(let* ((t_1 (fma (- z) (/ t a) x)))
(if (<= z -1.15e+85)
(+ t x)
(if (<= z -7.5e-73)
t_1
(if (<= z 3e+57)
(fma y (/ t a) x)
(if (<= z 1.42e+135) t_1 (+ t x)))))))
double code(double x, double y, double z, double t, double a) {
double t_1 = fma(-z, (t / a), x);
double tmp;
if (z <= -1.15e+85) {
tmp = t + x;
} else if (z <= -7.5e-73) {
tmp = t_1;
} else if (z <= 3e+57) {
tmp = fma(y, (t / a), x);
} else if (z <= 1.42e+135) {
tmp = t_1;
} else {
tmp = t + x;
}
return tmp;
}
function code(x, y, z, t, a) t_1 = fma(Float64(-z), Float64(t / a), x) tmp = 0.0 if (z <= -1.15e+85) tmp = Float64(t + x); elseif (z <= -7.5e-73) tmp = t_1; elseif (z <= 3e+57) tmp = fma(y, Float64(t / a), x); elseif (z <= 1.42e+135) tmp = t_1; else tmp = Float64(t + x); end return tmp end
code[x_, y_, z_, t_, a_] := Block[{t$95$1 = N[((-z) * N[(t / a), $MachinePrecision] + x), $MachinePrecision]}, If[LessEqual[z, -1.15e+85], N[(t + x), $MachinePrecision], If[LessEqual[z, -7.5e-73], t$95$1, If[LessEqual[z, 3e+57], N[(y * N[(t / a), $MachinePrecision] + x), $MachinePrecision], If[LessEqual[z, 1.42e+135], t$95$1, N[(t + x), $MachinePrecision]]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := \mathsf{fma}\left(-z, \frac{t}{a}, x\right)\\
\mathbf{if}\;z \leq -1.15 \cdot 10^{+85}:\\
\;\;\;\;t + x\\
\mathbf{elif}\;z \leq -7.5 \cdot 10^{-73}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;z \leq 3 \cdot 10^{+57}:\\
\;\;\;\;\mathsf{fma}\left(y, \frac{t}{a}, x\right)\\
\mathbf{elif}\;z \leq 1.42 \cdot 10^{+135}:\\
\;\;\;\;t\_1\\
\mathbf{else}:\\
\;\;\;\;t + x\\
\end{array}
\end{array}
if z < -1.1499999999999999e85 or 1.41999999999999998e135 < z Initial program 70.2%
Taylor expanded in z around inf
lower-+.f6485.9
Applied rewrites85.9%
if -1.1499999999999999e85 < z < -7.5e-73 or 3e57 < z < 1.41999999999999998e135Initial program 91.1%
lift-+.f64N/A
+-commutativeN/A
lift-/.f64N/A
lift-*.f64N/A
*-commutativeN/A
associate-/l*N/A
*-commutativeN/A
lower-fma.f64N/A
lower-/.f6497.7
Applied rewrites97.7%
Taylor expanded in y around inf
lower-/.f64N/A
lower--.f6462.6
Applied rewrites62.6%
Taylor expanded in a around inf
+-commutativeN/A
*-commutativeN/A
associate-/l*N/A
lower-fma.f64N/A
lower--.f64N/A
lower-/.f6474.5
Applied rewrites74.5%
Taylor expanded in y around 0
Applied rewrites74.2%
if -7.5e-73 < z < 3e57Initial program 97.0%
Taylor expanded in z around 0
+-commutativeN/A
*-commutativeN/A
associate-/l*N/A
lower-fma.f64N/A
lower-/.f6484.1
Applied rewrites84.1%
(FPCore (x y z t a)
:precision binary64
(let* ((t_1 (fma (/ y (- a z)) t x)))
(if (<= y -2.8e+17)
t_1
(if (<= y 6.6e-90) (fma (/ (- z) (- a z)) t x) t_1))))
double code(double x, double y, double z, double t, double a) {
double t_1 = fma((y / (a - z)), t, x);
double tmp;
if (y <= -2.8e+17) {
tmp = t_1;
} else if (y <= 6.6e-90) {
tmp = fma((-z / (a - z)), t, x);
} else {
tmp = t_1;
}
return tmp;
}
function code(x, y, z, t, a) t_1 = fma(Float64(y / Float64(a - z)), t, x) tmp = 0.0 if (y <= -2.8e+17) tmp = t_1; elseif (y <= 6.6e-90) tmp = fma(Float64(Float64(-z) / Float64(a - z)), t, x); else tmp = t_1; end return tmp end
code[x_, y_, z_, t_, a_] := Block[{t$95$1 = N[(N[(y / N[(a - z), $MachinePrecision]), $MachinePrecision] * t + x), $MachinePrecision]}, If[LessEqual[y, -2.8e+17], t$95$1, If[LessEqual[y, 6.6e-90], N[(N[((-z) / N[(a - z), $MachinePrecision]), $MachinePrecision] * t + x), $MachinePrecision], t$95$1]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := \mathsf{fma}\left(\frac{y}{a - z}, t, x\right)\\
\mathbf{if}\;y \leq -2.8 \cdot 10^{+17}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;y \leq 6.6 \cdot 10^{-90}:\\
\;\;\;\;\mathsf{fma}\left(\frac{-z}{a - z}, t, x\right)\\
\mathbf{else}:\\
\;\;\;\;t\_1\\
\end{array}
\end{array}
if y < -2.8e17 or 6.6e-90 < y Initial program 87.3%
lift-+.f64N/A
+-commutativeN/A
lift-/.f64N/A
lift-*.f64N/A
*-commutativeN/A
associate-/l*N/A
*-commutativeN/A
lower-fma.f64N/A
lower-/.f6496.3
Applied rewrites96.3%
Taylor expanded in y around inf
lower-/.f64N/A
lower--.f6484.3
Applied rewrites84.3%
if -2.8e17 < y < 6.6e-90Initial program 87.5%
lift-+.f64N/A
+-commutativeN/A
lift-/.f64N/A
lift-*.f64N/A
*-commutativeN/A
associate-/l*N/A
*-commutativeN/A
lower-fma.f64N/A
lower-/.f6499.2
Applied rewrites99.2%
Taylor expanded in y around 0
mul-1-negN/A
lower-neg.f6494.3
Applied rewrites94.3%
(FPCore (x y z t a) :precision binary64 (let* ((t_1 (fma (/ y (- a z)) t x))) (if (<= y -2.8e+17) t_1 (if (<= y 5.2e+48) (+ x (* z (/ t (- z a)))) t_1))))
double code(double x, double y, double z, double t, double a) {
double t_1 = fma((y / (a - z)), t, x);
double tmp;
if (y <= -2.8e+17) {
tmp = t_1;
} else if (y <= 5.2e+48) {
tmp = x + (z * (t / (z - a)));
} else {
tmp = t_1;
}
return tmp;
}
function code(x, y, z, t, a) t_1 = fma(Float64(y / Float64(a - z)), t, x) tmp = 0.0 if (y <= -2.8e+17) tmp = t_1; elseif (y <= 5.2e+48) tmp = Float64(x + Float64(z * Float64(t / Float64(z - a)))); else tmp = t_1; end return tmp end
code[x_, y_, z_, t_, a_] := Block[{t$95$1 = N[(N[(y / N[(a - z), $MachinePrecision]), $MachinePrecision] * t + x), $MachinePrecision]}, If[LessEqual[y, -2.8e+17], t$95$1, If[LessEqual[y, 5.2e+48], N[(x + N[(z * N[(t / N[(z - a), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], t$95$1]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := \mathsf{fma}\left(\frac{y}{a - z}, t, x\right)\\
\mathbf{if}\;y \leq -2.8 \cdot 10^{+17}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;y \leq 5.2 \cdot 10^{+48}:\\
\;\;\;\;x + z \cdot \frac{t}{z - a}\\
\mathbf{else}:\\
\;\;\;\;t\_1\\
\end{array}
\end{array}
if y < -2.8e17 or 5.1999999999999999e48 < y Initial program 85.3%
lift-+.f64N/A
+-commutativeN/A
lift-/.f64N/A
lift-*.f64N/A
*-commutativeN/A
associate-/l*N/A
*-commutativeN/A
lower-fma.f64N/A
lower-/.f6495.2
Applied rewrites95.2%
Taylor expanded in y around inf
lower-/.f64N/A
lower--.f6485.2
Applied rewrites85.2%
if -2.8e17 < y < 5.1999999999999999e48Initial program 88.8%
Taylor expanded in y around 0
mul-1-negN/A
unsub-negN/A
lower--.f64N/A
*-commutativeN/A
associate-/l*N/A
lower-*.f64N/A
lower-/.f64N/A
lower--.f6491.4
Applied rewrites91.4%
Final simplification88.9%
(FPCore (x y z t a) :precision binary64 (let* ((t_1 (fma t (- 1.0 (/ y z)) x))) (if (<= z -1.15e+115) t_1 (if (<= z 7.8e+39) (fma (/ y (- a z)) t x) t_1))))
double code(double x, double y, double z, double t, double a) {
double t_1 = fma(t, (1.0 - (y / z)), x);
double tmp;
if (z <= -1.15e+115) {
tmp = t_1;
} else if (z <= 7.8e+39) {
tmp = fma((y / (a - z)), t, x);
} else {
tmp = t_1;
}
return tmp;
}
function code(x, y, z, t, a) t_1 = fma(t, Float64(1.0 - Float64(y / z)), x) tmp = 0.0 if (z <= -1.15e+115) tmp = t_1; elseif (z <= 7.8e+39) tmp = fma(Float64(y / Float64(a - z)), t, x); else tmp = t_1; end return tmp end
code[x_, y_, z_, t_, a_] := Block[{t$95$1 = N[(t * N[(1.0 - N[(y / z), $MachinePrecision]), $MachinePrecision] + x), $MachinePrecision]}, If[LessEqual[z, -1.15e+115], t$95$1, If[LessEqual[z, 7.8e+39], N[(N[(y / N[(a - z), $MachinePrecision]), $MachinePrecision] * t + x), $MachinePrecision], t$95$1]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := \mathsf{fma}\left(t, 1 - \frac{y}{z}, x\right)\\
\mathbf{if}\;z \leq -1.15 \cdot 10^{+115}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;z \leq 7.8 \cdot 10^{+39}:\\
\;\;\;\;\mathsf{fma}\left(\frac{y}{a - z}, t, x\right)\\
\mathbf{else}:\\
\;\;\;\;t\_1\\
\end{array}
\end{array}
if z < -1.15000000000000002e115 or 7.8000000000000002e39 < z Initial program 71.9%
Taylor expanded in a around 0
+-commutativeN/A
mul-1-negN/A
associate-/l*N/A
distribute-rgt-neg-inN/A
lower-fma.f64N/A
neg-sub0N/A
div-subN/A
*-inversesN/A
associate-+l-N/A
neg-sub0N/A
mul-1-negN/A
+-commutativeN/A
mul-1-negN/A
unsub-negN/A
lower--.f64N/A
lower-/.f6487.6
Applied rewrites87.6%
if -1.15000000000000002e115 < z < 7.8000000000000002e39Initial program 96.4%
lift-+.f64N/A
+-commutativeN/A
lift-/.f64N/A
lift-*.f64N/A
*-commutativeN/A
associate-/l*N/A
*-commutativeN/A
lower-fma.f64N/A
lower-/.f6496.4
Applied rewrites96.4%
Taylor expanded in y around inf
lower-/.f64N/A
lower--.f6487.1
Applied rewrites87.1%
(FPCore (x y z t a)
:precision binary64
(let* ((t_1 (fma t (- 1.0 (/ y z)) x)))
(if (<= z -1.55e+40)
t_1
(if (<= z 1.42e+135) (fma (- y z) (/ t a) x) t_1))))
double code(double x, double y, double z, double t, double a) {
double t_1 = fma(t, (1.0 - (y / z)), x);
double tmp;
if (z <= -1.55e+40) {
tmp = t_1;
} else if (z <= 1.42e+135) {
tmp = fma((y - z), (t / a), x);
} else {
tmp = t_1;
}
return tmp;
}
function code(x, y, z, t, a) t_1 = fma(t, Float64(1.0 - Float64(y / z)), x) tmp = 0.0 if (z <= -1.55e+40) tmp = t_1; elseif (z <= 1.42e+135) tmp = fma(Float64(y - z), Float64(t / a), x); else tmp = t_1; end return tmp end
code[x_, y_, z_, t_, a_] := Block[{t$95$1 = N[(t * N[(1.0 - N[(y / z), $MachinePrecision]), $MachinePrecision] + x), $MachinePrecision]}, If[LessEqual[z, -1.55e+40], t$95$1, If[LessEqual[z, 1.42e+135], N[(N[(y - z), $MachinePrecision] * N[(t / a), $MachinePrecision] + x), $MachinePrecision], t$95$1]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := \mathsf{fma}\left(t, 1 - \frac{y}{z}, x\right)\\
\mathbf{if}\;z \leq -1.55 \cdot 10^{+40}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;z \leq 1.42 \cdot 10^{+135}:\\
\;\;\;\;\mathsf{fma}\left(y - z, \frac{t}{a}, x\right)\\
\mathbf{else}:\\
\;\;\;\;t\_1\\
\end{array}
\end{array}
if z < -1.5499999999999999e40 or 1.41999999999999998e135 < z Initial program 71.1%
Taylor expanded in a around 0
+-commutativeN/A
mul-1-negN/A
associate-/l*N/A
distribute-rgt-neg-inN/A
lower-fma.f64N/A
neg-sub0N/A
div-subN/A
*-inversesN/A
associate-+l-N/A
neg-sub0N/A
mul-1-negN/A
+-commutativeN/A
mul-1-negN/A
unsub-negN/A
lower--.f64N/A
lower-/.f6492.2
Applied rewrites92.2%
if -1.5499999999999999e40 < z < 1.41999999999999998e135Initial program 95.9%
lift-+.f64N/A
+-commutativeN/A
lift-/.f64N/A
lift-*.f64N/A
*-commutativeN/A
associate-/l*N/A
*-commutativeN/A
lower-fma.f64N/A
lower-/.f6496.5
Applied rewrites96.5%
Taylor expanded in y around inf
lower-/.f64N/A
lower--.f6482.6
Applied rewrites82.6%
Taylor expanded in a around inf
+-commutativeN/A
*-commutativeN/A
associate-/l*N/A
lower-fma.f64N/A
lower--.f64N/A
lower-/.f6483.6
Applied rewrites83.6%
(FPCore (x y z t a)
:precision binary64
(let* ((t_1 (fma t (- 1.0 (/ y z)) x)))
(if (<= z -1.55e+40)
t_1
(if (<= z 1.42e+135) (fma t (/ (- y z) a) x) t_1))))
double code(double x, double y, double z, double t, double a) {
double t_1 = fma(t, (1.0 - (y / z)), x);
double tmp;
if (z <= -1.55e+40) {
tmp = t_1;
} else if (z <= 1.42e+135) {
tmp = fma(t, ((y - z) / a), x);
} else {
tmp = t_1;
}
return tmp;
}
function code(x, y, z, t, a) t_1 = fma(t, Float64(1.0 - Float64(y / z)), x) tmp = 0.0 if (z <= -1.55e+40) tmp = t_1; elseif (z <= 1.42e+135) tmp = fma(t, 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[(t * N[(1.0 - N[(y / z), $MachinePrecision]), $MachinePrecision] + x), $MachinePrecision]}, If[LessEqual[z, -1.55e+40], t$95$1, If[LessEqual[z, 1.42e+135], N[(t * N[(N[(y - z), $MachinePrecision] / a), $MachinePrecision] + x), $MachinePrecision], t$95$1]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := \mathsf{fma}\left(t, 1 - \frac{y}{z}, x\right)\\
\mathbf{if}\;z \leq -1.55 \cdot 10^{+40}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;z \leq 1.42 \cdot 10^{+135}:\\
\;\;\;\;\mathsf{fma}\left(t, \frac{y - z}{a}, x\right)\\
\mathbf{else}:\\
\;\;\;\;t\_1\\
\end{array}
\end{array}
if z < -1.5499999999999999e40 or 1.41999999999999998e135 < z Initial program 71.1%
Taylor expanded in a around 0
+-commutativeN/A
mul-1-negN/A
associate-/l*N/A
distribute-rgt-neg-inN/A
lower-fma.f64N/A
neg-sub0N/A
div-subN/A
*-inversesN/A
associate-+l-N/A
neg-sub0N/A
mul-1-negN/A
+-commutativeN/A
mul-1-negN/A
unsub-negN/A
lower--.f64N/A
lower-/.f6492.2
Applied rewrites92.2%
if -1.5499999999999999e40 < z < 1.41999999999999998e135Initial program 95.9%
Taylor expanded in a around inf
+-commutativeN/A
associate-/l*N/A
lower-fma.f64N/A
lower-/.f64N/A
lower--.f6481.4
Applied rewrites81.4%
(FPCore (x y z t a) :precision binary64 (let* ((t_1 (fma t (- 1.0 (/ y z)) x))) (if (<= z -4.2e-55) t_1 (if (<= z 1.5e+38) (fma y (/ t a) x) t_1))))
double code(double x, double y, double z, double t, double a) {
double t_1 = fma(t, (1.0 - (y / z)), x);
double tmp;
if (z <= -4.2e-55) {
tmp = t_1;
} else if (z <= 1.5e+38) {
tmp = fma(y, (t / a), x);
} else {
tmp = t_1;
}
return tmp;
}
function code(x, y, z, t, a) t_1 = fma(t, Float64(1.0 - Float64(y / z)), x) tmp = 0.0 if (z <= -4.2e-55) tmp = t_1; elseif (z <= 1.5e+38) tmp = fma(y, Float64(t / a), x); else tmp = t_1; end return tmp end
code[x_, y_, z_, t_, a_] := Block[{t$95$1 = N[(t * N[(1.0 - N[(y / z), $MachinePrecision]), $MachinePrecision] + x), $MachinePrecision]}, If[LessEqual[z, -4.2e-55], t$95$1, If[LessEqual[z, 1.5e+38], N[(y * N[(t / a), $MachinePrecision] + x), $MachinePrecision], t$95$1]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := \mathsf{fma}\left(t, 1 - \frac{y}{z}, x\right)\\
\mathbf{if}\;z \leq -4.2 \cdot 10^{-55}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;z \leq 1.5 \cdot 10^{+38}:\\
\;\;\;\;\mathsf{fma}\left(y, \frac{t}{a}, x\right)\\
\mathbf{else}:\\
\;\;\;\;t\_1\\
\end{array}
\end{array}
if z < -4.2000000000000003e-55 or 1.5000000000000001e38 < z Initial program 77.2%
Taylor expanded in a around 0
+-commutativeN/A
mul-1-negN/A
associate-/l*N/A
distribute-rgt-neg-inN/A
lower-fma.f64N/A
neg-sub0N/A
div-subN/A
*-inversesN/A
associate-+l-N/A
neg-sub0N/A
mul-1-negN/A
+-commutativeN/A
mul-1-negN/A
unsub-negN/A
lower--.f64N/A
lower-/.f6484.2
Applied rewrites84.2%
if -4.2000000000000003e-55 < z < 1.5000000000000001e38Initial program 97.0%
Taylor expanded in z around 0
+-commutativeN/A
*-commutativeN/A
associate-/l*N/A
lower-fma.f64N/A
lower-/.f6483.5
Applied rewrites83.5%
(FPCore (x y z t a) :precision binary64 (if (<= z -1.15e+115) (+ t x) (if (<= z 4.8e+59) (fma y (/ t a) x) (+ t x))))
double code(double x, double y, double z, double t, double a) {
double tmp;
if (z <= -1.15e+115) {
tmp = t + x;
} else if (z <= 4.8e+59) {
tmp = fma(y, (t / a), x);
} else {
tmp = t + x;
}
return tmp;
}
function code(x, y, z, t, a) tmp = 0.0 if (z <= -1.15e+115) tmp = Float64(t + x); elseif (z <= 4.8e+59) tmp = fma(y, Float64(t / a), x); else tmp = Float64(t + x); end return tmp end
code[x_, y_, z_, t_, a_] := If[LessEqual[z, -1.15e+115], N[(t + x), $MachinePrecision], If[LessEqual[z, 4.8e+59], N[(y * N[(t / a), $MachinePrecision] + x), $MachinePrecision], N[(t + x), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \leq -1.15 \cdot 10^{+115}:\\
\;\;\;\;t + x\\
\mathbf{elif}\;z \leq 4.8 \cdot 10^{+59}:\\
\;\;\;\;\mathsf{fma}\left(y, \frac{t}{a}, x\right)\\
\mathbf{else}:\\
\;\;\;\;t + x\\
\end{array}
\end{array}
if z < -1.15000000000000002e115 or 4.8000000000000004e59 < z Initial program 71.0%
Taylor expanded in z around inf
lower-+.f6480.1
Applied rewrites80.1%
if -1.15000000000000002e115 < z < 4.8000000000000004e59Initial program 96.4%
Taylor expanded in z around 0
+-commutativeN/A
*-commutativeN/A
associate-/l*N/A
lower-fma.f64N/A
lower-/.f6479.3
Applied rewrites79.3%
(FPCore (x y z t a) :precision binary64 (fma (/ t (- a z)) (- y z) x))
double code(double x, double y, double z, double t, double a) {
return fma((t / (a - z)), (y - z), x);
}
function code(x, y, z, t, a) return fma(Float64(t / Float64(a - z)), Float64(y - z), x) end
code[x_, y_, z_, t_, a_] := N[(N[(t / N[(a - z), $MachinePrecision]), $MachinePrecision] * N[(y - z), $MachinePrecision] + x), $MachinePrecision]
\begin{array}{l}
\\
\mathsf{fma}\left(\frac{t}{a - z}, y - z, x\right)
\end{array}
Initial program 87.4%
lift-+.f64N/A
+-commutativeN/A
lift-/.f64N/A
lift-*.f64N/A
associate-/l*N/A
*-commutativeN/A
lower-fma.f64N/A
lower-/.f6496.9
Applied rewrites96.9%
(FPCore (x y z t a) :precision binary64 (+ t x))
double code(double x, double y, double z, double t, double a) {
return 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 = t + x
end function
public static double code(double x, double y, double z, double t, double a) {
return t + x;
}
def code(x, y, z, t, a): return t + x
function code(x, y, z, t, a) return Float64(t + x) end
function tmp = code(x, y, z, t, a) tmp = t + x; end
code[x_, y_, z_, t_, a_] := N[(t + x), $MachinePrecision]
\begin{array}{l}
\\
t + x
\end{array}
Initial program 87.4%
Taylor expanded in z around inf
lower-+.f6459.7
Applied rewrites59.7%
(FPCore (x y z t a)
:precision binary64
(let* ((t_1 (+ x (* (/ (- y z) (- a z)) t))))
(if (< t -1.0682974490174067e-39)
t_1
(if (< t 3.9110949887586375e-141) (+ x (/ (* (- y z) t) (- a z))) t_1))))
double code(double x, double y, double z, double t, double a) {
double t_1 = x + (((y - z) / (a - z)) * t);
double tmp;
if (t < -1.0682974490174067e-39) {
tmp = t_1;
} else if (t < 3.9110949887586375e-141) {
tmp = x + (((y - z) * t) / (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 + (((y - z) / (a - z)) * t)
if (t < (-1.0682974490174067d-39)) then
tmp = t_1
else if (t < 3.9110949887586375d-141) then
tmp = x + (((y - z) * t) / (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 + (((y - z) / (a - z)) * t);
double tmp;
if (t < -1.0682974490174067e-39) {
tmp = t_1;
} else if (t < 3.9110949887586375e-141) {
tmp = x + (((y - z) * t) / (a - z));
} else {
tmp = t_1;
}
return tmp;
}
def code(x, y, z, t, a): t_1 = x + (((y - z) / (a - z)) * t) tmp = 0 if t < -1.0682974490174067e-39: tmp = t_1 elif t < 3.9110949887586375e-141: tmp = x + (((y - z) * t) / (a - z)) else: tmp = t_1 return tmp
function code(x, y, z, t, a) t_1 = Float64(x + Float64(Float64(Float64(y - z) / Float64(a - z)) * t)) tmp = 0.0 if (t < -1.0682974490174067e-39) tmp = t_1; elseif (t < 3.9110949887586375e-141) tmp = Float64(x + Float64(Float64(Float64(y - z) * t) / Float64(a - z))); else tmp = t_1; end return tmp end
function tmp_2 = code(x, y, z, t, a) t_1 = x + (((y - z) / (a - z)) * t); tmp = 0.0; if (t < -1.0682974490174067e-39) tmp = t_1; elseif (t < 3.9110949887586375e-141) tmp = x + (((y - z) * t) / (a - z)); 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 - z), $MachinePrecision] / N[(a - z), $MachinePrecision]), $MachinePrecision] * t), $MachinePrecision]), $MachinePrecision]}, If[Less[t, -1.0682974490174067e-39], t$95$1, If[Less[t, 3.9110949887586375e-141], N[(x + N[(N[(N[(y - z), $MachinePrecision] * t), $MachinePrecision] / N[(a - z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], t$95$1]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := x + \frac{y - z}{a - z} \cdot t\\
\mathbf{if}\;t < -1.0682974490174067 \cdot 10^{-39}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;t < 3.9110949887586375 \cdot 10^{-141}:\\
\;\;\;\;x + \frac{\left(y - z\right) \cdot t}{a - z}\\
\mathbf{else}:\\
\;\;\;\;t\_1\\
\end{array}
\end{array}
herbie shell --seed 2024233
(FPCore (x y z t a)
:name "Graphics.Rendering.Plot.Render.Plot.Axis:renderAxisTick from plot-0.2.3.4, A"
:precision binary64
:alt
(! :herbie-platform default (if (< t -10682974490174067/10000000000000000000000000000000000000000000000000000000) (+ x (* (/ (- y z) (- a z)) t)) (if (< t 312887599100691/80000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000) (+ x (/ (* (- y z) t) (- a z))) (+ x (* (/ (- y z) (- a z)) t)))))
(+ x (/ (* (- y z) t) (- a z))))