
(FPCore (x y z t a) :precision binary64 (+ x (* y (/ (- z t) (- z a)))))
double code(double x, double y, double z, double t, double a) {
return x + (y * ((z - t) / (z - a)));
}
real(8) function code(x, y, z, t, a)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
real(8), intent (in) :: a
code = x + (y * ((z - t) / (z - a)))
end function
public static double code(double x, double y, double z, double t, double a) {
return x + (y * ((z - t) / (z - a)));
}
def code(x, y, z, t, a): return x + (y * ((z - t) / (z - a)))
function code(x, y, z, t, a) return Float64(x + Float64(y * Float64(Float64(z - t) / Float64(z - a)))) end
function tmp = code(x, y, z, t, a) tmp = x + (y * ((z - t) / (z - a))); end
code[x_, y_, z_, t_, a_] := N[(x + N[(y * N[(N[(z - t), $MachinePrecision] / N[(z - a), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
x + y \cdot \frac{z - t}{z - a}
\end{array}
Sampling outcomes in binary64 precision:
Herbie found 14 alternatives:
| Alternative | Accuracy | Speedup |
|---|
(FPCore (x y z t a) :precision binary64 (+ x (* y (/ (- z t) (- z a)))))
double code(double x, double y, double z, double t, double a) {
return x + (y * ((z - t) / (z - a)));
}
real(8) function code(x, y, z, t, a)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
real(8), intent (in) :: a
code = x + (y * ((z - t) / (z - a)))
end function
public static double code(double x, double y, double z, double t, double a) {
return x + (y * ((z - t) / (z - a)));
}
def code(x, y, z, t, a): return x + (y * ((z - t) / (z - a)))
function code(x, y, z, t, a) return Float64(x + Float64(y * Float64(Float64(z - t) / Float64(z - a)))) end
function tmp = code(x, y, z, t, a) tmp = x + (y * ((z - t) / (z - a))); end
code[x_, y_, z_, t_, a_] := N[(x + N[(y * N[(N[(z - t), $MachinePrecision] / N[(z - a), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
x + y \cdot \frac{z - t}{z - a}
\end{array}
(FPCore (x y z t a)
:precision binary64
(let* ((t_1 (/ (- z t) (- z a))) (t_2 (fma (/ y (- a z)) t x)))
(if (<= t_1 -100.0)
t_2
(if (<= t_1 0.6)
(fma y (/ (- t z) a) x)
(if (<= t_1 2.0) (fma y (- 1.0 (/ t z)) x) t_2)))))
double code(double x, double y, double z, double t, double a) {
double t_1 = (z - t) / (z - a);
double t_2 = fma((y / (a - z)), t, x);
double tmp;
if (t_1 <= -100.0) {
tmp = t_2;
} else if (t_1 <= 0.6) {
tmp = fma(y, ((t - z) / a), x);
} else if (t_1 <= 2.0) {
tmp = fma(y, (1.0 - (t / z)), x);
} else {
tmp = t_2;
}
return tmp;
}
function code(x, y, z, t, a) t_1 = Float64(Float64(z - t) / Float64(z - a)) t_2 = fma(Float64(y / Float64(a - z)), t, x) tmp = 0.0 if (t_1 <= -100.0) tmp = t_2; elseif (t_1 <= 0.6) tmp = fma(y, Float64(Float64(t - z) / a), x); elseif (t_1 <= 2.0) tmp = fma(y, Float64(1.0 - Float64(t / z)), x); else tmp = t_2; end return tmp end
code[x_, y_, z_, t_, a_] := Block[{t$95$1 = N[(N[(z - t), $MachinePrecision] / N[(z - a), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$2 = N[(N[(y / N[(a - z), $MachinePrecision]), $MachinePrecision] * t + x), $MachinePrecision]}, If[LessEqual[t$95$1, -100.0], t$95$2, If[LessEqual[t$95$1, 0.6], N[(y * N[(N[(t - z), $MachinePrecision] / a), $MachinePrecision] + x), $MachinePrecision], If[LessEqual[t$95$1, 2.0], N[(y * N[(1.0 - N[(t / z), $MachinePrecision]), $MachinePrecision] + x), $MachinePrecision], t$95$2]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := \frac{z - t}{z - a}\\
t_2 := \mathsf{fma}\left(\frac{y}{a - z}, t, x\right)\\
\mathbf{if}\;t\_1 \leq -100:\\
\;\;\;\;t\_2\\
\mathbf{elif}\;t\_1 \leq 0.6:\\
\;\;\;\;\mathsf{fma}\left(y, \frac{t - z}{a}, x\right)\\
\mathbf{elif}\;t\_1 \leq 2:\\
\;\;\;\;\mathsf{fma}\left(y, 1 - \frac{t}{z}, x\right)\\
\mathbf{else}:\\
\;\;\;\;t\_2\\
\end{array}
\end{array}
if (/.f64 (-.f64 z t) (-.f64 z a)) < -100 or 2 < (/.f64 (-.f64 z t) (-.f64 z a)) Initial program 94.5%
+-commutativeN/A
clear-numN/A
associate-/r/N/A
associate-*r*N/A
*-commutativeN/A
accelerator-lowering-fma.f64N/A
associate-*l/N/A
*-lft-identityN/A
/-lowering-/.f64N/A
--lowering--.f64N/A
--lowering--.f6498.0
Applied egg-rr98.0%
Taylor expanded in z around 0
mul-1-negN/A
neg-lowering-neg.f6497.2
Simplified97.2%
distribute-rgt-neg-outN/A
distribute-lft-neg-inN/A
distribute-frac-neg2N/A
accelerator-lowering-fma.f64N/A
/-lowering-/.f64N/A
neg-sub0N/A
sub-negN/A
+-commutativeN/A
associate--r+N/A
neg-sub0N/A
remove-double-negN/A
--lowering--.f6497.2
Applied egg-rr97.2%
if -100 < (/.f64 (-.f64 z t) (-.f64 z a)) < 0.599999999999999978Initial program 99.9%
Taylor expanded in a around inf
+-commutativeN/A
mul-1-negN/A
associate-/l*N/A
distribute-rgt-neg-inN/A
mul-1-negN/A
accelerator-lowering-fma.f64N/A
associate-*r/N/A
/-lowering-/.f64N/A
mul-1-negN/A
sub-negN/A
+-commutativeN/A
distribute-neg-inN/A
unsub-negN/A
remove-double-negN/A
--lowering--.f6499.7
Simplified99.7%
if 0.599999999999999978 < (/.f64 (-.f64 z t) (-.f64 z a)) < 2Initial program 100.0%
Taylor expanded in a around 0
+-commutativeN/A
associate-/l*N/A
div-subN/A
sub-negN/A
*-inversesN/A
mul-1-negN/A
accelerator-lowering-fma.f64N/A
mul-1-negN/A
unsub-negN/A
--lowering--.f64N/A
/-lowering-/.f6498.9
Simplified98.9%
(FPCore (x y z t a)
:precision binary64
(let* ((t_1 (/ (- z t) (- z a))))
(if (<= t_1 0.6)
(fma y (/ t a) x)
(if (<= t_1 1e+27) (+ x y) (fma (/ y z) (- t) x)))))
double code(double x, double y, double z, double t, double a) {
double t_1 = (z - t) / (z - a);
double tmp;
if (t_1 <= 0.6) {
tmp = fma(y, (t / a), x);
} else if (t_1 <= 1e+27) {
tmp = x + y;
} else {
tmp = fma((y / z), -t, x);
}
return tmp;
}
function code(x, y, z, t, a) t_1 = Float64(Float64(z - t) / Float64(z - a)) tmp = 0.0 if (t_1 <= 0.6) tmp = fma(y, Float64(t / a), x); elseif (t_1 <= 1e+27) tmp = Float64(x + y); else tmp = fma(Float64(y / z), Float64(-t), x); end return tmp end
code[x_, y_, z_, t_, a_] := Block[{t$95$1 = N[(N[(z - t), $MachinePrecision] / N[(z - a), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[t$95$1, 0.6], N[(y * N[(t / a), $MachinePrecision] + x), $MachinePrecision], If[LessEqual[t$95$1, 1e+27], N[(x + y), $MachinePrecision], N[(N[(y / z), $MachinePrecision] * (-t) + x), $MachinePrecision]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := \frac{z - t}{z - a}\\
\mathbf{if}\;t\_1 \leq 0.6:\\
\;\;\;\;\mathsf{fma}\left(y, \frac{t}{a}, x\right)\\
\mathbf{elif}\;t\_1 \leq 10^{+27}:\\
\;\;\;\;x + y\\
\mathbf{else}:\\
\;\;\;\;\mathsf{fma}\left(\frac{y}{z}, -t, x\right)\\
\end{array}
\end{array}
if (/.f64 (-.f64 z t) (-.f64 z a)) < 0.599999999999999978Initial program 99.2%
Taylor expanded in z around 0
+-commutativeN/A
*-commutativeN/A
associate-/l*N/A
accelerator-lowering-fma.f64N/A
/-lowering-/.f6478.9
Simplified78.9%
if 0.599999999999999978 < (/.f64 (-.f64 z t) (-.f64 z a)) < 1e27Initial program 100.0%
Taylor expanded in z around inf
+-commutativeN/A
+-lowering-+.f6496.5
Simplified96.5%
if 1e27 < (/.f64 (-.f64 z t) (-.f64 z a)) Initial program 87.3%
+-commutativeN/A
clear-numN/A
associate-/r/N/A
associate-*r*N/A
*-commutativeN/A
accelerator-lowering-fma.f64N/A
associate-*l/N/A
*-lft-identityN/A
/-lowering-/.f64N/A
--lowering--.f64N/A
--lowering--.f6494.3
Applied egg-rr94.3%
Taylor expanded in z around inf
/-lowering-/.f6470.8
Simplified70.8%
Taylor expanded in z around 0
mul-1-negN/A
neg-lowering-neg.f6470.8
Simplified70.8%
Final simplification83.9%
(FPCore (x y z t a)
:precision binary64
(let* ((t_1 (/ (- z t) (- z a))))
(if (<= t_1 0.6)
(fma y (/ t a) x)
(if (<= t_1 1e+27) (+ x y) (fma y (- (/ t z)) x)))))
double code(double x, double y, double z, double t, double a) {
double t_1 = (z - t) / (z - a);
double tmp;
if (t_1 <= 0.6) {
tmp = fma(y, (t / a), x);
} else if (t_1 <= 1e+27) {
tmp = x + y;
} else {
tmp = fma(y, -(t / z), x);
}
return tmp;
}
function code(x, y, z, t, a) t_1 = Float64(Float64(z - t) / Float64(z - a)) tmp = 0.0 if (t_1 <= 0.6) tmp = fma(y, Float64(t / a), x); elseif (t_1 <= 1e+27) tmp = Float64(x + y); else tmp = fma(y, Float64(-Float64(t / z)), x); end return tmp end
code[x_, y_, z_, t_, a_] := Block[{t$95$1 = N[(N[(z - t), $MachinePrecision] / N[(z - a), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[t$95$1, 0.6], N[(y * N[(t / a), $MachinePrecision] + x), $MachinePrecision], If[LessEqual[t$95$1, 1e+27], N[(x + y), $MachinePrecision], N[(y * (-N[(t / z), $MachinePrecision]) + x), $MachinePrecision]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := \frac{z - t}{z - a}\\
\mathbf{if}\;t\_1 \leq 0.6:\\
\;\;\;\;\mathsf{fma}\left(y, \frac{t}{a}, x\right)\\
\mathbf{elif}\;t\_1 \leq 10^{+27}:\\
\;\;\;\;x + y\\
\mathbf{else}:\\
\;\;\;\;\mathsf{fma}\left(y, -\frac{t}{z}, x\right)\\
\end{array}
\end{array}
if (/.f64 (-.f64 z t) (-.f64 z a)) < 0.599999999999999978Initial program 99.2%
Taylor expanded in z around 0
+-commutativeN/A
*-commutativeN/A
associate-/l*N/A
accelerator-lowering-fma.f64N/A
/-lowering-/.f6478.9
Simplified78.9%
if 0.599999999999999978 < (/.f64 (-.f64 z t) (-.f64 z a)) < 1e27Initial program 100.0%
Taylor expanded in z around inf
+-commutativeN/A
+-lowering-+.f6496.5
Simplified96.5%
if 1e27 < (/.f64 (-.f64 z t) (-.f64 z a)) Initial program 87.3%
Taylor expanded in a around 0
+-commutativeN/A
associate-/l*N/A
div-subN/A
sub-negN/A
*-inversesN/A
mul-1-negN/A
accelerator-lowering-fma.f64N/A
mul-1-negN/A
unsub-negN/A
--lowering--.f64N/A
/-lowering-/.f6464.5
Simplified64.5%
Taylor expanded in t around inf
associate-*r/N/A
/-lowering-/.f64N/A
mul-1-negN/A
neg-lowering-neg.f6464.5
Simplified64.5%
Final simplification83.1%
(FPCore (x y z t a)
:precision binary64
(let* ((t_1 (/ (- z t) (- z a))))
(if (<= t_1 0.6)
(fma y (/ t a) x)
(if (<= t_1 5e+31) (+ x y) (+ x (/ (* y t) a))))))
double code(double x, double y, double z, double t, double a) {
double t_1 = (z - t) / (z - a);
double tmp;
if (t_1 <= 0.6) {
tmp = fma(y, (t / a), x);
} else if (t_1 <= 5e+31) {
tmp = x + y;
} else {
tmp = x + ((y * t) / a);
}
return tmp;
}
function code(x, y, z, t, a) t_1 = Float64(Float64(z - t) / Float64(z - a)) tmp = 0.0 if (t_1 <= 0.6) tmp = fma(y, Float64(t / a), x); elseif (t_1 <= 5e+31) tmp = Float64(x + y); else tmp = Float64(x + Float64(Float64(y * t) / a)); end return tmp end
code[x_, y_, z_, t_, a_] := Block[{t$95$1 = N[(N[(z - t), $MachinePrecision] / N[(z - a), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[t$95$1, 0.6], N[(y * N[(t / a), $MachinePrecision] + x), $MachinePrecision], If[LessEqual[t$95$1, 5e+31], N[(x + y), $MachinePrecision], N[(x + N[(N[(y * t), $MachinePrecision] / a), $MachinePrecision]), $MachinePrecision]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := \frac{z - t}{z - a}\\
\mathbf{if}\;t\_1 \leq 0.6:\\
\;\;\;\;\mathsf{fma}\left(y, \frac{t}{a}, x\right)\\
\mathbf{elif}\;t\_1 \leq 5 \cdot 10^{+31}:\\
\;\;\;\;x + y\\
\mathbf{else}:\\
\;\;\;\;x + \frac{y \cdot t}{a}\\
\end{array}
\end{array}
if (/.f64 (-.f64 z t) (-.f64 z a)) < 0.599999999999999978Initial program 99.2%
Taylor expanded in z around 0
+-commutativeN/A
*-commutativeN/A
associate-/l*N/A
accelerator-lowering-fma.f64N/A
/-lowering-/.f6478.9
Simplified78.9%
if 0.599999999999999978 < (/.f64 (-.f64 z t) (-.f64 z a)) < 5.00000000000000027e31Initial program 100.0%
Taylor expanded in z around inf
+-commutativeN/A
+-lowering-+.f6495.6
Simplified95.6%
if 5.00000000000000027e31 < (/.f64 (-.f64 z t) (-.f64 z a)) Initial program 86.4%
Taylor expanded in z around 0
/-lowering-/.f64N/A
*-commutativeN/A
*-lowering-*.f6458.8
Simplified58.8%
Final simplification82.4%
(FPCore (x y z t a)
:precision binary64
(let* ((t_1 (/ (- z t) (- z a))))
(if (<= t_1 0.6)
(fma y (/ t a) x)
(if (<= t_1 1e+102) (+ x y) (fma t (/ y a) x)))))
double code(double x, double y, double z, double t, double a) {
double t_1 = (z - t) / (z - a);
double tmp;
if (t_1 <= 0.6) {
tmp = fma(y, (t / a), x);
} else if (t_1 <= 1e+102) {
tmp = x + y;
} else {
tmp = fma(t, (y / a), x);
}
return tmp;
}
function code(x, y, z, t, a) t_1 = Float64(Float64(z - t) / Float64(z - a)) tmp = 0.0 if (t_1 <= 0.6) tmp = fma(y, Float64(t / a), x); elseif (t_1 <= 1e+102) tmp = Float64(x + y); else tmp = fma(t, Float64(y / a), x); end return tmp end
code[x_, y_, z_, t_, a_] := Block[{t$95$1 = N[(N[(z - t), $MachinePrecision] / N[(z - a), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[t$95$1, 0.6], N[(y * N[(t / a), $MachinePrecision] + x), $MachinePrecision], If[LessEqual[t$95$1, 1e+102], N[(x + y), $MachinePrecision], N[(t * N[(y / a), $MachinePrecision] + x), $MachinePrecision]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := \frac{z - t}{z - a}\\
\mathbf{if}\;t\_1 \leq 0.6:\\
\;\;\;\;\mathsf{fma}\left(y, \frac{t}{a}, x\right)\\
\mathbf{elif}\;t\_1 \leq 10^{+102}:\\
\;\;\;\;x + y\\
\mathbf{else}:\\
\;\;\;\;\mathsf{fma}\left(t, \frac{y}{a}, x\right)\\
\end{array}
\end{array}
if (/.f64 (-.f64 z t) (-.f64 z a)) < 0.599999999999999978Initial program 99.2%
Taylor expanded in z around 0
+-commutativeN/A
*-commutativeN/A
associate-/l*N/A
accelerator-lowering-fma.f64N/A
/-lowering-/.f6478.9
Simplified78.9%
if 0.599999999999999978 < (/.f64 (-.f64 z t) (-.f64 z a)) < 9.99999999999999977e101Initial program 100.0%
Taylor expanded in z around inf
+-commutativeN/A
+-lowering-+.f6490.8
Simplified90.8%
if 9.99999999999999977e101 < (/.f64 (-.f64 z t) (-.f64 z a)) Initial program 81.0%
+-commutativeN/A
clear-numN/A
associate-/r/N/A
associate-*r*N/A
*-commutativeN/A
accelerator-lowering-fma.f64N/A
associate-*l/N/A
*-lft-identityN/A
/-lowering-/.f64N/A
--lowering--.f64N/A
--lowering--.f6499.9
Applied egg-rr99.9%
Taylor expanded in z around 0
mul-1-negN/A
neg-lowering-neg.f6499.9
Simplified99.9%
Taylor expanded in z around 0
+-commutativeN/A
associate-/l*N/A
accelerator-lowering-fma.f64N/A
/-lowering-/.f6466.3
Simplified66.3%
Final simplification82.4%
(FPCore (x y z t a) :precision binary64 (let* ((t_1 (/ (- z t) (- z a))) (t_2 (fma t (/ y a) x))) (if (<= t_1 0.6) t_2 (if (<= t_1 1e+102) (+ x y) t_2))))
double code(double x, double y, double z, double t, double a) {
double t_1 = (z - t) / (z - a);
double t_2 = fma(t, (y / a), x);
double tmp;
if (t_1 <= 0.6) {
tmp = t_2;
} else if (t_1 <= 1e+102) {
tmp = x + y;
} else {
tmp = t_2;
}
return tmp;
}
function code(x, y, z, t, a) t_1 = Float64(Float64(z - t) / Float64(z - a)) t_2 = fma(t, Float64(y / a), x) tmp = 0.0 if (t_1 <= 0.6) tmp = t_2; elseif (t_1 <= 1e+102) tmp = Float64(x + y); else tmp = t_2; end return tmp end
code[x_, y_, z_, t_, a_] := Block[{t$95$1 = N[(N[(z - t), $MachinePrecision] / N[(z - a), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$2 = N[(t * N[(y / a), $MachinePrecision] + x), $MachinePrecision]}, If[LessEqual[t$95$1, 0.6], t$95$2, If[LessEqual[t$95$1, 1e+102], N[(x + y), $MachinePrecision], t$95$2]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := \frac{z - t}{z - a}\\
t_2 := \mathsf{fma}\left(t, \frac{y}{a}, x\right)\\
\mathbf{if}\;t\_1 \leq 0.6:\\
\;\;\;\;t\_2\\
\mathbf{elif}\;t\_1 \leq 10^{+102}:\\
\;\;\;\;x + y\\
\mathbf{else}:\\
\;\;\;\;t\_2\\
\end{array}
\end{array}
if (/.f64 (-.f64 z t) (-.f64 z a)) < 0.599999999999999978 or 9.99999999999999977e101 < (/.f64 (-.f64 z t) (-.f64 z a)) Initial program 96.9%
+-commutativeN/A
clear-numN/A
associate-/r/N/A
associate-*r*N/A
*-commutativeN/A
accelerator-lowering-fma.f64N/A
associate-*l/N/A
*-lft-identityN/A
/-lowering-/.f64N/A
--lowering--.f64N/A
--lowering--.f6498.1
Applied egg-rr98.1%
Taylor expanded in z around 0
mul-1-negN/A
neg-lowering-neg.f6491.9
Simplified91.9%
Taylor expanded in z around 0
+-commutativeN/A
associate-/l*N/A
accelerator-lowering-fma.f64N/A
/-lowering-/.f6476.7
Simplified76.7%
if 0.599999999999999978 < (/.f64 (-.f64 z t) (-.f64 z a)) < 9.99999999999999977e101Initial program 100.0%
Taylor expanded in z around inf
+-commutativeN/A
+-lowering-+.f6490.8
Simplified90.8%
Final simplification82.0%
(FPCore (x y z t a) :precision binary64 (let* ((t_1 (* y (/ (- z t) (- z a))))) (if (<= t_1 -1e+133) y (if (<= t_1 1e+132) x y))))
double code(double x, double y, double z, double t, double a) {
double t_1 = y * ((z - t) / (z - a));
double tmp;
if (t_1 <= -1e+133) {
tmp = y;
} else if (t_1 <= 1e+132) {
tmp = x;
} else {
tmp = y;
}
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 = y * ((z - t) / (z - a))
if (t_1 <= (-1d+133)) then
tmp = y
else if (t_1 <= 1d+132) then
tmp = x
else
tmp = y
end if
code = tmp
end function
public static double code(double x, double y, double z, double t, double a) {
double t_1 = y * ((z - t) / (z - a));
double tmp;
if (t_1 <= -1e+133) {
tmp = y;
} else if (t_1 <= 1e+132) {
tmp = x;
} else {
tmp = y;
}
return tmp;
}
def code(x, y, z, t, a): t_1 = y * ((z - t) / (z - a)) tmp = 0 if t_1 <= -1e+133: tmp = y elif t_1 <= 1e+132: tmp = x else: tmp = y return tmp
function code(x, y, z, t, a) t_1 = Float64(y * Float64(Float64(z - t) / Float64(z - a))) tmp = 0.0 if (t_1 <= -1e+133) tmp = y; elseif (t_1 <= 1e+132) tmp = x; else tmp = y; end return tmp end
function tmp_2 = code(x, y, z, t, a) t_1 = y * ((z - t) / (z - a)); tmp = 0.0; if (t_1 <= -1e+133) tmp = y; elseif (t_1 <= 1e+132) tmp = x; else tmp = y; end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_] := Block[{t$95$1 = N[(y * N[(N[(z - t), $MachinePrecision] / N[(z - a), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[t$95$1, -1e+133], y, If[LessEqual[t$95$1, 1e+132], x, y]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := y \cdot \frac{z - t}{z - a}\\
\mathbf{if}\;t\_1 \leq -1 \cdot 10^{+133}:\\
\;\;\;\;y\\
\mathbf{elif}\;t\_1 \leq 10^{+132}:\\
\;\;\;\;x\\
\mathbf{else}:\\
\;\;\;\;y\\
\end{array}
\end{array}
if (*.f64 y (/.f64 (-.f64 z t) (-.f64 z a))) < -1e133 or 9.99999999999999991e131 < (*.f64 y (/.f64 (-.f64 z t) (-.f64 z a))) Initial program 94.4%
Taylor expanded in z around inf
+-commutativeN/A
+-lowering-+.f6440.7
Simplified40.7%
Taylor expanded in y around inf
Simplified31.6%
if -1e133 < (*.f64 y (/.f64 (-.f64 z t) (-.f64 z a))) < 9.99999999999999991e131Initial program 99.9%
Taylor expanded in x around inf
Simplified68.1%
(FPCore (x y z t a) :precision binary64 (let* ((t_1 (/ (- z t) (- z a)))) (if (<= t_1 -5e+102) (/ (* y t) a) (if (<= t_1 1e-54) x (+ x y)))))
double code(double x, double y, double z, double t, double a) {
double t_1 = (z - t) / (z - a);
double tmp;
if (t_1 <= -5e+102) {
tmp = (y * t) / a;
} else if (t_1 <= 1e-54) {
tmp = x;
} else {
tmp = x + y;
}
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 = (z - t) / (z - a)
if (t_1 <= (-5d+102)) then
tmp = (y * t) / a
else if (t_1 <= 1d-54) then
tmp = x
else
tmp = x + y
end if
code = tmp
end function
public static double code(double x, double y, double z, double t, double a) {
double t_1 = (z - t) / (z - a);
double tmp;
if (t_1 <= -5e+102) {
tmp = (y * t) / a;
} else if (t_1 <= 1e-54) {
tmp = x;
} else {
tmp = x + y;
}
return tmp;
}
def code(x, y, z, t, a): t_1 = (z - t) / (z - a) tmp = 0 if t_1 <= -5e+102: tmp = (y * t) / a elif t_1 <= 1e-54: tmp = x else: tmp = x + y return tmp
function code(x, y, z, t, a) t_1 = Float64(Float64(z - t) / Float64(z - a)) tmp = 0.0 if (t_1 <= -5e+102) tmp = Float64(Float64(y * t) / a); elseif (t_1 <= 1e-54) tmp = x; else tmp = Float64(x + y); end return tmp end
function tmp_2 = code(x, y, z, t, a) t_1 = (z - t) / (z - a); tmp = 0.0; if (t_1 <= -5e+102) tmp = (y * t) / a; elseif (t_1 <= 1e-54) tmp = x; else tmp = x + y; end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_] := Block[{t$95$1 = N[(N[(z - t), $MachinePrecision] / N[(z - a), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[t$95$1, -5e+102], N[(N[(y * t), $MachinePrecision] / a), $MachinePrecision], If[LessEqual[t$95$1, 1e-54], x, N[(x + y), $MachinePrecision]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := \frac{z - t}{z - a}\\
\mathbf{if}\;t\_1 \leq -5 \cdot 10^{+102}:\\
\;\;\;\;\frac{y \cdot t}{a}\\
\mathbf{elif}\;t\_1 \leq 10^{-54}:\\
\;\;\;\;x\\
\mathbf{else}:\\
\;\;\;\;x + y\\
\end{array}
\end{array}
if (/.f64 (-.f64 z t) (-.f64 z a)) < -5e102Initial program 96.8%
Taylor expanded in z around 0
+-commutativeN/A
*-commutativeN/A
associate-/l*N/A
accelerator-lowering-fma.f64N/A
/-lowering-/.f6462.7
Simplified62.7%
Taylor expanded in y around inf
/-lowering-/.f64N/A
*-commutativeN/A
*-lowering-*.f6456.7
Simplified56.7%
if -5e102 < (/.f64 (-.f64 z t) (-.f64 z a)) < 1e-54Initial program 99.9%
Taylor expanded in x around inf
Simplified61.6%
if 1e-54 < (/.f64 (-.f64 z t) (-.f64 z a)) Initial program 97.0%
Taylor expanded in z around inf
+-commutativeN/A
+-lowering-+.f6482.1
Simplified82.1%
Final simplification71.3%
(FPCore (x y z t a) :precision binary64 (if (<= (/ (- z t) (- z a)) 0.6) (fma y (/ (- t z) a) x) (fma y (- 1.0 (/ t z)) x)))
double code(double x, double y, double z, double t, double a) {
double tmp;
if (((z - t) / (z - a)) <= 0.6) {
tmp = fma(y, ((t - z) / a), x);
} else {
tmp = fma(y, (1.0 - (t / z)), x);
}
return tmp;
}
function code(x, y, z, t, a) tmp = 0.0 if (Float64(Float64(z - t) / Float64(z - a)) <= 0.6) tmp = fma(y, Float64(Float64(t - z) / a), x); else tmp = fma(y, Float64(1.0 - Float64(t / z)), x); end return tmp end
code[x_, y_, z_, t_, a_] := If[LessEqual[N[(N[(z - t), $MachinePrecision] / N[(z - a), $MachinePrecision]), $MachinePrecision], 0.6], N[(y * N[(N[(t - z), $MachinePrecision] / a), $MachinePrecision] + x), $MachinePrecision], N[(y * N[(1.0 - N[(t / z), $MachinePrecision]), $MachinePrecision] + x), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;\frac{z - t}{z - a} \leq 0.6:\\
\;\;\;\;\mathsf{fma}\left(y, \frac{t - z}{a}, x\right)\\
\mathbf{else}:\\
\;\;\;\;\mathsf{fma}\left(y, 1 - \frac{t}{z}, x\right)\\
\end{array}
\end{array}
if (/.f64 (-.f64 z t) (-.f64 z a)) < 0.599999999999999978Initial program 99.2%
Taylor expanded in a around inf
+-commutativeN/A
mul-1-negN/A
associate-/l*N/A
distribute-rgt-neg-inN/A
mul-1-negN/A
accelerator-lowering-fma.f64N/A
associate-*r/N/A
/-lowering-/.f64N/A
mul-1-negN/A
sub-negN/A
+-commutativeN/A
distribute-neg-inN/A
unsub-negN/A
remove-double-negN/A
--lowering--.f6485.9
Simplified85.9%
if 0.599999999999999978 < (/.f64 (-.f64 z t) (-.f64 z a)) Initial program 96.7%
Taylor expanded in a around 0
+-commutativeN/A
associate-/l*N/A
div-subN/A
sub-negN/A
*-inversesN/A
mul-1-negN/A
accelerator-lowering-fma.f64N/A
mul-1-negN/A
unsub-negN/A
--lowering--.f64N/A
/-lowering-/.f6488.4
Simplified88.4%
(FPCore (x y z t a) :precision binary64 (if (<= (/ (- z t) (- z a)) 0.6) (fma y (/ t a) x) (fma y (- 1.0 (/ t z)) x)))
double code(double x, double y, double z, double t, double a) {
double tmp;
if (((z - t) / (z - a)) <= 0.6) {
tmp = fma(y, (t / a), x);
} else {
tmp = fma(y, (1.0 - (t / z)), x);
}
return tmp;
}
function code(x, y, z, t, a) tmp = 0.0 if (Float64(Float64(z - t) / Float64(z - a)) <= 0.6) tmp = fma(y, Float64(t / a), x); else tmp = fma(y, Float64(1.0 - Float64(t / z)), x); end return tmp end
code[x_, y_, z_, t_, a_] := If[LessEqual[N[(N[(z - t), $MachinePrecision] / N[(z - a), $MachinePrecision]), $MachinePrecision], 0.6], N[(y * N[(t / a), $MachinePrecision] + x), $MachinePrecision], N[(y * N[(1.0 - N[(t / z), $MachinePrecision]), $MachinePrecision] + x), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;\frac{z - t}{z - a} \leq 0.6:\\
\;\;\;\;\mathsf{fma}\left(y, \frac{t}{a}, x\right)\\
\mathbf{else}:\\
\;\;\;\;\mathsf{fma}\left(y, 1 - \frac{t}{z}, x\right)\\
\end{array}
\end{array}
if (/.f64 (-.f64 z t) (-.f64 z a)) < 0.599999999999999978Initial program 99.2%
Taylor expanded in z around 0
+-commutativeN/A
*-commutativeN/A
associate-/l*N/A
accelerator-lowering-fma.f64N/A
/-lowering-/.f6478.9
Simplified78.9%
if 0.599999999999999978 < (/.f64 (-.f64 z t) (-.f64 z a)) Initial program 96.7%
Taylor expanded in a around 0
+-commutativeN/A
associate-/l*N/A
div-subN/A
sub-negN/A
*-inversesN/A
mul-1-negN/A
accelerator-lowering-fma.f64N/A
mul-1-negN/A
unsub-negN/A
--lowering--.f64N/A
/-lowering-/.f6488.4
Simplified88.4%
(FPCore (x y z t a) :precision binary64 (if (<= (/ (- z t) (- z a)) 1.8e-48) x (+ x y)))
double code(double x, double y, double z, double t, double a) {
double tmp;
if (((z - t) / (z - a)) <= 1.8e-48) {
tmp = x;
} else {
tmp = x + y;
}
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 - t) / (z - a)) <= 1.8d-48) then
tmp = x
else
tmp = x + y
end if
code = tmp
end function
public static double code(double x, double y, double z, double t, double a) {
double tmp;
if (((z - t) / (z - a)) <= 1.8e-48) {
tmp = x;
} else {
tmp = x + y;
}
return tmp;
}
def code(x, y, z, t, a): tmp = 0 if ((z - t) / (z - a)) <= 1.8e-48: tmp = x else: tmp = x + y return tmp
function code(x, y, z, t, a) tmp = 0.0 if (Float64(Float64(z - t) / Float64(z - a)) <= 1.8e-48) tmp = x; else tmp = Float64(x + y); end return tmp end
function tmp_2 = code(x, y, z, t, a) tmp = 0.0; if (((z - t) / (z - a)) <= 1.8e-48) tmp = x; else tmp = x + y; end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_] := If[LessEqual[N[(N[(z - t), $MachinePrecision] / N[(z - a), $MachinePrecision]), $MachinePrecision], 1.8e-48], x, N[(x + y), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;\frac{z - t}{z - a} \leq 1.8 \cdot 10^{-48}:\\
\;\;\;\;x\\
\mathbf{else}:\\
\;\;\;\;x + y\\
\end{array}
\end{array}
if (/.f64 (-.f64 z t) (-.f64 z a)) < 1.8000000000000001e-48Initial program 99.1%
Taylor expanded in x around inf
Simplified49.5%
if 1.8000000000000001e-48 < (/.f64 (-.f64 z t) (-.f64 z a)) Initial program 97.0%
Taylor expanded in z around inf
+-commutativeN/A
+-lowering-+.f6482.1
Simplified82.1%
Final simplification65.8%
(FPCore (x y z t a) :precision binary64 (+ x (* y (/ (- z t) (- z a)))))
double code(double x, double y, double z, double t, double a) {
return x + (y * ((z - t) / (z - a)));
}
real(8) function code(x, y, z, t, a)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
real(8), intent (in) :: a
code = x + (y * ((z - t) / (z - a)))
end function
public static double code(double x, double y, double z, double t, double a) {
return x + (y * ((z - t) / (z - a)));
}
def code(x, y, z, t, a): return x + (y * ((z - t) / (z - a)))
function code(x, y, z, t, a) return Float64(x + Float64(y * Float64(Float64(z - t) / Float64(z - a)))) end
function tmp = code(x, y, z, t, a) tmp = x + (y * ((z - t) / (z - a))); end
code[x_, y_, z_, t_, a_] := N[(x + N[(y * N[(N[(z - t), $MachinePrecision] / N[(z - a), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
x + y \cdot \frac{z - t}{z - a}
\end{array}
Initial program 98.1%
(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(y / Float64(z - a)), Float64(z - t), x) end
code[x_, y_, z_, t_, a_] := N[(N[(y / N[(z - a), $MachinePrecision]), $MachinePrecision] * N[(z - t), $MachinePrecision] + x), $MachinePrecision]
\begin{array}{l}
\\
\mathsf{fma}\left(\frac{y}{z - a}, z - t, x\right)
\end{array}
Initial program 98.1%
+-commutativeN/A
clear-numN/A
associate-/r/N/A
associate-*r*N/A
*-commutativeN/A
accelerator-lowering-fma.f64N/A
associate-*l/N/A
*-lft-identityN/A
/-lowering-/.f64N/A
--lowering--.f64N/A
--lowering--.f6497.3
Applied egg-rr97.3%
(FPCore (x y z t a) :precision binary64 x)
double code(double x, double y, double z, double t, double a) {
return 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
end function
public static double code(double x, double y, double z, double t, double a) {
return x;
}
def code(x, y, z, t, a): return x
function code(x, y, z, t, a) return x end
function tmp = code(x, y, z, t, a) tmp = x; end
code[x_, y_, z_, t_, a_] := x
\begin{array}{l}
\\
x
\end{array}
Initial program 98.1%
Taylor expanded in x around inf
Simplified49.0%
(FPCore (x y z t a) :precision binary64 (+ x (/ y (/ (- z a) (- z t)))))
double code(double x, double y, double z, double t, double a) {
return x + (y / ((z - a) / (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 / ((z - a) / (z - t)))
end function
public static double code(double x, double y, double z, double t, double a) {
return x + (y / ((z - a) / (z - t)));
}
def code(x, y, z, t, a): return x + (y / ((z - a) / (z - t)))
function code(x, y, z, t, a) return Float64(x + Float64(y / Float64(Float64(z - a) / Float64(z - t)))) end
function tmp = code(x, y, z, t, a) tmp = x + (y / ((z - a) / (z - t))); end
code[x_, y_, z_, t_, a_] := N[(x + N[(y / N[(N[(z - a), $MachinePrecision] / N[(z - t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
x + \frac{y}{\frac{z - a}{z - t}}
\end{array}
herbie shell --seed 2024204
(FPCore (x y z t a)
:name "Graphics.Rendering.Plot.Render.Plot.Axis:renderAxisLine from plot-0.2.3.4, A"
:precision binary64
:alt
(! :herbie-platform default (+ x (/ y (/ (- z a) (- z t)))))
(+ x (* y (/ (- z t) (- z a)))))