
(FPCore (x y z t a) :precision binary64 (+ x (/ (* y (- z t)) (- a t))))
double code(double x, double y, double z, double t, double a) {
return x + ((y * (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 * (z - t)) / (a - t))
end function
public static double code(double x, double y, double z, double t, double a) {
return x + ((y * (z - t)) / (a - t));
}
def code(x, y, z, t, a): return x + ((y * (z - t)) / (a - t))
function code(x, y, z, t, a) return Float64(x + Float64(Float64(y * Float64(z - t)) / Float64(a - t))) end
function tmp = code(x, y, z, t, a) tmp = x + ((y * (z - t)) / (a - t)); end
code[x_, y_, z_, t_, a_] := N[(x + N[(N[(y * N[(z - t), $MachinePrecision]), $MachinePrecision] / N[(a - t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
x + \frac{y \cdot \left(z - t\right)}{a - t}
\end{array}
Sampling outcomes in binary64 precision:
Herbie found 13 alternatives:
| Alternative | Accuracy | Speedup |
|---|
(FPCore (x y z t a) :precision binary64 (+ x (/ (* y (- z t)) (- a t))))
double code(double x, double y, double z, double t, double a) {
return x + ((y * (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 * (z - t)) / (a - t))
end function
public static double code(double x, double y, double z, double t, double a) {
return x + ((y * (z - t)) / (a - t));
}
def code(x, y, z, t, a): return x + ((y * (z - t)) / (a - t))
function code(x, y, z, t, a) return Float64(x + Float64(Float64(y * Float64(z - t)) / Float64(a - t))) end
function tmp = code(x, y, z, t, a) tmp = x + ((y * (z - t)) / (a - t)); end
code[x_, y_, z_, t_, a_] := N[(x + N[(N[(y * N[(z - t), $MachinePrecision]), $MachinePrecision] / N[(a - t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
x + \frac{y \cdot \left(z - t\right)}{a - t}
\end{array}
(FPCore (x y z t a) :precision binary64 (+ (/ y (/ (- a t) (- z t))) x))
double code(double x, double y, double z, double t, double a) {
return (y / ((a - t) / (z - 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 = (y / ((a - t) / (z - t))) + x
end function
public static double code(double x, double y, double z, double t, double a) {
return (y / ((a - t) / (z - t))) + x;
}
def code(x, y, z, t, a): return (y / ((a - t) / (z - t))) + x
function code(x, y, z, t, a) return Float64(Float64(y / Float64(Float64(a - t) / Float64(z - t))) + x) end
function tmp = code(x, y, z, t, a) tmp = (y / ((a - t) / (z - t))) + x; end
code[x_, y_, z_, t_, a_] := N[(N[(y / N[(N[(a - t), $MachinePrecision] / N[(z - t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + x), $MachinePrecision]
\begin{array}{l}
\\
\frac{y}{\frac{a - t}{z - t}} + x
\end{array}
Initial program 82.6%
lift-/.f64N/A
lift-*.f64N/A
associate-/l*N/A
clear-numN/A
un-div-invN/A
lower-/.f64N/A
lower-/.f6498.1
Applied rewrites98.1%
Final simplification98.1%
(FPCore (x y z t a) :precision binary64 (let* ((t_1 (* (/ y (- a t)) (- z t))) (t_2 (/ (* (- z t) y) (- a t)))) (if (<= t_2 (- INFINITY)) t_1 (if (<= t_2 3e+264) (+ t_2 x) t_1))))
double code(double x, double y, double z, double t, double a) {
double t_1 = (y / (a - t)) * (z - t);
double t_2 = ((z - t) * y) / (a - t);
double tmp;
if (t_2 <= -((double) INFINITY)) {
tmp = t_1;
} else if (t_2 <= 3e+264) {
tmp = t_2 + x;
} else {
tmp = t_1;
}
return tmp;
}
public static double code(double x, double y, double z, double t, double a) {
double t_1 = (y / (a - t)) * (z - t);
double t_2 = ((z - t) * y) / (a - t);
double tmp;
if (t_2 <= -Double.POSITIVE_INFINITY) {
tmp = t_1;
} else if (t_2 <= 3e+264) {
tmp = t_2 + x;
} else {
tmp = t_1;
}
return tmp;
}
def code(x, y, z, t, a): t_1 = (y / (a - t)) * (z - t) t_2 = ((z - t) * y) / (a - t) tmp = 0 if t_2 <= -math.inf: tmp = t_1 elif t_2 <= 3e+264: tmp = t_2 + x else: tmp = t_1 return tmp
function code(x, y, z, t, a) t_1 = Float64(Float64(y / Float64(a - t)) * Float64(z - t)) t_2 = Float64(Float64(Float64(z - t) * y) / Float64(a - t)) tmp = 0.0 if (t_2 <= Float64(-Inf)) tmp = t_1; elseif (t_2 <= 3e+264) tmp = Float64(t_2 + x); else tmp = t_1; end return tmp end
function tmp_2 = code(x, y, z, t, a) t_1 = (y / (a - t)) * (z - t); t_2 = ((z - t) * y) / (a - t); tmp = 0.0; if (t_2 <= -Inf) tmp = t_1; elseif (t_2 <= 3e+264) tmp = t_2 + x; else tmp = t_1; end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_] := Block[{t$95$1 = N[(N[(y / N[(a - t), $MachinePrecision]), $MachinePrecision] * N[(z - t), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$2 = N[(N[(N[(z - t), $MachinePrecision] * y), $MachinePrecision] / N[(a - t), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[t$95$2, (-Infinity)], t$95$1, If[LessEqual[t$95$2, 3e+264], N[(t$95$2 + x), $MachinePrecision], t$95$1]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := \frac{y}{a - t} \cdot \left(z - t\right)\\
t_2 := \frac{\left(z - t\right) \cdot y}{a - t}\\
\mathbf{if}\;t\_2 \leq -\infty:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;t\_2 \leq 3 \cdot 10^{+264}:\\
\;\;\;\;t\_2 + x\\
\mathbf{else}:\\
\;\;\;\;t\_1\\
\end{array}
\end{array}
if (/.f64 (*.f64 y (-.f64 z t)) (-.f64 a t)) < -inf.0 or 3e264 < (/.f64 (*.f64 y (-.f64 z t)) (-.f64 a t)) Initial program 38.0%
Taylor expanded in x around 0
associate-/l*N/A
div-subN/A
distribute-lft-out--N/A
associate-/l*N/A
*-commutativeN/A
associate-*r/N/A
associate-/l*N/A
*-commutativeN/A
associate-/l*N/A
distribute-rgt-out--N/A
lower-*.f64N/A
lower-/.f64N/A
lower--.f64N/A
lower--.f6491.1
Applied rewrites91.1%
if -inf.0 < (/.f64 (*.f64 y (-.f64 z t)) (-.f64 a t)) < 3e264Initial program 99.7%
Final simplification97.3%
(FPCore (x y z t a) :precision binary64 (let* ((t_1 (* (/ y (- a t)) (- z t))) (t_2 (/ (* (- z t) y) (- a t)))) (if (<= t_2 -5e+40) t_1 (if (<= t_2 4e+66) (fma y (/ t (- t a)) x) t_1))))
double code(double x, double y, double z, double t, double a) {
double t_1 = (y / (a - t)) * (z - t);
double t_2 = ((z - t) * y) / (a - t);
double tmp;
if (t_2 <= -5e+40) {
tmp = t_1;
} else if (t_2 <= 4e+66) {
tmp = fma(y, (t / (t - a)), x);
} else {
tmp = t_1;
}
return tmp;
}
function code(x, y, z, t, a) t_1 = Float64(Float64(y / Float64(a - t)) * Float64(z - t)) t_2 = Float64(Float64(Float64(z - t) * y) / Float64(a - t)) tmp = 0.0 if (t_2 <= -5e+40) tmp = t_1; elseif (t_2 <= 4e+66) tmp = fma(y, Float64(t / Float64(t - a)), x); else tmp = t_1; end return tmp end
code[x_, y_, z_, t_, a_] := Block[{t$95$1 = N[(N[(y / N[(a - t), $MachinePrecision]), $MachinePrecision] * N[(z - t), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$2 = N[(N[(N[(z - t), $MachinePrecision] * y), $MachinePrecision] / N[(a - t), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[t$95$2, -5e+40], t$95$1, If[LessEqual[t$95$2, 4e+66], N[(y * N[(t / N[(t - a), $MachinePrecision]), $MachinePrecision] + x), $MachinePrecision], t$95$1]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := \frac{y}{a - t} \cdot \left(z - t\right)\\
t_2 := \frac{\left(z - t\right) \cdot y}{a - t}\\
\mathbf{if}\;t\_2 \leq -5 \cdot 10^{+40}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;t\_2 \leq 4 \cdot 10^{+66}:\\
\;\;\;\;\mathsf{fma}\left(y, \frac{t}{t - a}, x\right)\\
\mathbf{else}:\\
\;\;\;\;t\_1\\
\end{array}
\end{array}
if (/.f64 (*.f64 y (-.f64 z t)) (-.f64 a t)) < -5.00000000000000003e40 or 3.99999999999999978e66 < (/.f64 (*.f64 y (-.f64 z t)) (-.f64 a t)) Initial program 65.0%
Taylor expanded in x around 0
associate-/l*N/A
div-subN/A
distribute-lft-out--N/A
associate-/l*N/A
*-commutativeN/A
associate-*r/N/A
associate-/l*N/A
*-commutativeN/A
associate-/l*N/A
distribute-rgt-out--N/A
lower-*.f64N/A
lower-/.f64N/A
lower--.f64N/A
lower--.f6484.0
Applied rewrites84.0%
if -5.00000000000000003e40 < (/.f64 (*.f64 y (-.f64 z t)) (-.f64 a t)) < 3.99999999999999978e66Initial program 99.7%
lift-/.f64N/A
lift-*.f64N/A
associate-/l*N/A
clear-numN/A
un-div-invN/A
lower-/.f64N/A
lower-/.f6499.9
Applied rewrites99.9%
Taylor expanded in z around 0
+-commutativeN/A
mul-1-negN/A
*-commutativeN/A
associate-/l*N/A
distribute-rgt-neg-inN/A
lower-fma.f64N/A
distribute-neg-frac2N/A
mul-1-negN/A
lower-/.f64N/A
mul-1-negN/A
sub-negN/A
+-commutativeN/A
distribute-neg-inN/A
unsub-negN/A
remove-double-negN/A
lower--.f6488.3
Applied rewrites88.3%
Final simplification86.2%
(FPCore (x y z t a)
:precision binary64
(let* ((t_1 (+ (/ (* z y) (- a t)) x)))
(if (<= z -1e+161)
t_1
(if (<= z -1.15e+17)
(* (/ y (- a t)) (- z t))
(if (<= z 52000000000.0) (fma y (/ t (- t a)) x) t_1)))))
double code(double x, double y, double z, double t, double a) {
double t_1 = ((z * y) / (a - t)) + x;
double tmp;
if (z <= -1e+161) {
tmp = t_1;
} else if (z <= -1.15e+17) {
tmp = (y / (a - t)) * (z - t);
} else if (z <= 52000000000.0) {
tmp = fma(y, (t / (t - a)), x);
} else {
tmp = t_1;
}
return tmp;
}
function code(x, y, z, t, a) t_1 = Float64(Float64(Float64(z * y) / Float64(a - t)) + x) tmp = 0.0 if (z <= -1e+161) tmp = t_1; elseif (z <= -1.15e+17) tmp = Float64(Float64(y / Float64(a - t)) * Float64(z - t)); elseif (z <= 52000000000.0) tmp = fma(y, Float64(t / Float64(t - a)), x); else tmp = t_1; end return tmp end
code[x_, y_, z_, t_, a_] := Block[{t$95$1 = N[(N[(N[(z * y), $MachinePrecision] / N[(a - t), $MachinePrecision]), $MachinePrecision] + x), $MachinePrecision]}, If[LessEqual[z, -1e+161], t$95$1, If[LessEqual[z, -1.15e+17], N[(N[(y / N[(a - t), $MachinePrecision]), $MachinePrecision] * N[(z - t), $MachinePrecision]), $MachinePrecision], If[LessEqual[z, 52000000000.0], N[(y * N[(t / N[(t - a), $MachinePrecision]), $MachinePrecision] + x), $MachinePrecision], t$95$1]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := \frac{z \cdot y}{a - t} + x\\
\mathbf{if}\;z \leq -1 \cdot 10^{+161}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;z \leq -1.15 \cdot 10^{+17}:\\
\;\;\;\;\frac{y}{a - t} \cdot \left(z - t\right)\\
\mathbf{elif}\;z \leq 52000000000:\\
\;\;\;\;\mathsf{fma}\left(y, \frac{t}{t - a}, x\right)\\
\mathbf{else}:\\
\;\;\;\;t\_1\\
\end{array}
\end{array}
if z < -1e161 or 5.2e10 < z Initial program 87.0%
Taylor expanded in z around inf
*-commutativeN/A
lower-*.f6483.2
Applied rewrites83.2%
if -1e161 < z < -1.15e17Initial program 70.5%
Taylor expanded in x around 0
associate-/l*N/A
div-subN/A
distribute-lft-out--N/A
associate-/l*N/A
*-commutativeN/A
associate-*r/N/A
associate-/l*N/A
*-commutativeN/A
associate-/l*N/A
distribute-rgt-out--N/A
lower-*.f64N/A
lower-/.f64N/A
lower--.f64N/A
lower--.f6476.2
Applied rewrites76.2%
if -1.15e17 < z < 5.2e10Initial program 82.9%
lift-/.f64N/A
lift-*.f64N/A
associate-/l*N/A
clear-numN/A
un-div-invN/A
lower-/.f64N/A
lower-/.f64100.0
Applied rewrites100.0%
Taylor expanded in z around 0
+-commutativeN/A
mul-1-negN/A
*-commutativeN/A
associate-/l*N/A
distribute-rgt-neg-inN/A
lower-fma.f64N/A
distribute-neg-frac2N/A
mul-1-negN/A
lower-/.f64N/A
mul-1-negN/A
sub-negN/A
+-commutativeN/A
distribute-neg-inN/A
unsub-negN/A
remove-double-negN/A
lower--.f6495.5
Applied rewrites95.5%
Final simplification88.7%
(FPCore (x y z t a)
:precision binary64
(if (<= t -1.9e-16)
(+ y x)
(if (<= t -1.75e-71)
(* (- 1.0 (/ z t)) y)
(if (<= t 5.8e+26) (fma (/ z a) y x) (+ y x)))))
double code(double x, double y, double z, double t, double a) {
double tmp;
if (t <= -1.9e-16) {
tmp = y + x;
} else if (t <= -1.75e-71) {
tmp = (1.0 - (z / t)) * y;
} else if (t <= 5.8e+26) {
tmp = fma((z / a), y, x);
} else {
tmp = y + x;
}
return tmp;
}
function code(x, y, z, t, a) tmp = 0.0 if (t <= -1.9e-16) tmp = Float64(y + x); elseif (t <= -1.75e-71) tmp = Float64(Float64(1.0 - Float64(z / t)) * y); elseif (t <= 5.8e+26) tmp = fma(Float64(z / a), y, x); else tmp = Float64(y + x); end return tmp end
code[x_, y_, z_, t_, a_] := If[LessEqual[t, -1.9e-16], N[(y + x), $MachinePrecision], If[LessEqual[t, -1.75e-71], N[(N[(1.0 - N[(z / t), $MachinePrecision]), $MachinePrecision] * y), $MachinePrecision], If[LessEqual[t, 5.8e+26], N[(N[(z / a), $MachinePrecision] * y + x), $MachinePrecision], N[(y + x), $MachinePrecision]]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;t \leq -1.9 \cdot 10^{-16}:\\
\;\;\;\;y + x\\
\mathbf{elif}\;t \leq -1.75 \cdot 10^{-71}:\\
\;\;\;\;\left(1 - \frac{z}{t}\right) \cdot y\\
\mathbf{elif}\;t \leq 5.8 \cdot 10^{+26}:\\
\;\;\;\;\mathsf{fma}\left(\frac{z}{a}, y, x\right)\\
\mathbf{else}:\\
\;\;\;\;y + x\\
\end{array}
\end{array}
if t < -1.90000000000000006e-16 or 5.8e26 < t Initial program 71.0%
Taylor expanded in t around inf
+-commutativeN/A
lower-+.f6479.9
Applied rewrites79.9%
if -1.90000000000000006e-16 < t < -1.75e-71Initial program 99.7%
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-/.f6461.5
Applied rewrites61.5%
Taylor expanded in x around 0
Applied rewrites58.4%
if -1.75e-71 < t < 5.8e26Initial program 93.8%
Taylor expanded in t around 0
+-commutativeN/A
associate-/l*N/A
*-commutativeN/A
lower-fma.f64N/A
lower-/.f6474.1
Applied rewrites74.1%
(FPCore (x y z t a) :precision binary64 (if (<= a -4.2e+16) (fma y (/ t (- t a)) x) (if (<= a 5e-15) (fma (- 1.0 (/ z t)) y x) (fma (- z t) (/ y a) x))))
double code(double x, double y, double z, double t, double a) {
double tmp;
if (a <= -4.2e+16) {
tmp = fma(y, (t / (t - a)), x);
} else if (a <= 5e-15) {
tmp = fma((1.0 - (z / t)), y, x);
} else {
tmp = fma((z - t), (y / a), x);
}
return tmp;
}
function code(x, y, z, t, a) tmp = 0.0 if (a <= -4.2e+16) tmp = fma(y, Float64(t / Float64(t - a)), x); elseif (a <= 5e-15) tmp = fma(Float64(1.0 - Float64(z / t)), y, x); else tmp = fma(Float64(z - t), Float64(y / a), x); end return tmp end
code[x_, y_, z_, t_, a_] := If[LessEqual[a, -4.2e+16], N[(y * N[(t / N[(t - a), $MachinePrecision]), $MachinePrecision] + x), $MachinePrecision], If[LessEqual[a, 5e-15], N[(N[(1.0 - N[(z / t), $MachinePrecision]), $MachinePrecision] * y + x), $MachinePrecision], N[(N[(z - t), $MachinePrecision] * N[(y / a), $MachinePrecision] + x), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;a \leq -4.2 \cdot 10^{+16}:\\
\;\;\;\;\mathsf{fma}\left(y, \frac{t}{t - a}, x\right)\\
\mathbf{elif}\;a \leq 5 \cdot 10^{-15}:\\
\;\;\;\;\mathsf{fma}\left(1 - \frac{z}{t}, y, x\right)\\
\mathbf{else}:\\
\;\;\;\;\mathsf{fma}\left(z - t, \frac{y}{a}, x\right)\\
\end{array}
\end{array}
if a < -4.2e16Initial program 81.0%
lift-/.f64N/A
lift-*.f64N/A
associate-/l*N/A
clear-numN/A
un-div-invN/A
lower-/.f64N/A
lower-/.f6499.9
Applied rewrites99.9%
Taylor expanded in z around 0
+-commutativeN/A
mul-1-negN/A
*-commutativeN/A
associate-/l*N/A
distribute-rgt-neg-inN/A
lower-fma.f64N/A
distribute-neg-frac2N/A
mul-1-negN/A
lower-/.f64N/A
mul-1-negN/A
sub-negN/A
+-commutativeN/A
distribute-neg-inN/A
unsub-negN/A
remove-double-negN/A
lower--.f6484.7
Applied rewrites84.7%
if -4.2e16 < a < 4.99999999999999999e-15Initial 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-/.f6484.9
Applied rewrites84.9%
if 4.99999999999999999e-15 < a Initial program 78.1%
Taylor expanded in a around inf
+-commutativeN/A
*-commutativeN/A
associate-/l*N/A
lower-fma.f64N/A
lower--.f64N/A
lower-/.f6481.6
Applied rewrites81.6%
(FPCore (x y z t a) :precision binary64 (if (<= a -4.2e+16) (fma y (/ t (- t a)) x) (if (<= a 3.3e-19) (fma (- 1.0 (/ z t)) y x) (fma (/ z a) y x))))
double code(double x, double y, double z, double t, double a) {
double tmp;
if (a <= -4.2e+16) {
tmp = fma(y, (t / (t - a)), x);
} else if (a <= 3.3e-19) {
tmp = fma((1.0 - (z / t)), y, x);
} else {
tmp = fma((z / a), y, x);
}
return tmp;
}
function code(x, y, z, t, a) tmp = 0.0 if (a <= -4.2e+16) tmp = fma(y, Float64(t / Float64(t - a)), x); elseif (a <= 3.3e-19) tmp = fma(Float64(1.0 - Float64(z / t)), y, x); else tmp = fma(Float64(z / a), y, x); end return tmp end
code[x_, y_, z_, t_, a_] := If[LessEqual[a, -4.2e+16], N[(y * N[(t / N[(t - a), $MachinePrecision]), $MachinePrecision] + x), $MachinePrecision], If[LessEqual[a, 3.3e-19], N[(N[(1.0 - N[(z / t), $MachinePrecision]), $MachinePrecision] * y + x), $MachinePrecision], N[(N[(z / a), $MachinePrecision] * y + x), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;a \leq -4.2 \cdot 10^{+16}:\\
\;\;\;\;\mathsf{fma}\left(y, \frac{t}{t - a}, x\right)\\
\mathbf{elif}\;a \leq 3.3 \cdot 10^{-19}:\\
\;\;\;\;\mathsf{fma}\left(1 - \frac{z}{t}, y, x\right)\\
\mathbf{else}:\\
\;\;\;\;\mathsf{fma}\left(\frac{z}{a}, y, x\right)\\
\end{array}
\end{array}
if a < -4.2e16Initial program 81.0%
lift-/.f64N/A
lift-*.f64N/A
associate-/l*N/A
clear-numN/A
un-div-invN/A
lower-/.f64N/A
lower-/.f6499.9
Applied rewrites99.9%
Taylor expanded in z around 0
+-commutativeN/A
mul-1-negN/A
*-commutativeN/A
associate-/l*N/A
distribute-rgt-neg-inN/A
lower-fma.f64N/A
distribute-neg-frac2N/A
mul-1-negN/A
lower-/.f64N/A
mul-1-negN/A
sub-negN/A
+-commutativeN/A
distribute-neg-inN/A
unsub-negN/A
remove-double-negN/A
lower--.f6484.7
Applied rewrites84.7%
if -4.2e16 < a < 3.2999999999999998e-19Initial 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-/.f6484.9
Applied rewrites84.9%
if 3.2999999999999998e-19 < a Initial program 78.1%
Taylor expanded in t around 0
+-commutativeN/A
associate-/l*N/A
*-commutativeN/A
lower-fma.f64N/A
lower-/.f6479.2
Applied rewrites79.2%
(FPCore (x y z t a) :precision binary64 (let* ((t_1 (fma y (/ t (- t a)) x))) (if (<= t -3.2e-115) t_1 (if (<= t 18000000000.0) (fma (/ z a) y x) t_1))))
double code(double x, double y, double z, double t, double a) {
double t_1 = fma(y, (t / (t - a)), x);
double tmp;
if (t <= -3.2e-115) {
tmp = t_1;
} else if (t <= 18000000000.0) {
tmp = fma((z / a), y, x);
} else {
tmp = t_1;
}
return tmp;
}
function code(x, y, z, t, a) t_1 = fma(y, Float64(t / Float64(t - a)), x) tmp = 0.0 if (t <= -3.2e-115) tmp = t_1; elseif (t <= 18000000000.0) tmp = fma(Float64(z / a), y, x); else tmp = t_1; end return tmp end
code[x_, y_, z_, t_, a_] := Block[{t$95$1 = N[(y * N[(t / N[(t - a), $MachinePrecision]), $MachinePrecision] + x), $MachinePrecision]}, If[LessEqual[t, -3.2e-115], t$95$1, If[LessEqual[t, 18000000000.0], N[(N[(z / a), $MachinePrecision] * y + x), $MachinePrecision], t$95$1]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := \mathsf{fma}\left(y, \frac{t}{t - a}, x\right)\\
\mathbf{if}\;t \leq -3.2 \cdot 10^{-115}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;t \leq 18000000000:\\
\;\;\;\;\mathsf{fma}\left(\frac{z}{a}, y, x\right)\\
\mathbf{else}:\\
\;\;\;\;t\_1\\
\end{array}
\end{array}
if t < -3.2e-115 or 1.8e10 < t Initial program 75.5%
lift-/.f64N/A
lift-*.f64N/A
associate-/l*N/A
clear-numN/A
un-div-invN/A
lower-/.f64N/A
lower-/.f6499.3
Applied rewrites99.3%
Taylor expanded in z around 0
+-commutativeN/A
mul-1-negN/A
*-commutativeN/A
associate-/l*N/A
distribute-rgt-neg-inN/A
lower-fma.f64N/A
distribute-neg-frac2N/A
mul-1-negN/A
lower-/.f64N/A
mul-1-negN/A
sub-negN/A
+-commutativeN/A
distribute-neg-inN/A
unsub-negN/A
remove-double-negN/A
lower--.f6481.4
Applied rewrites81.4%
if -3.2e-115 < t < 1.8e10Initial program 93.9%
Taylor expanded in t around 0
+-commutativeN/A
associate-/l*N/A
*-commutativeN/A
lower-fma.f64N/A
lower-/.f6475.6
Applied rewrites75.6%
(FPCore (x y z t a) :precision binary64 (if (<= t -7.5e-48) (+ y x) (if (<= t 5.8e+26) (fma (/ z a) y x) (+ y x))))
double code(double x, double y, double z, double t, double a) {
double tmp;
if (t <= -7.5e-48) {
tmp = y + x;
} else if (t <= 5.8e+26) {
tmp = fma((z / a), y, x);
} else {
tmp = y + x;
}
return tmp;
}
function code(x, y, z, t, a) tmp = 0.0 if (t <= -7.5e-48) tmp = Float64(y + x); elseif (t <= 5.8e+26) tmp = fma(Float64(z / a), y, x); else tmp = Float64(y + x); end return tmp end
code[x_, y_, z_, t_, a_] := If[LessEqual[t, -7.5e-48], N[(y + x), $MachinePrecision], If[LessEqual[t, 5.8e+26], N[(N[(z / a), $MachinePrecision] * y + x), $MachinePrecision], N[(y + x), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;t \leq -7.5 \cdot 10^{-48}:\\
\;\;\;\;y + x\\
\mathbf{elif}\;t \leq 5.8 \cdot 10^{+26}:\\
\;\;\;\;\mathsf{fma}\left(\frac{z}{a}, y, x\right)\\
\mathbf{else}:\\
\;\;\;\;y + x\\
\end{array}
\end{array}
if t < -7.50000000000000042e-48 or 5.8e26 < t Initial program 72.6%
Taylor expanded in t around inf
+-commutativeN/A
lower-+.f6476.9
Applied rewrites76.9%
if -7.50000000000000042e-48 < t < 5.8e26Initial program 94.1%
Taylor expanded in t around 0
+-commutativeN/A
associate-/l*N/A
*-commutativeN/A
lower-fma.f64N/A
lower-/.f6471.5
Applied rewrites71.5%
(FPCore (x y z t a) :precision binary64 (if (<= t -1.35e-114) (+ y x) (if (<= t 8.5e+25) (fma z (/ y a) x) (+ y x))))
double code(double x, double y, double z, double t, double a) {
double tmp;
if (t <= -1.35e-114) {
tmp = y + x;
} else if (t <= 8.5e+25) {
tmp = fma(z, (y / a), x);
} else {
tmp = y + x;
}
return tmp;
}
function code(x, y, z, t, a) tmp = 0.0 if (t <= -1.35e-114) tmp = Float64(y + x); elseif (t <= 8.5e+25) tmp = fma(z, Float64(y / a), x); else tmp = Float64(y + x); end return tmp end
code[x_, y_, z_, t_, a_] := If[LessEqual[t, -1.35e-114], N[(y + x), $MachinePrecision], If[LessEqual[t, 8.5e+25], N[(z * N[(y / a), $MachinePrecision] + x), $MachinePrecision], N[(y + x), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;t \leq -1.35 \cdot 10^{-114}:\\
\;\;\;\;y + x\\
\mathbf{elif}\;t \leq 8.5 \cdot 10^{+25}:\\
\;\;\;\;\mathsf{fma}\left(z, \frac{y}{a}, x\right)\\
\mathbf{else}:\\
\;\;\;\;y + x\\
\end{array}
\end{array}
if t < -1.35e-114 or 8.5000000000000007e25 < t Initial program 75.5%
Taylor expanded in t around inf
+-commutativeN/A
lower-+.f6473.6
Applied rewrites73.6%
if -1.35e-114 < t < 8.5000000000000007e25Initial program 93.2%
lift-/.f64N/A
lift-*.f64N/A
associate-/l*N/A
clear-numN/A
un-div-invN/A
lower-/.f64N/A
lower-/.f6496.3
Applied rewrites96.3%
Taylor expanded in t around 0
+-commutativeN/A
*-commutativeN/A
associate-/l*N/A
lower-fma.f64N/A
lower-/.f6472.8
Applied rewrites72.8%
(FPCore (x y z t a) :precision binary64 (if (<= z -1.55e+252) (* (/ z a) y) (+ y x)))
double code(double x, double y, double z, double t, double a) {
double tmp;
if (z <= -1.55e+252) {
tmp = (z / a) * y;
} else {
tmp = y + 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 (z <= (-1.55d+252)) then
tmp = (z / a) * y
else
tmp = y + x
end if
code = tmp
end function
public static double code(double x, double y, double z, double t, double a) {
double tmp;
if (z <= -1.55e+252) {
tmp = (z / a) * y;
} else {
tmp = y + x;
}
return tmp;
}
def code(x, y, z, t, a): tmp = 0 if z <= -1.55e+252: tmp = (z / a) * y else: tmp = y + x return tmp
function code(x, y, z, t, a) tmp = 0.0 if (z <= -1.55e+252) tmp = Float64(Float64(z / a) * y); else tmp = Float64(y + x); end return tmp end
function tmp_2 = code(x, y, z, t, a) tmp = 0.0; if (z <= -1.55e+252) tmp = (z / a) * y; else tmp = y + x; end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_] := If[LessEqual[z, -1.55e+252], N[(N[(z / a), $MachinePrecision] * y), $MachinePrecision], N[(y + x), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \leq -1.55 \cdot 10^{+252}:\\
\;\;\;\;\frac{z}{a} \cdot y\\
\mathbf{else}:\\
\;\;\;\;y + x\\
\end{array}
\end{array}
if z < -1.54999999999999991e252Initial program 58.4%
Taylor expanded in z around inf
associate-/l*N/A
*-commutativeN/A
lower-*.f64N/A
lower-/.f64N/A
lower--.f6479.4
Applied rewrites79.4%
Taylor expanded in t around 0
Applied rewrites58.4%
if -1.54999999999999991e252 < z Initial program 83.5%
Taylor expanded in t around inf
+-commutativeN/A
lower-+.f6462.9
Applied rewrites62.9%
(FPCore (x y z t a) :precision binary64 (if (<= z -1.05e+252) (* (/ y a) z) (+ y x)))
double code(double x, double y, double z, double t, double a) {
double tmp;
if (z <= -1.05e+252) {
tmp = (y / a) * z;
} else {
tmp = y + 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 (z <= (-1.05d+252)) then
tmp = (y / a) * z
else
tmp = y + x
end if
code = tmp
end function
public static double code(double x, double y, double z, double t, double a) {
double tmp;
if (z <= -1.05e+252) {
tmp = (y / a) * z;
} else {
tmp = y + x;
}
return tmp;
}
def code(x, y, z, t, a): tmp = 0 if z <= -1.05e+252: tmp = (y / a) * z else: tmp = y + x return tmp
function code(x, y, z, t, a) tmp = 0.0 if (z <= -1.05e+252) tmp = Float64(Float64(y / a) * z); else tmp = Float64(y + x); end return tmp end
function tmp_2 = code(x, y, z, t, a) tmp = 0.0; if (z <= -1.05e+252) tmp = (y / a) * z; else tmp = y + x; end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_] := If[LessEqual[z, -1.05e+252], N[(N[(y / a), $MachinePrecision] * z), $MachinePrecision], N[(y + x), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \leq -1.05 \cdot 10^{+252}:\\
\;\;\;\;\frac{y}{a} \cdot z\\
\mathbf{else}:\\
\;\;\;\;y + x\\
\end{array}
\end{array}
if z < -1.0500000000000001e252Initial program 58.4%
lift-/.f64N/A
lift-*.f64N/A
associate-/l*N/A
clear-numN/A
un-div-invN/A
lower-/.f64N/A
lower-/.f6489.4
Applied rewrites89.4%
Taylor expanded in t around 0
+-commutativeN/A
*-commutativeN/A
associate-/l*N/A
lower-fma.f64N/A
lower-/.f6468.1
Applied rewrites68.1%
Taylor expanded in x around 0
Applied rewrites37.7%
Applied rewrites58.2%
if -1.0500000000000001e252 < z Initial program 83.5%
Taylor expanded in t around inf
+-commutativeN/A
lower-+.f6462.9
Applied rewrites62.9%
(FPCore (x y z t a) :precision binary64 (+ y x))
double code(double x, double y, double z, double t, double a) {
return y + 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 = y + x
end function
public static double code(double x, double y, double z, double t, double a) {
return y + x;
}
def code(x, y, z, t, a): return y + x
function code(x, y, z, t, a) return Float64(y + x) end
function tmp = code(x, y, z, t, a) tmp = y + x; end
code[x_, y_, z_, t_, a_] := N[(y + x), $MachinePrecision]
\begin{array}{l}
\\
y + x
\end{array}
Initial program 82.6%
Taylor expanded in t around inf
+-commutativeN/A
lower-+.f6461.0
Applied rewrites61.0%
(FPCore (x y z t a) :precision binary64 (+ x (/ y (/ (- a t) (- z t)))))
double code(double x, double y, double z, double t, double a) {
return x + (y / ((a - t) / (z - 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 / ((a - t) / (z - t)))
end function
public static double code(double x, double y, double z, double t, double a) {
return x + (y / ((a - t) / (z - t)));
}
def code(x, y, z, t, a): return x + (y / ((a - t) / (z - t)))
function code(x, y, z, t, a) return Float64(x + Float64(y / Float64(Float64(a - t) / Float64(z - t)))) end
function tmp = code(x, y, z, t, a) tmp = x + (y / ((a - t) / (z - t))); end
code[x_, y_, z_, t_, a_] := N[(x + N[(y / N[(N[(a - t), $MachinePrecision] / N[(z - t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
x + \frac{y}{\frac{a - t}{z - t}}
\end{array}
herbie shell --seed 2024296
(FPCore (x y z t a)
:name "Graphics.Rendering.Plot.Render.Plot.Axis:renderAxisTicks from plot-0.2.3.4, B"
:precision binary64
:alt
(! :herbie-platform default (+ x (/ y (/ (- a t) (- z t)))))
(+ x (/ (* y (- z t)) (- a t))))