
(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.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-/.f6498.8
Applied rewrites98.8%
(FPCore (x y z t a)
:precision binary64
(if (<= z -6e+75)
(fma (- 1.0 (/ y z)) t x)
(if (<= z -3.5e-61)
(fma (/ z (- a z)) (- t) x)
(if (<= z 4.8e+88)
(+ (/ (* t y) (- a z)) x)
(+ (fma (/ (- y) z) t t) x)))))
double code(double x, double y, double z, double t, double a) {
double tmp;
if (z <= -6e+75) {
tmp = fma((1.0 - (y / z)), t, x);
} else if (z <= -3.5e-61) {
tmp = fma((z / (a - z)), -t, x);
} else if (z <= 4.8e+88) {
tmp = ((t * y) / (a - z)) + x;
} else {
tmp = fma((-y / z), t, t) + x;
}
return tmp;
}
function code(x, y, z, t, a) tmp = 0.0 if (z <= -6e+75) tmp = fma(Float64(1.0 - Float64(y / z)), t, x); elseif (z <= -3.5e-61) tmp = fma(Float64(z / Float64(a - z)), Float64(-t), x); elseif (z <= 4.8e+88) tmp = Float64(Float64(Float64(t * y) / Float64(a - z)) + x); else tmp = Float64(fma(Float64(Float64(-y) / z), t, t) + x); end return tmp end
code[x_, y_, z_, t_, a_] := If[LessEqual[z, -6e+75], N[(N[(1.0 - N[(y / z), $MachinePrecision]), $MachinePrecision] * t + x), $MachinePrecision], If[LessEqual[z, -3.5e-61], N[(N[(z / N[(a - z), $MachinePrecision]), $MachinePrecision] * (-t) + x), $MachinePrecision], If[LessEqual[z, 4.8e+88], N[(N[(N[(t * y), $MachinePrecision] / N[(a - z), $MachinePrecision]), $MachinePrecision] + x), $MachinePrecision], N[(N[(N[((-y) / z), $MachinePrecision] * t + t), $MachinePrecision] + x), $MachinePrecision]]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \leq -6 \cdot 10^{+75}:\\
\;\;\;\;\mathsf{fma}\left(1 - \frac{y}{z}, t, x\right)\\
\mathbf{elif}\;z \leq -3.5 \cdot 10^{-61}:\\
\;\;\;\;\mathsf{fma}\left(\frac{z}{a - z}, -t, x\right)\\
\mathbf{elif}\;z \leq 4.8 \cdot 10^{+88}:\\
\;\;\;\;\frac{t \cdot y}{a - z} + x\\
\mathbf{else}:\\
\;\;\;\;\mathsf{fma}\left(\frac{-y}{z}, t, t\right) + x\\
\end{array}
\end{array}
if z < -6e75Initial program 79.5%
Taylor expanded in a around 0
+-commutativeN/A
mul-1-negN/A
associate-/l*N/A
*-commutativeN/A
distribute-lft-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-/.f6496.3
Applied rewrites96.3%
if -6e75 < z < -3.5000000000000003e-61Initial program 97.3%
Taylor expanded in y around 0
+-commutativeN/A
mul-1-negN/A
associate-/l*N/A
*-commutativeN/A
distribute-rgt-neg-inN/A
mul-1-negN/A
lower-fma.f64N/A
lower-/.f64N/A
lower--.f64N/A
mul-1-negN/A
lower-neg.f6487.6
Applied rewrites87.6%
if -3.5000000000000003e-61 < z < 4.7999999999999998e88Initial program 95.9%
Taylor expanded in y around inf
lower-*.f6489.2
Applied rewrites89.2%
if 4.7999999999999998e88 < z Initial program 65.0%
Taylor expanded in a around 0
mul-1-negN/A
neg-sub0N/A
associate-/l*N/A
div-subN/A
sub-negN/A
*-inversesN/A
metadata-evalN/A
distribute-lft-outN/A
*-commutativeN/A
associate-/l*N/A
mul-1-negN/A
unsub-negN/A
associate-+l-N/A
neg-sub0N/A
associate-/l*N/A
*-commutativeN/A
distribute-lft-neg-inN/A
mul-1-negN/A
lower-fma.f64N/A
Applied rewrites93.4%
Final simplification91.1%
(FPCore (x y z t a)
:precision binary64
(let* ((t_1 (fma (- 1.0 (/ y z)) t x)))
(if (<= z -14000000000.0)
t_1
(if (<= z -1.4e-69)
(fma (- z) (/ t a) x)
(if (<= z 7.2e-34) (fma (/ t a) y x) t_1)))))
double code(double x, double y, double z, double t, double a) {
double t_1 = fma((1.0 - (y / z)), t, x);
double tmp;
if (z <= -14000000000.0) {
tmp = t_1;
} else if (z <= -1.4e-69) {
tmp = fma(-z, (t / a), x);
} else if (z <= 7.2e-34) {
tmp = fma((t / a), y, x);
} else {
tmp = t_1;
}
return tmp;
}
function code(x, y, z, t, a) t_1 = fma(Float64(1.0 - Float64(y / z)), t, x) tmp = 0.0 if (z <= -14000000000.0) tmp = t_1; elseif (z <= -1.4e-69) tmp = fma(Float64(-z), Float64(t / a), x); elseif (z <= 7.2e-34) tmp = fma(Float64(t / a), y, x); else tmp = t_1; end return tmp end
code[x_, y_, z_, t_, a_] := Block[{t$95$1 = N[(N[(1.0 - N[(y / z), $MachinePrecision]), $MachinePrecision] * t + x), $MachinePrecision]}, If[LessEqual[z, -14000000000.0], t$95$1, If[LessEqual[z, -1.4e-69], N[((-z) * N[(t / a), $MachinePrecision] + x), $MachinePrecision], If[LessEqual[z, 7.2e-34], N[(N[(t / a), $MachinePrecision] * y + x), $MachinePrecision], t$95$1]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := \mathsf{fma}\left(1 - \frac{y}{z}, t, x\right)\\
\mathbf{if}\;z \leq -14000000000:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;z \leq -1.4 \cdot 10^{-69}:\\
\;\;\;\;\mathsf{fma}\left(-z, \frac{t}{a}, x\right)\\
\mathbf{elif}\;z \leq 7.2 \cdot 10^{-34}:\\
\;\;\;\;\mathsf{fma}\left(\frac{t}{a}, y, x\right)\\
\mathbf{else}:\\
\;\;\;\;t\_1\\
\end{array}
\end{array}
if z < -1.4e10 or 7.20000000000000016e-34 < z Initial program 80.0%
Taylor expanded in a around 0
+-commutativeN/A
mul-1-negN/A
associate-/l*N/A
*-commutativeN/A
distribute-lft-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-/.f6491.3
Applied rewrites91.3%
if -1.4e10 < z < -1.3999999999999999e-69Initial program 95.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-/.f64100.0
Applied rewrites100.0%
Taylor expanded in a around inf
+-commutativeN/A
*-commutativeN/A
associate-/l*N/A
lower-fma.f64N/A
lower--.f64N/A
lower-/.f6476.8
Applied rewrites76.8%
Taylor expanded in y around 0
Applied rewrites81.6%
if -1.3999999999999999e-69 < z < 7.20000000000000016e-34Initial program 95.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-/.f6497.1
Applied rewrites97.1%
Taylor expanded in z around 0
+-commutativeN/A
associate-*l/N/A
lower-fma.f64N/A
lower-/.f6485.0
Applied rewrites85.0%
(FPCore (x y z t a)
:precision binary64
(if (<= z -1.4e-69)
(+ x t)
(if (<= z 1.6e-30)
(fma (/ t a) y x)
(if (<= z 3.45e+109) (fma (/ (- y) z) t x) (+ x t)))))
double code(double x, double y, double z, double t, double a) {
double tmp;
if (z <= -1.4e-69) {
tmp = x + t;
} else if (z <= 1.6e-30) {
tmp = fma((t / a), y, x);
} else if (z <= 3.45e+109) {
tmp = fma((-y / z), t, x);
} else {
tmp = x + t;
}
return tmp;
}
function code(x, y, z, t, a) tmp = 0.0 if (z <= -1.4e-69) tmp = Float64(x + t); elseif (z <= 1.6e-30) tmp = fma(Float64(t / a), y, x); elseif (z <= 3.45e+109) tmp = fma(Float64(Float64(-y) / z), t, x); else tmp = Float64(x + t); end return tmp end
code[x_, y_, z_, t_, a_] := If[LessEqual[z, -1.4e-69], N[(x + t), $MachinePrecision], If[LessEqual[z, 1.6e-30], N[(N[(t / a), $MachinePrecision] * y + x), $MachinePrecision], If[LessEqual[z, 3.45e+109], N[(N[((-y) / z), $MachinePrecision] * t + x), $MachinePrecision], N[(x + t), $MachinePrecision]]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \leq -1.4 \cdot 10^{-69}:\\
\;\;\;\;x + t\\
\mathbf{elif}\;z \leq 1.6 \cdot 10^{-30}:\\
\;\;\;\;\mathsf{fma}\left(\frac{t}{a}, y, x\right)\\
\mathbf{elif}\;z \leq 3.45 \cdot 10^{+109}:\\
\;\;\;\;\mathsf{fma}\left(\frac{-y}{z}, t, x\right)\\
\mathbf{else}:\\
\;\;\;\;x + t\\
\end{array}
\end{array}
if z < -1.3999999999999999e-69 or 3.44999999999999995e109 < z Initial program 80.9%
Taylor expanded in z around inf
lower-+.f6477.7
Applied rewrites77.7%
if -1.3999999999999999e-69 < z < 1.6e-30Initial program 95.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-/.f6497.1
Applied rewrites97.1%
Taylor expanded in z around 0
+-commutativeN/A
associate-*l/N/A
lower-fma.f64N/A
lower-/.f6485.0
Applied rewrites85.0%
if 1.6e-30 < z < 3.44999999999999995e109Initial program 88.1%
Taylor expanded in a around 0
+-commutativeN/A
mul-1-negN/A
associate-/l*N/A
*-commutativeN/A
distribute-lft-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-/.f6483.7
Applied rewrites83.7%
Taylor expanded in y around inf
Applied rewrites87.4%
Final simplification81.5%
(FPCore (x y z t a) :precision binary64 (if (<= z -330000000000.0) (fma (- 1.0 (/ y z)) t x) (if (<= z 7.2e-34) (+ (* (/ t a) (- y z)) x) (+ (fma (/ (- y) z) t t) x))))
double code(double x, double y, double z, double t, double a) {
double tmp;
if (z <= -330000000000.0) {
tmp = fma((1.0 - (y / z)), t, x);
} else if (z <= 7.2e-34) {
tmp = ((t / a) * (y - z)) + x;
} else {
tmp = fma((-y / z), t, t) + x;
}
return tmp;
}
function code(x, y, z, t, a) tmp = 0.0 if (z <= -330000000000.0) tmp = fma(Float64(1.0 - Float64(y / z)), t, x); elseif (z <= 7.2e-34) tmp = Float64(Float64(Float64(t / a) * Float64(y - z)) + x); else tmp = Float64(fma(Float64(Float64(-y) / z), t, t) + x); end return tmp end
code[x_, y_, z_, t_, a_] := If[LessEqual[z, -330000000000.0], N[(N[(1.0 - N[(y / z), $MachinePrecision]), $MachinePrecision] * t + x), $MachinePrecision], If[LessEqual[z, 7.2e-34], N[(N[(N[(t / a), $MachinePrecision] * N[(y - z), $MachinePrecision]), $MachinePrecision] + x), $MachinePrecision], N[(N[(N[((-y) / z), $MachinePrecision] * t + t), $MachinePrecision] + x), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \leq -330000000000:\\
\;\;\;\;\mathsf{fma}\left(1 - \frac{y}{z}, t, x\right)\\
\mathbf{elif}\;z \leq 7.2 \cdot 10^{-34}:\\
\;\;\;\;\frac{t}{a} \cdot \left(y - z\right) + x\\
\mathbf{else}:\\
\;\;\;\;\mathsf{fma}\left(\frac{-y}{z}, t, t\right) + x\\
\end{array}
\end{array}
if z < -3.3e11Initial program 84.8%
Taylor expanded in a around 0
+-commutativeN/A
mul-1-negN/A
associate-/l*N/A
*-commutativeN/A
distribute-lft-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-/.f6493.1
Applied rewrites93.1%
if -3.3e11 < z < 7.20000000000000016e-34Initial program 95.2%
Taylor expanded in a around inf
lower-/.f64N/A
*-commutativeN/A
lower-*.f64N/A
lower--.f6481.8
Applied rewrites81.8%
Applied rewrites85.0%
if 7.20000000000000016e-34 < z Initial program 74.8%
Taylor expanded in a around 0
mul-1-negN/A
neg-sub0N/A
associate-/l*N/A
div-subN/A
sub-negN/A
*-inversesN/A
metadata-evalN/A
distribute-lft-outN/A
*-commutativeN/A
associate-/l*N/A
mul-1-negN/A
unsub-negN/A
associate-+l-N/A
neg-sub0N/A
associate-/l*N/A
*-commutativeN/A
distribute-lft-neg-inN/A
mul-1-negN/A
lower-fma.f64N/A
Applied rewrites89.3%
Final simplification88.3%
(FPCore (x y z t a)
:precision binary64
(let* ((t_1 (fma (- 1.0 (/ y z)) t x)))
(if (<= z -330000000000.0)
t_1
(if (<= z 7.2e-34) (+ (* (/ t a) (- y z)) x) t_1))))
double code(double x, double y, double z, double t, double a) {
double t_1 = fma((1.0 - (y / z)), t, x);
double tmp;
if (z <= -330000000000.0) {
tmp = t_1;
} else if (z <= 7.2e-34) {
tmp = ((t / a) * (y - z)) + x;
} else {
tmp = t_1;
}
return tmp;
}
function code(x, y, z, t, a) t_1 = fma(Float64(1.0 - Float64(y / z)), t, x) tmp = 0.0 if (z <= -330000000000.0) tmp = t_1; elseif (z <= 7.2e-34) tmp = Float64(Float64(Float64(t / a) * Float64(y - z)) + x); else tmp = t_1; end return tmp end
code[x_, y_, z_, t_, a_] := Block[{t$95$1 = N[(N[(1.0 - N[(y / z), $MachinePrecision]), $MachinePrecision] * t + x), $MachinePrecision]}, If[LessEqual[z, -330000000000.0], t$95$1, If[LessEqual[z, 7.2e-34], N[(N[(N[(t / a), $MachinePrecision] * N[(y - z), $MachinePrecision]), $MachinePrecision] + x), $MachinePrecision], t$95$1]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := \mathsf{fma}\left(1 - \frac{y}{z}, t, x\right)\\
\mathbf{if}\;z \leq -330000000000:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;z \leq 7.2 \cdot 10^{-34}:\\
\;\;\;\;\frac{t}{a} \cdot \left(y - z\right) + x\\
\mathbf{else}:\\
\;\;\;\;t\_1\\
\end{array}
\end{array}
if z < -3.3e11 or 7.20000000000000016e-34 < z Initial program 80.0%
Taylor expanded in a around 0
+-commutativeN/A
mul-1-negN/A
associate-/l*N/A
*-commutativeN/A
distribute-lft-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-/.f6491.3
Applied rewrites91.3%
if -3.3e11 < z < 7.20000000000000016e-34Initial program 95.2%
Taylor expanded in a around inf
lower-/.f64N/A
*-commutativeN/A
lower-*.f64N/A
lower--.f6481.8
Applied rewrites81.8%
Applied rewrites85.0%
Final simplification88.2%
(FPCore (x y z t a)
:precision binary64
(let* ((t_1 (fma (- 1.0 (/ y z)) t x)))
(if (<= z -330000000000.0)
t_1
(if (<= z 7.2e-34) (fma (- y z) (/ t a) x) t_1))))
double code(double x, double y, double z, double t, double a) {
double t_1 = fma((1.0 - (y / z)), t, x);
double tmp;
if (z <= -330000000000.0) {
tmp = t_1;
} else if (z <= 7.2e-34) {
tmp = fma((y - z), (t / a), x);
} else {
tmp = t_1;
}
return tmp;
}
function code(x, y, z, t, a) t_1 = fma(Float64(1.0 - Float64(y / z)), t, x) tmp = 0.0 if (z <= -330000000000.0) tmp = t_1; elseif (z <= 7.2e-34) 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[(N[(1.0 - N[(y / z), $MachinePrecision]), $MachinePrecision] * t + x), $MachinePrecision]}, If[LessEqual[z, -330000000000.0], t$95$1, If[LessEqual[z, 7.2e-34], 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(1 - \frac{y}{z}, t, x\right)\\
\mathbf{if}\;z \leq -330000000000:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;z \leq 7.2 \cdot 10^{-34}:\\
\;\;\;\;\mathsf{fma}\left(y - z, \frac{t}{a}, x\right)\\
\mathbf{else}:\\
\;\;\;\;t\_1\\
\end{array}
\end{array}
if z < -3.3e11 or 7.20000000000000016e-34 < z Initial program 80.0%
Taylor expanded in a around 0
+-commutativeN/A
mul-1-negN/A
associate-/l*N/A
*-commutativeN/A
distribute-lft-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-/.f6491.3
Applied rewrites91.3%
if -3.3e11 < z < 7.20000000000000016e-34Initial program 95.2%
Taylor expanded in a around inf
+-commutativeN/A
*-commutativeN/A
associate-/l*N/A
lower-fma.f64N/A
lower--.f64N/A
lower-/.f6484.9
Applied rewrites84.9%
(FPCore (x y z t a) :precision binary64 (if (<= z -1.4e-69) (+ x t) (if (<= z 2.3e-33) (fma (/ t a) y x) (+ x t))))
double code(double x, double y, double z, double t, double a) {
double tmp;
if (z <= -1.4e-69) {
tmp = x + t;
} else if (z <= 2.3e-33) {
tmp = fma((t / a), y, x);
} else {
tmp = x + t;
}
return tmp;
}
function code(x, y, z, t, a) tmp = 0.0 if (z <= -1.4e-69) tmp = Float64(x + t); elseif (z <= 2.3e-33) tmp = fma(Float64(t / a), y, x); else tmp = Float64(x + t); end return tmp end
code[x_, y_, z_, t_, a_] := If[LessEqual[z, -1.4e-69], N[(x + t), $MachinePrecision], If[LessEqual[z, 2.3e-33], N[(N[(t / a), $MachinePrecision] * y + x), $MachinePrecision], N[(x + t), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \leq -1.4 \cdot 10^{-69}:\\
\;\;\;\;x + t\\
\mathbf{elif}\;z \leq 2.3 \cdot 10^{-33}:\\
\;\;\;\;\mathsf{fma}\left(\frac{t}{a}, y, x\right)\\
\mathbf{else}:\\
\;\;\;\;x + t\\
\end{array}
\end{array}
if z < -1.3999999999999999e-69 or 2.29999999999999986e-33 < z Initial program 82.0%
Taylor expanded in z around inf
lower-+.f6473.7
Applied rewrites73.7%
if -1.3999999999999999e-69 < z < 2.29999999999999986e-33Initial program 95.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-/.f6497.1
Applied rewrites97.1%
Taylor expanded in z around 0
+-commutativeN/A
associate-*l/N/A
lower-fma.f64N/A
lower-/.f6485.0
Applied rewrites85.0%
Final simplification78.2%
(FPCore (x y z t a) :precision binary64 (if (<= z -1.4e-69) (+ x t) (if (<= z 2.3e-33) (fma (/ y a) t x) (+ x t))))
double code(double x, double y, double z, double t, double a) {
double tmp;
if (z <= -1.4e-69) {
tmp = x + t;
} else if (z <= 2.3e-33) {
tmp = fma((y / a), t, x);
} else {
tmp = x + t;
}
return tmp;
}
function code(x, y, z, t, a) tmp = 0.0 if (z <= -1.4e-69) tmp = Float64(x + t); elseif (z <= 2.3e-33) tmp = fma(Float64(y / a), t, x); else tmp = Float64(x + t); end return tmp end
code[x_, y_, z_, t_, a_] := If[LessEqual[z, -1.4e-69], N[(x + t), $MachinePrecision], If[LessEqual[z, 2.3e-33], N[(N[(y / a), $MachinePrecision] * t + x), $MachinePrecision], N[(x + t), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \leq -1.4 \cdot 10^{-69}:\\
\;\;\;\;x + t\\
\mathbf{elif}\;z \leq 2.3 \cdot 10^{-33}:\\
\;\;\;\;\mathsf{fma}\left(\frac{y}{a}, t, x\right)\\
\mathbf{else}:\\
\;\;\;\;x + t\\
\end{array}
\end{array}
if z < -1.3999999999999999e-69 or 2.29999999999999986e-33 < z Initial program 82.0%
Taylor expanded in z around inf
lower-+.f6473.7
Applied rewrites73.7%
if -1.3999999999999999e-69 < z < 2.29999999999999986e-33Initial program 95.2%
Taylor expanded in z around 0
+-commutativeN/A
associate-/l*N/A
*-commutativeN/A
lower-fma.f64N/A
lower-/.f6484.9
Applied rewrites84.9%
Final simplification78.1%
(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.3%
lift-+.f64N/A
+-commutativeN/A
lift-/.f64N/A
lift-*.f64N/A
associate-/l*N/A
*-commutativeN/A
lower-fma.f64N/A
lower-/.f6495.8
Applied rewrites95.8%
(FPCore (x y z t a) :precision binary64 (if (<= t 5.8e+261) (+ x t) (/ (* t y) a)))
double code(double x, double y, double z, double t, double a) {
double tmp;
if (t <= 5.8e+261) {
tmp = x + t;
} else {
tmp = (t * y) / a;
}
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 (t <= 5.8d+261) then
tmp = x + t
else
tmp = (t * y) / a
end if
code = tmp
end function
public static double code(double x, double y, double z, double t, double a) {
double tmp;
if (t <= 5.8e+261) {
tmp = x + t;
} else {
tmp = (t * y) / a;
}
return tmp;
}
def code(x, y, z, t, a): tmp = 0 if t <= 5.8e+261: tmp = x + t else: tmp = (t * y) / a return tmp
function code(x, y, z, t, a) tmp = 0.0 if (t <= 5.8e+261) tmp = Float64(x + t); else tmp = Float64(Float64(t * y) / a); end return tmp end
function tmp_2 = code(x, y, z, t, a) tmp = 0.0; if (t <= 5.8e+261) tmp = x + t; else tmp = (t * y) / a; end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_] := If[LessEqual[t, 5.8e+261], N[(x + t), $MachinePrecision], N[(N[(t * y), $MachinePrecision] / a), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;t \leq 5.8 \cdot 10^{+261}:\\
\;\;\;\;x + t\\
\mathbf{else}:\\
\;\;\;\;\frac{t \cdot y}{a}\\
\end{array}
\end{array}
if t < 5.8e261Initial program 87.4%
Taylor expanded in z around inf
lower-+.f6462.2
Applied rewrites62.2%
if 5.8e261 < t Initial program 84.8%
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.9
Applied rewrites99.9%
Taylor expanded in a around inf
+-commutativeN/A
*-commutativeN/A
associate-/l*N/A
lower-fma.f64N/A
lower--.f64N/A
lower-/.f6461.2
Applied rewrites61.2%
Taylor expanded in y around inf
Applied rewrites60.6%
Final simplification62.1%
(FPCore (x y z t a) :precision binary64 (+ x t))
double code(double x, double y, double z, double t, double a) {
return x + 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 + t
end function
public static double code(double x, double y, double z, double t, double a) {
return x + t;
}
def code(x, y, z, t, a): return x + t
function code(x, y, z, t, a) return Float64(x + t) end
function tmp = code(x, y, z, t, a) tmp = x + t; end
code[x_, y_, z_, t_, a_] := N[(x + t), $MachinePrecision]
\begin{array}{l}
\\
x + t
\end{array}
Initial program 87.3%
Taylor expanded in z around inf
lower-+.f6460.2
Applied rewrites60.2%
Final simplification60.2%
(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 2024331
(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))))