
(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(y * Float64(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[(y * N[(N[(z - t), $MachinePrecision] / N[(a - t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
x + y \cdot \frac{z - t}{a - t}
\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 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(y * Float64(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[(y * N[(N[(z - t), $MachinePrecision] / N[(a - t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
x + y \cdot \frac{z - t}{a - t}
\end{array}
(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(y * Float64(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[(y * N[(N[(z - t), $MachinePrecision] / N[(a - t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
x + y \cdot \frac{z - t}{a - t}
\end{array}
Initial program 99.1%
(FPCore (x y z t a)
:precision binary64
(let* ((t_1 (/ (- z t) (- a t))))
(if (<= t_1 -1e+169)
(* (/ y (- a t)) z)
(if (<= t_1 2e-22)
(+ x (* y (/ (- z t) a)))
(if (<= t_1 2e+104) (fma (- 1.0 (/ z t)) y x) (* (/ z (- a t)) y))))))
double code(double x, double y, double z, double t, double a) {
double t_1 = (z - t) / (a - t);
double tmp;
if (t_1 <= -1e+169) {
tmp = (y / (a - t)) * z;
} else if (t_1 <= 2e-22) {
tmp = x + (y * ((z - t) / a));
} else if (t_1 <= 2e+104) {
tmp = fma((1.0 - (z / t)), y, x);
} else {
tmp = (z / (a - t)) * y;
}
return tmp;
}
function code(x, y, z, t, a) t_1 = Float64(Float64(z - t) / Float64(a - t)) tmp = 0.0 if (t_1 <= -1e+169) tmp = Float64(Float64(y / Float64(a - t)) * z); elseif (t_1 <= 2e-22) tmp = Float64(x + Float64(y * Float64(Float64(z - t) / a))); elseif (t_1 <= 2e+104) tmp = fma(Float64(1.0 - Float64(z / t)), y, x); else tmp = Float64(Float64(z / Float64(a - t)) * y); end return tmp end
code[x_, y_, z_, t_, a_] := Block[{t$95$1 = N[(N[(z - t), $MachinePrecision] / N[(a - t), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[t$95$1, -1e+169], N[(N[(y / N[(a - t), $MachinePrecision]), $MachinePrecision] * z), $MachinePrecision], If[LessEqual[t$95$1, 2e-22], N[(x + N[(y * N[(N[(z - t), $MachinePrecision] / a), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[t$95$1, 2e+104], N[(N[(1.0 - N[(z / t), $MachinePrecision]), $MachinePrecision] * y + x), $MachinePrecision], N[(N[(z / N[(a - t), $MachinePrecision]), $MachinePrecision] * y), $MachinePrecision]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := \frac{z - t}{a - t}\\
\mathbf{if}\;t\_1 \leq -1 \cdot 10^{+169}:\\
\;\;\;\;\frac{y}{a - t} \cdot z\\
\mathbf{elif}\;t\_1 \leq 2 \cdot 10^{-22}:\\
\;\;\;\;x + y \cdot \frac{z - t}{a}\\
\mathbf{elif}\;t\_1 \leq 2 \cdot 10^{+104}:\\
\;\;\;\;\mathsf{fma}\left(1 - \frac{z}{t}, y, x\right)\\
\mathbf{else}:\\
\;\;\;\;\frac{z}{a - t} \cdot y\\
\end{array}
\end{array}
if (/.f64 (-.f64 z t) (-.f64 a t)) < -9.99999999999999934e168Initial program 89.3%
Taylor expanded in t around inf
+-commutativeN/A
lower-+.f6423.0
Applied rewrites23.0%
Taylor expanded in z around inf
associate-*l/N/A
lower-*.f64N/A
lower-/.f64N/A
lower--.f6475.8
Applied rewrites75.8%
if -9.99999999999999934e168 < (/.f64 (-.f64 z t) (-.f64 a t)) < 2.0000000000000001e-22Initial program 99.8%
Taylor expanded in a around inf
lower-/.f64N/A
lower--.f6490.5
Applied rewrites90.5%
if 2.0000000000000001e-22 < (/.f64 (-.f64 z t) (-.f64 a t)) < 2e104Initial program 99.9%
Taylor expanded in a around 0
+-commutativeN/A
mul-1-negN/A
associate-/l*N/A
*-commutativeN/A
distribute-lft-neg-inN/A
mul-1-negN/A
div-subN/A
sub-negN/A
*-inversesN/A
metadata-evalN/A
+-commutativeN/A
distribute-lft-inN/A
metadata-evalN/A
lower-fma.f64N/A
mul-1-negN/A
unsub-negN/A
lower--.f64N/A
lower-/.f6492.8
Applied rewrites92.8%
if 2e104 < (/.f64 (-.f64 z t) (-.f64 a t)) Initial program 100.0%
Taylor expanded in z around inf
associate-/l*N/A
*-commutativeN/A
lower-*.f64N/A
lower-/.f64N/A
lower--.f6488.9
Applied rewrites88.9%
Final simplification90.3%
(FPCore (x y z t a)
:precision binary64
(let* ((t_1 (/ (- z t) (- a t))))
(if (<= t_1 1e-78)
(fma z (/ y a) x)
(if (<= t_1 5e-24)
(fma y (/ t (- a)) x)
(if (<= t_1 5e+69) (+ y x) (* (/ z (- a t)) y))))))
double code(double x, double y, double z, double t, double a) {
double t_1 = (z - t) / (a - t);
double tmp;
if (t_1 <= 1e-78) {
tmp = fma(z, (y / a), x);
} else if (t_1 <= 5e-24) {
tmp = fma(y, (t / -a), x);
} else if (t_1 <= 5e+69) {
tmp = y + x;
} else {
tmp = (z / (a - t)) * y;
}
return tmp;
}
function code(x, y, z, t, a) t_1 = Float64(Float64(z - t) / Float64(a - t)) tmp = 0.0 if (t_1 <= 1e-78) tmp = fma(z, Float64(y / a), x); elseif (t_1 <= 5e-24) tmp = fma(y, Float64(t / Float64(-a)), x); elseif (t_1 <= 5e+69) tmp = Float64(y + x); else tmp = Float64(Float64(z / Float64(a - t)) * y); end return tmp end
code[x_, y_, z_, t_, a_] := Block[{t$95$1 = N[(N[(z - t), $MachinePrecision] / N[(a - t), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[t$95$1, 1e-78], N[(z * N[(y / a), $MachinePrecision] + x), $MachinePrecision], If[LessEqual[t$95$1, 5e-24], N[(y * N[(t / (-a)), $MachinePrecision] + x), $MachinePrecision], If[LessEqual[t$95$1, 5e+69], N[(y + x), $MachinePrecision], N[(N[(z / N[(a - t), $MachinePrecision]), $MachinePrecision] * y), $MachinePrecision]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := \frac{z - t}{a - t}\\
\mathbf{if}\;t\_1 \leq 10^{-78}:\\
\;\;\;\;\mathsf{fma}\left(z, \frac{y}{a}, x\right)\\
\mathbf{elif}\;t\_1 \leq 5 \cdot 10^{-24}:\\
\;\;\;\;\mathsf{fma}\left(y, \frac{t}{-a}, x\right)\\
\mathbf{elif}\;t\_1 \leq 5 \cdot 10^{+69}:\\
\;\;\;\;y + x\\
\mathbf{else}:\\
\;\;\;\;\frac{z}{a - t} \cdot y\\
\end{array}
\end{array}
if (/.f64 (-.f64 z t) (-.f64 a t)) < 9.99999999999999999e-79Initial program 98.2%
lift-*.f64N/A
lift-/.f64N/A
clear-numN/A
un-div-invN/A
lower-/.f64N/A
frac-2negN/A
lower-/.f64N/A
neg-sub0N/A
lift--.f64N/A
sub-negN/A
+-commutativeN/A
associate--r+N/A
neg-sub0N/A
remove-double-negN/A
lower--.f64N/A
neg-sub0N/A
lift--.f64N/A
sub-negN/A
+-commutativeN/A
associate--r+N/A
neg-sub0N/A
remove-double-negN/A
lower--.f6498.2
Applied rewrites98.2%
Taylor expanded in t around 0
+-commutativeN/A
*-commutativeN/A
associate-/l*N/A
lower-fma.f64N/A
lower-/.f6480.2
Applied rewrites80.2%
if 9.99999999999999999e-79 < (/.f64 (-.f64 z t) (-.f64 a t)) < 4.9999999999999998e-24Initial program 99.6%
lift-*.f64N/A
lift-/.f64N/A
clear-numN/A
un-div-invN/A
lower-/.f64N/A
frac-2negN/A
lower-/.f64N/A
neg-sub0N/A
lift--.f64N/A
sub-negN/A
+-commutativeN/A
associate--r+N/A
neg-sub0N/A
remove-double-negN/A
lower--.f64N/A
neg-sub0N/A
lift--.f64N/A
sub-negN/A
+-commutativeN/A
associate--r+N/A
neg-sub0N/A
remove-double-negN/A
lower--.f6499.8
Applied rewrites99.8%
Taylor expanded in z around 0
+-commutativeN/A
*-commutativeN/A
associate-/l*N/A
lower-fma.f64N/A
lower-/.f64N/A
lower--.f6482.1
Applied rewrites82.1%
Taylor expanded in t around 0
Applied rewrites82.1%
if 4.9999999999999998e-24 < (/.f64 (-.f64 z t) (-.f64 a t)) < 5.00000000000000036e69Initial program 99.9%
Taylor expanded in t around inf
+-commutativeN/A
lower-+.f6492.9
Applied rewrites92.9%
if 5.00000000000000036e69 < (/.f64 (-.f64 z t) (-.f64 a t)) Initial program 100.0%
Taylor expanded in z around inf
associate-/l*N/A
*-commutativeN/A
lower-*.f64N/A
lower-/.f64N/A
lower--.f6483.0
Applied rewrites83.0%
Final simplification85.7%
(FPCore (x y z t a)
:precision binary64
(let* ((t_1 (/ (- z t) (- a t))) (t_2 (/ (* y z) a)))
(if (<= t_1 -5e+214)
t_2
(if (<= t_1 5e-58) (* (- x) -1.0) (if (<= t_1 5e+140) (+ y x) t_2)))))
double code(double x, double y, double z, double t, double a) {
double t_1 = (z - t) / (a - t);
double t_2 = (y * z) / a;
double tmp;
if (t_1 <= -5e+214) {
tmp = t_2;
} else if (t_1 <= 5e-58) {
tmp = -x * -1.0;
} else if (t_1 <= 5e+140) {
tmp = y + x;
} else {
tmp = t_2;
}
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) :: t_2
real(8) :: tmp
t_1 = (z - t) / (a - t)
t_2 = (y * z) / a
if (t_1 <= (-5d+214)) then
tmp = t_2
else if (t_1 <= 5d-58) then
tmp = -x * (-1.0d0)
else if (t_1 <= 5d+140) then
tmp = y + x
else
tmp = t_2
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) / (a - t);
double t_2 = (y * z) / a;
double tmp;
if (t_1 <= -5e+214) {
tmp = t_2;
} else if (t_1 <= 5e-58) {
tmp = -x * -1.0;
} else if (t_1 <= 5e+140) {
tmp = y + x;
} else {
tmp = t_2;
}
return tmp;
}
def code(x, y, z, t, a): t_1 = (z - t) / (a - t) t_2 = (y * z) / a tmp = 0 if t_1 <= -5e+214: tmp = t_2 elif t_1 <= 5e-58: tmp = -x * -1.0 elif t_1 <= 5e+140: tmp = y + x else: tmp = t_2 return tmp
function code(x, y, z, t, a) t_1 = Float64(Float64(z - t) / Float64(a - t)) t_2 = Float64(Float64(y * z) / a) tmp = 0.0 if (t_1 <= -5e+214) tmp = t_2; elseif (t_1 <= 5e-58) tmp = Float64(Float64(-x) * -1.0); elseif (t_1 <= 5e+140) tmp = Float64(y + x); else tmp = t_2; end return tmp end
function tmp_2 = code(x, y, z, t, a) t_1 = (z - t) / (a - t); t_2 = (y * z) / a; tmp = 0.0; if (t_1 <= -5e+214) tmp = t_2; elseif (t_1 <= 5e-58) tmp = -x * -1.0; elseif (t_1 <= 5e+140) tmp = y + x; else tmp = t_2; end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_] := Block[{t$95$1 = N[(N[(z - t), $MachinePrecision] / N[(a - t), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$2 = N[(N[(y * z), $MachinePrecision] / a), $MachinePrecision]}, If[LessEqual[t$95$1, -5e+214], t$95$2, If[LessEqual[t$95$1, 5e-58], N[((-x) * -1.0), $MachinePrecision], If[LessEqual[t$95$1, 5e+140], N[(y + x), $MachinePrecision], t$95$2]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := \frac{z - t}{a - t}\\
t_2 := \frac{y \cdot z}{a}\\
\mathbf{if}\;t\_1 \leq -5 \cdot 10^{+214}:\\
\;\;\;\;t\_2\\
\mathbf{elif}\;t\_1 \leq 5 \cdot 10^{-58}:\\
\;\;\;\;\left(-x\right) \cdot -1\\
\mathbf{elif}\;t\_1 \leq 5 \cdot 10^{+140}:\\
\;\;\;\;y + x\\
\mathbf{else}:\\
\;\;\;\;t\_2\\
\end{array}
\end{array}
if (/.f64 (-.f64 z t) (-.f64 a t)) < -4.99999999999999953e214 or 5.00000000000000008e140 < (/.f64 (-.f64 z t) (-.f64 a t)) Initial program 92.2%
Taylor expanded in x around 0
associate-/l*N/A
div-subN/A
distribute-lft-out--N/A
associate-/l*N/A
associate-/l*N/A
*-commutativeN/A
associate-*l/N/A
associate-/l*N/A
*-commutativeN/A
distribute-lft-out--N/A
lower-*.f64N/A
lower-/.f64N/A
lower--.f64N/A
lower--.f6485.9
Applied rewrites85.9%
Taylor expanded in t around 0
Applied rewrites73.3%
Taylor expanded in t around 0
Applied rewrites73.4%
if -4.99999999999999953e214 < (/.f64 (-.f64 z t) (-.f64 a t)) < 4.99999999999999977e-58Initial program 99.8%
Taylor expanded in x around -inf
associate-*r*N/A
lower-*.f64N/A
mul-1-negN/A
lower-neg.f64N/A
sub-negN/A
mul-1-negN/A
*-commutativeN/A
associate-/l*N/A
distribute-lft-neg-inN/A
mul-1-negN/A
metadata-evalN/A
lower-fma.f64N/A
Applied rewrites87.4%
Taylor expanded in x around inf
Applied rewrites65.9%
if 4.99999999999999977e-58 < (/.f64 (-.f64 z t) (-.f64 a t)) < 5.00000000000000008e140Initial program 99.9%
Taylor expanded in t around inf
+-commutativeN/A
lower-+.f6485.7
Applied rewrites85.7%
Final simplification76.2%
(FPCore (x y z t a)
:precision binary64
(let* ((t_1 (/ (- z t) (- a t))))
(if (<= t_1 2e-22)
(fma (- z t) (/ y a) x)
(if (<= t_1 2e+104) (fma (- 1.0 (/ z t)) y x) (* (/ z (- a t)) y)))))
double code(double x, double y, double z, double t, double a) {
double t_1 = (z - t) / (a - t);
double tmp;
if (t_1 <= 2e-22) {
tmp = fma((z - t), (y / a), x);
} else if (t_1 <= 2e+104) {
tmp = fma((1.0 - (z / t)), y, x);
} else {
tmp = (z / (a - t)) * y;
}
return tmp;
}
function code(x, y, z, t, a) t_1 = Float64(Float64(z - t) / Float64(a - t)) tmp = 0.0 if (t_1 <= 2e-22) tmp = fma(Float64(z - t), Float64(y / a), x); elseif (t_1 <= 2e+104) tmp = fma(Float64(1.0 - Float64(z / t)), y, x); else tmp = Float64(Float64(z / Float64(a - t)) * y); end return tmp end
code[x_, y_, z_, t_, a_] := Block[{t$95$1 = N[(N[(z - t), $MachinePrecision] / N[(a - t), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[t$95$1, 2e-22], N[(N[(z - t), $MachinePrecision] * N[(y / a), $MachinePrecision] + x), $MachinePrecision], If[LessEqual[t$95$1, 2e+104], N[(N[(1.0 - N[(z / t), $MachinePrecision]), $MachinePrecision] * y + x), $MachinePrecision], N[(N[(z / N[(a - t), $MachinePrecision]), $MachinePrecision] * y), $MachinePrecision]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := \frac{z - t}{a - t}\\
\mathbf{if}\;t\_1 \leq 2 \cdot 10^{-22}:\\
\;\;\;\;\mathsf{fma}\left(z - t, \frac{y}{a}, x\right)\\
\mathbf{elif}\;t\_1 \leq 2 \cdot 10^{+104}:\\
\;\;\;\;\mathsf{fma}\left(1 - \frac{z}{t}, y, x\right)\\
\mathbf{else}:\\
\;\;\;\;\frac{z}{a - t} \cdot y\\
\end{array}
\end{array}
if (/.f64 (-.f64 z t) (-.f64 a t)) < 2.0000000000000001e-22Initial program 98.4%
Taylor expanded in a around inf
+-commutativeN/A
*-commutativeN/A
associate-/l*N/A
lower-fma.f64N/A
lower--.f64N/A
lower-/.f6484.3
Applied rewrites84.3%
if 2.0000000000000001e-22 < (/.f64 (-.f64 z t) (-.f64 a t)) < 2e104Initial program 99.9%
Taylor expanded in a around 0
+-commutativeN/A
mul-1-negN/A
associate-/l*N/A
*-commutativeN/A
distribute-lft-neg-inN/A
mul-1-negN/A
div-subN/A
sub-negN/A
*-inversesN/A
metadata-evalN/A
+-commutativeN/A
distribute-lft-inN/A
metadata-evalN/A
lower-fma.f64N/A
mul-1-negN/A
unsub-negN/A
lower--.f64N/A
lower-/.f6492.8
Applied rewrites92.8%
if 2e104 < (/.f64 (-.f64 z t) (-.f64 a t)) Initial program 100.0%
Taylor expanded in z around inf
associate-/l*N/A
*-commutativeN/A
lower-*.f64N/A
lower-/.f64N/A
lower--.f6488.9
Applied rewrites88.9%
Final simplification88.3%
(FPCore (x y z t a)
:precision binary64
(let* ((t_1 (/ (- z t) (- a t))))
(if (<= t_1 1e-29)
(fma z (/ y a) x)
(if (<= t_1 5e+69) (+ y x) (* (/ z (- a t)) y)))))
double code(double x, double y, double z, double t, double a) {
double t_1 = (z - t) / (a - t);
double tmp;
if (t_1 <= 1e-29) {
tmp = fma(z, (y / a), x);
} else if (t_1 <= 5e+69) {
tmp = y + x;
} else {
tmp = (z / (a - t)) * y;
}
return tmp;
}
function code(x, y, z, t, a) t_1 = Float64(Float64(z - t) / Float64(a - t)) tmp = 0.0 if (t_1 <= 1e-29) tmp = fma(z, Float64(y / a), x); elseif (t_1 <= 5e+69) tmp = Float64(y + x); else tmp = Float64(Float64(z / Float64(a - t)) * y); end return tmp end
code[x_, y_, z_, t_, a_] := Block[{t$95$1 = N[(N[(z - t), $MachinePrecision] / N[(a - t), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[t$95$1, 1e-29], N[(z * N[(y / a), $MachinePrecision] + x), $MachinePrecision], If[LessEqual[t$95$1, 5e+69], N[(y + x), $MachinePrecision], N[(N[(z / N[(a - t), $MachinePrecision]), $MachinePrecision] * y), $MachinePrecision]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := \frac{z - t}{a - t}\\
\mathbf{if}\;t\_1 \leq 10^{-29}:\\
\;\;\;\;\mathsf{fma}\left(z, \frac{y}{a}, x\right)\\
\mathbf{elif}\;t\_1 \leq 5 \cdot 10^{+69}:\\
\;\;\;\;y + x\\
\mathbf{else}:\\
\;\;\;\;\frac{z}{a - t} \cdot y\\
\end{array}
\end{array}
if (/.f64 (-.f64 z t) (-.f64 a t)) < 9.99999999999999943e-30Initial program 98.3%
lift-*.f64N/A
lift-/.f64N/A
clear-numN/A
un-div-invN/A
lower-/.f64N/A
frac-2negN/A
lower-/.f64N/A
neg-sub0N/A
lift--.f64N/A
sub-negN/A
+-commutativeN/A
associate--r+N/A
neg-sub0N/A
remove-double-negN/A
lower--.f64N/A
neg-sub0N/A
lift--.f64N/A
sub-negN/A
+-commutativeN/A
associate--r+N/A
neg-sub0N/A
remove-double-negN/A
lower--.f6498.3
Applied rewrites98.3%
Taylor expanded in t around 0
+-commutativeN/A
*-commutativeN/A
associate-/l*N/A
lower-fma.f64N/A
lower-/.f6477.4
Applied rewrites77.4%
if 9.99999999999999943e-30 < (/.f64 (-.f64 z t) (-.f64 a t)) < 5.00000000000000036e69Initial program 99.9%
Taylor expanded in t around inf
+-commutativeN/A
lower-+.f6492.2
Applied rewrites92.2%
if 5.00000000000000036e69 < (/.f64 (-.f64 z t) (-.f64 a t)) Initial program 100.0%
Taylor expanded in z around inf
associate-/l*N/A
*-commutativeN/A
lower-*.f64N/A
lower-/.f64N/A
lower--.f6483.0
Applied rewrites83.0%
Final simplification84.1%
(FPCore (x y z t a)
:precision binary64
(let* ((t_1 (/ (- z t) (- a t))))
(if (<= t_1 1e-29)
(fma z (/ y a) x)
(if (<= t_1 2e+104) (+ y x) (* (/ y (- a t)) z)))))
double code(double x, double y, double z, double t, double a) {
double t_1 = (z - t) / (a - t);
double tmp;
if (t_1 <= 1e-29) {
tmp = fma(z, (y / a), x);
} else if (t_1 <= 2e+104) {
tmp = y + x;
} else {
tmp = (y / (a - t)) * z;
}
return tmp;
}
function code(x, y, z, t, a) t_1 = Float64(Float64(z - t) / Float64(a - t)) tmp = 0.0 if (t_1 <= 1e-29) tmp = fma(z, Float64(y / a), x); elseif (t_1 <= 2e+104) tmp = Float64(y + x); else tmp = Float64(Float64(y / Float64(a - t)) * z); end return tmp end
code[x_, y_, z_, t_, a_] := Block[{t$95$1 = N[(N[(z - t), $MachinePrecision] / N[(a - t), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[t$95$1, 1e-29], N[(z * N[(y / a), $MachinePrecision] + x), $MachinePrecision], If[LessEqual[t$95$1, 2e+104], N[(y + x), $MachinePrecision], N[(N[(y / N[(a - t), $MachinePrecision]), $MachinePrecision] * z), $MachinePrecision]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := \frac{z - t}{a - t}\\
\mathbf{if}\;t\_1 \leq 10^{-29}:\\
\;\;\;\;\mathsf{fma}\left(z, \frac{y}{a}, x\right)\\
\mathbf{elif}\;t\_1 \leq 2 \cdot 10^{+104}:\\
\;\;\;\;y + x\\
\mathbf{else}:\\
\;\;\;\;\frac{y}{a - t} \cdot z\\
\end{array}
\end{array}
if (/.f64 (-.f64 z t) (-.f64 a t)) < 9.99999999999999943e-30Initial program 98.3%
lift-*.f64N/A
lift-/.f64N/A
clear-numN/A
un-div-invN/A
lower-/.f64N/A
frac-2negN/A
lower-/.f64N/A
neg-sub0N/A
lift--.f64N/A
sub-negN/A
+-commutativeN/A
associate--r+N/A
neg-sub0N/A
remove-double-negN/A
lower--.f64N/A
neg-sub0N/A
lift--.f64N/A
sub-negN/A
+-commutativeN/A
associate--r+N/A
neg-sub0N/A
remove-double-negN/A
lower--.f6498.3
Applied rewrites98.3%
Taylor expanded in t around 0
+-commutativeN/A
*-commutativeN/A
associate-/l*N/A
lower-fma.f64N/A
lower-/.f6477.4
Applied rewrites77.4%
if 9.99999999999999943e-30 < (/.f64 (-.f64 z t) (-.f64 a t)) < 2e104Initial program 99.9%
Taylor expanded in t around inf
+-commutativeN/A
lower-+.f6490.0
Applied rewrites90.0%
if 2e104 < (/.f64 (-.f64 z t) (-.f64 a t)) Initial program 100.0%
Taylor expanded in t around inf
+-commutativeN/A
lower-+.f6415.7
Applied rewrites15.7%
Taylor expanded in z around inf
associate-*l/N/A
lower-*.f64N/A
lower-/.f64N/A
lower--.f6483.6
Applied rewrites83.6%
Final simplification83.3%
(FPCore (x y z t a) :precision binary64 (if (<= t -5.4e-89) (fma (- 1.0 (/ z t)) y x) (if (<= t 2.9e-78) (+ x (/ (* (- z t) y) a)) (fma y (/ t (- t a)) x))))
double code(double x, double y, double z, double t, double a) {
double tmp;
if (t <= -5.4e-89) {
tmp = fma((1.0 - (z / t)), y, x);
} else if (t <= 2.9e-78) {
tmp = x + (((z - t) * y) / a);
} else {
tmp = fma(y, (t / (t - a)), x);
}
return tmp;
}
function code(x, y, z, t, a) tmp = 0.0 if (t <= -5.4e-89) tmp = fma(Float64(1.0 - Float64(z / t)), y, x); elseif (t <= 2.9e-78) tmp = Float64(x + Float64(Float64(Float64(z - t) * y) / a)); else tmp = fma(y, Float64(t / Float64(t - a)), x); end return tmp end
code[x_, y_, z_, t_, a_] := If[LessEqual[t, -5.4e-89], N[(N[(1.0 - N[(z / t), $MachinePrecision]), $MachinePrecision] * y + x), $MachinePrecision], If[LessEqual[t, 2.9e-78], N[(x + N[(N[(N[(z - t), $MachinePrecision] * y), $MachinePrecision] / a), $MachinePrecision]), $MachinePrecision], N[(y * N[(t / N[(t - a), $MachinePrecision]), $MachinePrecision] + x), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;t \leq -5.4 \cdot 10^{-89}:\\
\;\;\;\;\mathsf{fma}\left(1 - \frac{z}{t}, y, x\right)\\
\mathbf{elif}\;t \leq 2.9 \cdot 10^{-78}:\\
\;\;\;\;x + \frac{\left(z - t\right) \cdot y}{a}\\
\mathbf{else}:\\
\;\;\;\;\mathsf{fma}\left(y, \frac{t}{t - a}, x\right)\\
\end{array}
\end{array}
if t < -5.39999999999999975e-89Initial program 99.9%
Taylor expanded in a around 0
+-commutativeN/A
mul-1-negN/A
associate-/l*N/A
*-commutativeN/A
distribute-lft-neg-inN/A
mul-1-negN/A
div-subN/A
sub-negN/A
*-inversesN/A
metadata-evalN/A
+-commutativeN/A
distribute-lft-inN/A
metadata-evalN/A
lower-fma.f64N/A
mul-1-negN/A
unsub-negN/A
lower--.f64N/A
lower-/.f6488.2
Applied rewrites88.2%
if -5.39999999999999975e-89 < t < 2.9000000000000001e-78Initial program 97.9%
Taylor expanded in a around inf
lower-/.f64N/A
*-commutativeN/A
lower-*.f64N/A
lower--.f6490.5
Applied rewrites90.5%
if 2.9000000000000001e-78 < t Initial program 99.9%
lift-*.f64N/A
lift-/.f64N/A
clear-numN/A
un-div-invN/A
lower-/.f64N/A
frac-2negN/A
lower-/.f64N/A
neg-sub0N/A
lift--.f64N/A
sub-negN/A
+-commutativeN/A
associate--r+N/A
neg-sub0N/A
remove-double-negN/A
lower--.f64N/A
neg-sub0N/A
lift--.f64N/A
sub-negN/A
+-commutativeN/A
associate--r+N/A
neg-sub0N/A
remove-double-negN/A
lower--.f6499.9
Applied rewrites99.9%
Taylor expanded in z around 0
+-commutativeN/A
*-commutativeN/A
associate-/l*N/A
lower-fma.f64N/A
lower-/.f64N/A
lower--.f6486.9
Applied rewrites86.9%
Final simplification88.6%
(FPCore (x y z t a) :precision binary64 (if (or (<= t -5.4e-89) (not (<= t 1.45e-143))) (fma (- 1.0 (/ z t)) y x) (+ x (/ (* z y) a))))
double code(double x, double y, double z, double t, double a) {
double tmp;
if ((t <= -5.4e-89) || !(t <= 1.45e-143)) {
tmp = fma((1.0 - (z / t)), y, x);
} else {
tmp = x + ((z * y) / a);
}
return tmp;
}
function code(x, y, z, t, a) tmp = 0.0 if ((t <= -5.4e-89) || !(t <= 1.45e-143)) tmp = fma(Float64(1.0 - Float64(z / t)), y, x); else tmp = Float64(x + Float64(Float64(z * y) / a)); end return tmp end
code[x_, y_, z_, t_, a_] := If[Or[LessEqual[t, -5.4e-89], N[Not[LessEqual[t, 1.45e-143]], $MachinePrecision]], N[(N[(1.0 - N[(z / t), $MachinePrecision]), $MachinePrecision] * y + x), $MachinePrecision], N[(x + N[(N[(z * y), $MachinePrecision] / a), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;t \leq -5.4 \cdot 10^{-89} \lor \neg \left(t \leq 1.45 \cdot 10^{-143}\right):\\
\;\;\;\;\mathsf{fma}\left(1 - \frac{z}{t}, y, x\right)\\
\mathbf{else}:\\
\;\;\;\;x + \frac{z \cdot y}{a}\\
\end{array}
\end{array}
if t < -5.39999999999999975e-89 or 1.45e-143 < t Initial program 99.9%
Taylor expanded in a around 0
+-commutativeN/A
mul-1-negN/A
associate-/l*N/A
*-commutativeN/A
distribute-lft-neg-inN/A
mul-1-negN/A
div-subN/A
sub-negN/A
*-inversesN/A
metadata-evalN/A
+-commutativeN/A
distribute-lft-inN/A
metadata-evalN/A
lower-fma.f64N/A
mul-1-negN/A
unsub-negN/A
lower--.f64N/A
lower-/.f6487.3
Applied rewrites87.3%
if -5.39999999999999975e-89 < t < 1.45e-143Initial program 97.7%
Taylor expanded in t around 0
lower-/.f64N/A
*-commutativeN/A
lower-*.f6488.6
Applied rewrites88.6%
Final simplification87.7%
(FPCore (x y z t a) :precision binary64 (if (<= (/ (- z t) (- a t)) 1.7e-57) (* (- x) -1.0) (+ y x)))
double code(double x, double y, double z, double t, double a) {
double tmp;
if (((z - t) / (a - t)) <= 1.7e-57) {
tmp = -x * -1.0;
} 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 - t) / (a - t)) <= 1.7d-57) then
tmp = -x * (-1.0d0)
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 - t) / (a - t)) <= 1.7e-57) {
tmp = -x * -1.0;
} else {
tmp = y + x;
}
return tmp;
}
def code(x, y, z, t, a): tmp = 0 if ((z - t) / (a - t)) <= 1.7e-57: tmp = -x * -1.0 else: tmp = y + x return tmp
function code(x, y, z, t, a) tmp = 0.0 if (Float64(Float64(z - t) / Float64(a - t)) <= 1.7e-57) tmp = Float64(Float64(-x) * -1.0); else tmp = Float64(y + x); end return tmp end
function tmp_2 = code(x, y, z, t, a) tmp = 0.0; if (((z - t) / (a - t)) <= 1.7e-57) tmp = -x * -1.0; else tmp = y + x; end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_] := If[LessEqual[N[(N[(z - t), $MachinePrecision] / N[(a - t), $MachinePrecision]), $MachinePrecision], 1.7e-57], N[((-x) * -1.0), $MachinePrecision], N[(y + x), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;\frac{z - t}{a - t} \leq 1.7 \cdot 10^{-57}:\\
\;\;\;\;\left(-x\right) \cdot -1\\
\mathbf{else}:\\
\;\;\;\;y + x\\
\end{array}
\end{array}
if (/.f64 (-.f64 z t) (-.f64 a t)) < 1.70000000000000008e-57Initial program 98.2%
Taylor expanded in x around -inf
associate-*r*N/A
lower-*.f64N/A
mul-1-negN/A
lower-neg.f64N/A
sub-negN/A
mul-1-negN/A
*-commutativeN/A
associate-/l*N/A
distribute-lft-neg-inN/A
mul-1-negN/A
metadata-evalN/A
lower-fma.f64N/A
Applied rewrites88.4%
Taylor expanded in x around inf
Applied rewrites62.1%
if 1.70000000000000008e-57 < (/.f64 (-.f64 z t) (-.f64 a t)) Initial program 99.9%
Taylor expanded in t around inf
+-commutativeN/A
lower-+.f6478.2
Applied rewrites78.2%
Final simplification70.8%
(FPCore (x y z t a) :precision binary64 (if (or (<= t -5.4e-89) (not (<= t 1.25e+61))) (+ y x) (fma (/ z a) y x)))
double code(double x, double y, double z, double t, double a) {
double tmp;
if ((t <= -5.4e-89) || !(t <= 1.25e+61)) {
tmp = y + x;
} else {
tmp = fma((z / a), y, x);
}
return tmp;
}
function code(x, y, z, t, a) tmp = 0.0 if ((t <= -5.4e-89) || !(t <= 1.25e+61)) tmp = Float64(y + x); else tmp = fma(Float64(z / a), y, x); end return tmp end
code[x_, y_, z_, t_, a_] := If[Or[LessEqual[t, -5.4e-89], N[Not[LessEqual[t, 1.25e+61]], $MachinePrecision]], N[(y + x), $MachinePrecision], N[(N[(z / a), $MachinePrecision] * y + x), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;t \leq -5.4 \cdot 10^{-89} \lor \neg \left(t \leq 1.25 \cdot 10^{+61}\right):\\
\;\;\;\;y + x\\
\mathbf{else}:\\
\;\;\;\;\mathsf{fma}\left(\frac{z}{a}, y, x\right)\\
\end{array}
\end{array}
if t < -5.39999999999999975e-89 or 1.25000000000000004e61 < t Initial program 99.9%
Taylor expanded in t around inf
+-commutativeN/A
lower-+.f6483.3
Applied rewrites83.3%
if -5.39999999999999975e-89 < t < 1.25000000000000004e61Initial program 98.3%
Taylor expanded in t around 0
+-commutativeN/A
associate-/l*N/A
*-commutativeN/A
lower-fma.f64N/A
lower-/.f6483.1
Applied rewrites83.1%
Final simplification83.2%
(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 99.1%
Taylor expanded in t around inf
+-commutativeN/A
lower-+.f6464.1
Applied rewrites64.1%
Final simplification64.1%
(FPCore (x y z t a)
:precision binary64
(let* ((t_1 (+ x (* y (/ (- z t) (- a t))))))
(if (< y -8.508084860551241e-17)
t_1
(if (< y 2.894426862792089e-49)
(+ x (* (* y (- z t)) (/ 1.0 (- a t))))
t_1))))
double code(double x, double y, double z, double t, double a) {
double t_1 = x + (y * ((z - t) / (a - t)));
double tmp;
if (y < -8.508084860551241e-17) {
tmp = t_1;
} else if (y < 2.894426862792089e-49) {
tmp = x + ((y * (z - t)) * (1.0 / (a - t)));
} 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 - t) / (a - t)))
if (y < (-8.508084860551241d-17)) then
tmp = t_1
else if (y < 2.894426862792089d-49) then
tmp = x + ((y * (z - t)) * (1.0d0 / (a - t)))
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 - t) / (a - t)));
double tmp;
if (y < -8.508084860551241e-17) {
tmp = t_1;
} else if (y < 2.894426862792089e-49) {
tmp = x + ((y * (z - t)) * (1.0 / (a - t)));
} else {
tmp = t_1;
}
return tmp;
}
def code(x, y, z, t, a): t_1 = x + (y * ((z - t) / (a - t))) tmp = 0 if y < -8.508084860551241e-17: tmp = t_1 elif y < 2.894426862792089e-49: tmp = x + ((y * (z - t)) * (1.0 / (a - t))) else: tmp = t_1 return tmp
function code(x, y, z, t, a) t_1 = Float64(x + Float64(y * Float64(Float64(z - t) / Float64(a - t)))) tmp = 0.0 if (y < -8.508084860551241e-17) tmp = t_1; elseif (y < 2.894426862792089e-49) tmp = Float64(x + Float64(Float64(y * Float64(z - t)) * Float64(1.0 / Float64(a - t)))); else tmp = t_1; end return tmp end
function tmp_2 = code(x, y, z, t, a) t_1 = x + (y * ((z - t) / (a - t))); tmp = 0.0; if (y < -8.508084860551241e-17) tmp = t_1; elseif (y < 2.894426862792089e-49) tmp = x + ((y * (z - t)) * (1.0 / (a - t))); else tmp = t_1; end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_] := Block[{t$95$1 = N[(x + N[(y * N[(N[(z - t), $MachinePrecision] / N[(a - t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, If[Less[y, -8.508084860551241e-17], t$95$1, If[Less[y, 2.894426862792089e-49], N[(x + N[(N[(y * N[(z - t), $MachinePrecision]), $MachinePrecision] * N[(1.0 / N[(a - t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], t$95$1]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := x + y \cdot \frac{z - t}{a - t}\\
\mathbf{if}\;y < -8.508084860551241 \cdot 10^{-17}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;y < 2.894426862792089 \cdot 10^{-49}:\\
\;\;\;\;x + \left(y \cdot \left(z - t\right)\right) \cdot \frac{1}{a - t}\\
\mathbf{else}:\\
\;\;\;\;t\_1\\
\end{array}
\end{array}
herbie shell --seed 2024313
(FPCore (x y z t a)
:name "Graphics.Rendering.Plot.Render.Plot.Axis:renderAxisLine from plot-0.2.3.4, B"
:precision binary64
:alt
(! :herbie-platform default (if (< y -8508084860551241/100000000000000000000000000000000) (+ x (* y (/ (- z t) (- a t)))) (if (< y 2894426862792089/10000000000000000000000000000000000000000000000000000000000000000) (+ x (* (* y (- z t)) (/ 1 (- a t)))) (+ x (* y (/ (- z t) (- a t)))))))
(+ x (* y (/ (- z t) (- a t)))))