
(FPCore (x y z t) :precision binary64 (/ x (- y (* z t))))
double code(double x, double y, double z, double t) {
return x / (y - (z * t));
}
module fmin_fmax_functions
implicit none
private
public fmax
public fmin
interface fmax
module procedure fmax88
module procedure fmax44
module procedure fmax84
module procedure fmax48
end interface
interface fmin
module procedure fmin88
module procedure fmin44
module procedure fmin84
module procedure fmin48
end interface
contains
real(8) function fmax88(x, y) result (res)
real(8), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(x, max(x, y), y /= y), x /= x)
end function
real(4) function fmax44(x, y) result (res)
real(4), intent (in) :: x
real(4), intent (in) :: y
res = merge(y, merge(x, max(x, y), y /= y), x /= x)
end function
real(8) function fmax84(x, y) result(res)
real(8), intent (in) :: x
real(4), intent (in) :: y
res = merge(dble(y), merge(x, max(x, dble(y)), y /= y), x /= x)
end function
real(8) function fmax48(x, y) result(res)
real(4), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(dble(x), max(dble(x), y), y /= y), x /= x)
end function
real(8) function fmin88(x, y) result (res)
real(8), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(x, min(x, y), y /= y), x /= x)
end function
real(4) function fmin44(x, y) result (res)
real(4), intent (in) :: x
real(4), intent (in) :: y
res = merge(y, merge(x, min(x, y), y /= y), x /= x)
end function
real(8) function fmin84(x, y) result(res)
real(8), intent (in) :: x
real(4), intent (in) :: y
res = merge(dble(y), merge(x, min(x, dble(y)), y /= y), x /= x)
end function
real(8) function fmin48(x, y) result(res)
real(4), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(dble(x), min(dble(x), y), y /= y), x /= x)
end function
end module
real(8) function code(x, y, z, t)
use fmin_fmax_functions
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
code = x / (y - (z * t))
end function
public static double code(double x, double y, double z, double t) {
return x / (y - (z * t));
}
def code(x, y, z, t): return x / (y - (z * t))
function code(x, y, z, t) return Float64(x / Float64(y - Float64(z * t))) end
function tmp = code(x, y, z, t) tmp = x / (y - (z * t)); end
code[x_, y_, z_, t_] := N[(x / N[(y - N[(z * t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
\frac{x}{y - z \cdot t}
\end{array}
Herbie found 7 alternatives:
| Alternative | Accuracy | Speedup |
|---|
(FPCore (x y z t) :precision binary64 (/ x (- y (* z t))))
double code(double x, double y, double z, double t) {
return x / (y - (z * t));
}
module fmin_fmax_functions
implicit none
private
public fmax
public fmin
interface fmax
module procedure fmax88
module procedure fmax44
module procedure fmax84
module procedure fmax48
end interface
interface fmin
module procedure fmin88
module procedure fmin44
module procedure fmin84
module procedure fmin48
end interface
contains
real(8) function fmax88(x, y) result (res)
real(8), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(x, max(x, y), y /= y), x /= x)
end function
real(4) function fmax44(x, y) result (res)
real(4), intent (in) :: x
real(4), intent (in) :: y
res = merge(y, merge(x, max(x, y), y /= y), x /= x)
end function
real(8) function fmax84(x, y) result(res)
real(8), intent (in) :: x
real(4), intent (in) :: y
res = merge(dble(y), merge(x, max(x, dble(y)), y /= y), x /= x)
end function
real(8) function fmax48(x, y) result(res)
real(4), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(dble(x), max(dble(x), y), y /= y), x /= x)
end function
real(8) function fmin88(x, y) result (res)
real(8), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(x, min(x, y), y /= y), x /= x)
end function
real(4) function fmin44(x, y) result (res)
real(4), intent (in) :: x
real(4), intent (in) :: y
res = merge(y, merge(x, min(x, y), y /= y), x /= x)
end function
real(8) function fmin84(x, y) result(res)
real(8), intent (in) :: x
real(4), intent (in) :: y
res = merge(dble(y), merge(x, min(x, dble(y)), y /= y), x /= x)
end function
real(8) function fmin48(x, y) result(res)
real(4), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(dble(x), min(dble(x), y), y /= y), x /= x)
end function
end module
real(8) function code(x, y, z, t)
use fmin_fmax_functions
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
code = x / (y - (z * t))
end function
public static double code(double x, double y, double z, double t) {
return x / (y - (z * t));
}
def code(x, y, z, t): return x / (y - (z * t))
function code(x, y, z, t) return Float64(x / Float64(y - Float64(z * t))) end
function tmp = code(x, y, z, t) tmp = x / (y - (z * t)); end
code[x_, y_, z_, t_] := N[(x / N[(y - N[(z * t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
\frac{x}{y - z \cdot t}
\end{array}
(FPCore (x y z t) :precision binary64 (/ (* -1.0 x) (- (fma (* -1.0 t) z y))))
double code(double x, double y, double z, double t) {
return (-1.0 * x) / -fma((-1.0 * t), z, y);
}
function code(x, y, z, t) return Float64(Float64(-1.0 * x) / Float64(-fma(Float64(-1.0 * t), z, y))) end
code[x_, y_, z_, t_] := N[(N[(-1.0 * x), $MachinePrecision] / (-N[(N[(-1.0 * t), $MachinePrecision] * z + y), $MachinePrecision])), $MachinePrecision]
\begin{array}{l}
\\
\frac{-1 \cdot x}{-\mathsf{fma}\left(-1 \cdot t, z, y\right)}
\end{array}
Initial program 95.9%
lift-/.f64N/A
lift--.f64N/A
lift-*.f64N/A
frac-2negN/A
mul-1-negN/A
lower-/.f64N/A
lower-*.f64N/A
lower-neg.f64N/A
*-commutativeN/A
fp-cancel-sub-sign-invN/A
mul-1-negN/A
associate-*r*N/A
+-commutativeN/A
associate-*r*N/A
mul-1-negN/A
lower-fma.f64N/A
mul-1-negN/A
lower-*.f6495.9
Applied rewrites95.9%
(FPCore (x y z t) :precision binary64 (/ x (- y (* z t))))
double code(double x, double y, double z, double t) {
return x / (y - (z * t));
}
module fmin_fmax_functions
implicit none
private
public fmax
public fmin
interface fmax
module procedure fmax88
module procedure fmax44
module procedure fmax84
module procedure fmax48
end interface
interface fmin
module procedure fmin88
module procedure fmin44
module procedure fmin84
module procedure fmin48
end interface
contains
real(8) function fmax88(x, y) result (res)
real(8), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(x, max(x, y), y /= y), x /= x)
end function
real(4) function fmax44(x, y) result (res)
real(4), intent (in) :: x
real(4), intent (in) :: y
res = merge(y, merge(x, max(x, y), y /= y), x /= x)
end function
real(8) function fmax84(x, y) result(res)
real(8), intent (in) :: x
real(4), intent (in) :: y
res = merge(dble(y), merge(x, max(x, dble(y)), y /= y), x /= x)
end function
real(8) function fmax48(x, y) result(res)
real(4), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(dble(x), max(dble(x), y), y /= y), x /= x)
end function
real(8) function fmin88(x, y) result (res)
real(8), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(x, min(x, y), y /= y), x /= x)
end function
real(4) function fmin44(x, y) result (res)
real(4), intent (in) :: x
real(4), intent (in) :: y
res = merge(y, merge(x, min(x, y), y /= y), x /= x)
end function
real(8) function fmin84(x, y) result(res)
real(8), intent (in) :: x
real(4), intent (in) :: y
res = merge(dble(y), merge(x, min(x, dble(y)), y /= y), x /= x)
end function
real(8) function fmin48(x, y) result(res)
real(4), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(dble(x), min(dble(x), y), y /= y), x /= x)
end function
end module
real(8) function code(x, y, z, t)
use fmin_fmax_functions
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
code = x / (y - (z * t))
end function
public static double code(double x, double y, double z, double t) {
return x / (y - (z * t));
}
def code(x, y, z, t): return x / (y - (z * t))
function code(x, y, z, t) return Float64(x / Float64(y - Float64(z * t))) end
function tmp = code(x, y, z, t) tmp = x / (y - (z * t)); end
code[x_, y_, z_, t_] := N[(x / N[(y - N[(z * t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
\frac{x}{y - z \cdot t}
\end{array}
Initial program 95.9%
(FPCore (x y z t)
:precision binary64
(if (<= x 1.18e-36)
(*
(fma (/ x (* (* y z) t)) -1.0 (* (/ x (pow (* (* z t) -1.0) 2.0)) -1.0))
y)
(fma (/ -1.0 z) (/ x t) (/ (* -1.0 (* y x)) (pow (* t z) 2.0)))))
double code(double x, double y, double z, double t) {
double tmp;
if (x <= 1.18e-36) {
tmp = fma((x / ((y * z) * t)), -1.0, ((x / pow(((z * t) * -1.0), 2.0)) * -1.0)) * y;
} else {
tmp = fma((-1.0 / z), (x / t), ((-1.0 * (y * x)) / pow((t * z), 2.0)));
}
return tmp;
}
function code(x, y, z, t) tmp = 0.0 if (x <= 1.18e-36) tmp = Float64(fma(Float64(x / Float64(Float64(y * z) * t)), -1.0, Float64(Float64(x / (Float64(Float64(z * t) * -1.0) ^ 2.0)) * -1.0)) * y); else tmp = fma(Float64(-1.0 / z), Float64(x / t), Float64(Float64(-1.0 * Float64(y * x)) / (Float64(t * z) ^ 2.0))); end return tmp end
code[x_, y_, z_, t_] := If[LessEqual[x, 1.18e-36], N[(N[(N[(x / N[(N[(y * z), $MachinePrecision] * t), $MachinePrecision]), $MachinePrecision] * -1.0 + N[(N[(x / N[Power[N[(N[(z * t), $MachinePrecision] * -1.0), $MachinePrecision], 2.0], $MachinePrecision]), $MachinePrecision] * -1.0), $MachinePrecision]), $MachinePrecision] * y), $MachinePrecision], N[(N[(-1.0 / z), $MachinePrecision] * N[(x / t), $MachinePrecision] + N[(N[(-1.0 * N[(y * x), $MachinePrecision]), $MachinePrecision] / N[Power[N[(t * z), $MachinePrecision], 2.0], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x \leq 1.18 \cdot 10^{-36}:\\
\;\;\;\;\mathsf{fma}\left(\frac{x}{\left(y \cdot z\right) \cdot t}, -1, \frac{x}{{\left(\left(z \cdot t\right) \cdot -1\right)}^{2}} \cdot -1\right) \cdot y\\
\mathbf{else}:\\
\;\;\;\;\mathsf{fma}\left(\frac{-1}{z}, \frac{x}{t}, \frac{-1 \cdot \left(y \cdot x\right)}{{\left(t \cdot z\right)}^{2}}\right)\\
\end{array}
\end{array}
if x < 1.1799999999999999e-36Initial program 97.1%
Taylor expanded in t around inf
lower-/.f64N/A
+-commutativeN/A
associate-*r/N/A
*-commutativeN/A
times-fracN/A
lower-fma.f64N/A
lower-/.f64N/A
unpow2N/A
lower-*.f64N/A
lower-/.f64N/A
*-commutativeN/A
lower-*.f64N/A
*-commutativeN/A
lower-*.f64N/A
lower-/.f6442.2
Applied rewrites42.2%
Taylor expanded in y around inf
*-commutativeN/A
lower-*.f64N/A
Applied rewrites40.1%
if 1.1799999999999999e-36 < x Initial program 92.9%
Taylor expanded in y around 0
associate-*r/N/A
*-commutativeN/A
times-fracN/A
lower-fma.f64N/A
lower-/.f64N/A
lower-/.f64N/A
associate-*r/N/A
lower-/.f64N/A
lower-*.f64N/A
*-commutativeN/A
lower-*.f64N/A
pow-prod-downN/A
lower-pow.f64N/A
lower-*.f6439.3
Applied rewrites39.3%
(FPCore (x y z t)
:precision binary64
(if (<= y 2.4e-176)
(/ (fma (/ -1.0 (* z z)) (/ (* y x) t) (* (/ x z) -1.0)) t)
(*
(fma (/ x (* (* y z) t)) -1.0 (* (/ x (pow (* (* z t) -1.0) 2.0)) -1.0))
y)))
double code(double x, double y, double z, double t) {
double tmp;
if (y <= 2.4e-176) {
tmp = fma((-1.0 / (z * z)), ((y * x) / t), ((x / z) * -1.0)) / t;
} else {
tmp = fma((x / ((y * z) * t)), -1.0, ((x / pow(((z * t) * -1.0), 2.0)) * -1.0)) * y;
}
return tmp;
}
function code(x, y, z, t) tmp = 0.0 if (y <= 2.4e-176) tmp = Float64(fma(Float64(-1.0 / Float64(z * z)), Float64(Float64(y * x) / t), Float64(Float64(x / z) * -1.0)) / t); else tmp = Float64(fma(Float64(x / Float64(Float64(y * z) * t)), -1.0, Float64(Float64(x / (Float64(Float64(z * t) * -1.0) ^ 2.0)) * -1.0)) * y); end return tmp end
code[x_, y_, z_, t_] := If[LessEqual[y, 2.4e-176], N[(N[(N[(-1.0 / N[(z * z), $MachinePrecision]), $MachinePrecision] * N[(N[(y * x), $MachinePrecision] / t), $MachinePrecision] + N[(N[(x / z), $MachinePrecision] * -1.0), $MachinePrecision]), $MachinePrecision] / t), $MachinePrecision], N[(N[(N[(x / N[(N[(y * z), $MachinePrecision] * t), $MachinePrecision]), $MachinePrecision] * -1.0 + N[(N[(x / N[Power[N[(N[(z * t), $MachinePrecision] * -1.0), $MachinePrecision], 2.0], $MachinePrecision]), $MachinePrecision] * -1.0), $MachinePrecision]), $MachinePrecision] * y), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;y \leq 2.4 \cdot 10^{-176}:\\
\;\;\;\;\frac{\mathsf{fma}\left(\frac{-1}{z \cdot z}, \frac{y \cdot x}{t}, \frac{x}{z} \cdot -1\right)}{t}\\
\mathbf{else}:\\
\;\;\;\;\mathsf{fma}\left(\frac{x}{\left(y \cdot z\right) \cdot t}, -1, \frac{x}{{\left(\left(z \cdot t\right) \cdot -1\right)}^{2}} \cdot -1\right) \cdot y\\
\end{array}
\end{array}
if y < 2.40000000000000006e-176Initial program 95.9%
Taylor expanded in t around inf
lower-/.f64N/A
+-commutativeN/A
associate-*r/N/A
*-commutativeN/A
times-fracN/A
lower-fma.f64N/A
lower-/.f64N/A
unpow2N/A
lower-*.f64N/A
lower-/.f64N/A
*-commutativeN/A
lower-*.f64N/A
*-commutativeN/A
lower-*.f64N/A
lower-/.f6445.4
Applied rewrites45.4%
if 2.40000000000000006e-176 < y Initial program 96.0%
Taylor expanded in t around inf
lower-/.f64N/A
+-commutativeN/A
associate-*r/N/A
*-commutativeN/A
times-fracN/A
lower-fma.f64N/A
lower-/.f64N/A
unpow2N/A
lower-*.f64N/A
lower-/.f64N/A
*-commutativeN/A
lower-*.f64N/A
*-commutativeN/A
lower-*.f64N/A
lower-/.f6433.3
Applied rewrites33.3%
Taylor expanded in y around inf
*-commutativeN/A
lower-*.f64N/A
Applied rewrites34.0%
(FPCore (x y z t)
:precision binary64
(if (<= (* z t) -2e+170)
(/
(-
(fma
(* (/ x (* (* z z) z)) (pow (* (/ y t) -1.0) 2.0))
-1.0
(* (/ x z) -1.0))
(* (/ x (* z z)) (/ y t)))
t)
(if (<= (* z t) 5e+216)
(*
(fma (/ x (* (* y z) t)) -1.0 (* (/ x (pow (* (* z t) -1.0) 2.0)) -1.0))
y)
(/
(-
(fma
(* (pow (* (/ y z) -1.0) 2.0) (/ x (* (* t t) t)))
-1.0
(* (/ x t) -1.0))
(* (/ y (* t t)) (/ x z)))
z))))
double code(double x, double y, double z, double t) {
double tmp;
if ((z * t) <= -2e+170) {
tmp = (fma(((x / ((z * z) * z)) * pow(((y / t) * -1.0), 2.0)), -1.0, ((x / z) * -1.0)) - ((x / (z * z)) * (y / t))) / t;
} else if ((z * t) <= 5e+216) {
tmp = fma((x / ((y * z) * t)), -1.0, ((x / pow(((z * t) * -1.0), 2.0)) * -1.0)) * y;
} else {
tmp = (fma((pow(((y / z) * -1.0), 2.0) * (x / ((t * t) * t))), -1.0, ((x / t) * -1.0)) - ((y / (t * t)) * (x / z))) / z;
}
return tmp;
}
function code(x, y, z, t) tmp = 0.0 if (Float64(z * t) <= -2e+170) tmp = Float64(Float64(fma(Float64(Float64(x / Float64(Float64(z * z) * z)) * (Float64(Float64(y / t) * -1.0) ^ 2.0)), -1.0, Float64(Float64(x / z) * -1.0)) - Float64(Float64(x / Float64(z * z)) * Float64(y / t))) / t); elseif (Float64(z * t) <= 5e+216) tmp = Float64(fma(Float64(x / Float64(Float64(y * z) * t)), -1.0, Float64(Float64(x / (Float64(Float64(z * t) * -1.0) ^ 2.0)) * -1.0)) * y); else tmp = Float64(Float64(fma(Float64((Float64(Float64(y / z) * -1.0) ^ 2.0) * Float64(x / Float64(Float64(t * t) * t))), -1.0, Float64(Float64(x / t) * -1.0)) - Float64(Float64(y / Float64(t * t)) * Float64(x / z))) / z); end return tmp end
code[x_, y_, z_, t_] := If[LessEqual[N[(z * t), $MachinePrecision], -2e+170], N[(N[(N[(N[(N[(x / N[(N[(z * z), $MachinePrecision] * z), $MachinePrecision]), $MachinePrecision] * N[Power[N[(N[(y / t), $MachinePrecision] * -1.0), $MachinePrecision], 2.0], $MachinePrecision]), $MachinePrecision] * -1.0 + N[(N[(x / z), $MachinePrecision] * -1.0), $MachinePrecision]), $MachinePrecision] - N[(N[(x / N[(z * z), $MachinePrecision]), $MachinePrecision] * N[(y / t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / t), $MachinePrecision], If[LessEqual[N[(z * t), $MachinePrecision], 5e+216], N[(N[(N[(x / N[(N[(y * z), $MachinePrecision] * t), $MachinePrecision]), $MachinePrecision] * -1.0 + N[(N[(x / N[Power[N[(N[(z * t), $MachinePrecision] * -1.0), $MachinePrecision], 2.0], $MachinePrecision]), $MachinePrecision] * -1.0), $MachinePrecision]), $MachinePrecision] * y), $MachinePrecision], N[(N[(N[(N[(N[Power[N[(N[(y / z), $MachinePrecision] * -1.0), $MachinePrecision], 2.0], $MachinePrecision] * N[(x / N[(N[(t * t), $MachinePrecision] * t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * -1.0 + N[(N[(x / t), $MachinePrecision] * -1.0), $MachinePrecision]), $MachinePrecision] - N[(N[(y / N[(t * t), $MachinePrecision]), $MachinePrecision] * N[(x / z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / z), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \cdot t \leq -2 \cdot 10^{+170}:\\
\;\;\;\;\frac{\mathsf{fma}\left(\frac{x}{\left(z \cdot z\right) \cdot z} \cdot {\left(\frac{y}{t} \cdot -1\right)}^{2}, -1, \frac{x}{z} \cdot -1\right) - \frac{x}{z \cdot z} \cdot \frac{y}{t}}{t}\\
\mathbf{elif}\;z \cdot t \leq 5 \cdot 10^{+216}:\\
\;\;\;\;\mathsf{fma}\left(\frac{x}{\left(y \cdot z\right) \cdot t}, -1, \frac{x}{{\left(\left(z \cdot t\right) \cdot -1\right)}^{2}} \cdot -1\right) \cdot y\\
\mathbf{else}:\\
\;\;\;\;\frac{\mathsf{fma}\left({\left(\frac{y}{z} \cdot -1\right)}^{2} \cdot \frac{x}{\left(t \cdot t\right) \cdot t}, -1, \frac{x}{t} \cdot -1\right) - \frac{y}{t \cdot t} \cdot \frac{x}{z}}{z}\\
\end{array}
\end{array}
if (*.f64 z t) < -2.00000000000000007e170Initial program 84.7%
Taylor expanded in t around inf
Applied rewrites88.7%
if -2.00000000000000007e170 < (*.f64 z t) < 4.9999999999999998e216Initial program 99.9%
Taylor expanded in t around inf
lower-/.f64N/A
+-commutativeN/A
associate-*r/N/A
*-commutativeN/A
times-fracN/A
lower-fma.f64N/A
lower-/.f64N/A
unpow2N/A
lower-*.f64N/A
lower-/.f64N/A
*-commutativeN/A
lower-*.f64N/A
*-commutativeN/A
lower-*.f64N/A
lower-/.f6427.0
Applied rewrites27.0%
Taylor expanded in y around inf
*-commutativeN/A
lower-*.f64N/A
Applied rewrites24.8%
if 4.9999999999999998e216 < (*.f64 z t) Initial program 80.9%
Taylor expanded in z around inf
Applied rewrites93.5%
(FPCore (x y z t)
:precision binary64
(if (<= (* z t) -2e+170)
(/
(-
(fma
(* (/ x (* (* z z) z)) (pow (* (/ y t) -1.0) 2.0))
-1.0
(* (/ x z) -1.0))
(* (/ x (* z z)) (/ y t)))
t)
(*
(fma (/ x (* (* y z) t)) -1.0 (* (/ x (pow (* (* z t) -1.0) 2.0)) -1.0))
y)))
double code(double x, double y, double z, double t) {
double tmp;
if ((z * t) <= -2e+170) {
tmp = (fma(((x / ((z * z) * z)) * pow(((y / t) * -1.0), 2.0)), -1.0, ((x / z) * -1.0)) - ((x / (z * z)) * (y / t))) / t;
} else {
tmp = fma((x / ((y * z) * t)), -1.0, ((x / pow(((z * t) * -1.0), 2.0)) * -1.0)) * y;
}
return tmp;
}
function code(x, y, z, t) tmp = 0.0 if (Float64(z * t) <= -2e+170) tmp = Float64(Float64(fma(Float64(Float64(x / Float64(Float64(z * z) * z)) * (Float64(Float64(y / t) * -1.0) ^ 2.0)), -1.0, Float64(Float64(x / z) * -1.0)) - Float64(Float64(x / Float64(z * z)) * Float64(y / t))) / t); else tmp = Float64(fma(Float64(x / Float64(Float64(y * z) * t)), -1.0, Float64(Float64(x / (Float64(Float64(z * t) * -1.0) ^ 2.0)) * -1.0)) * y); end return tmp end
code[x_, y_, z_, t_] := If[LessEqual[N[(z * t), $MachinePrecision], -2e+170], N[(N[(N[(N[(N[(x / N[(N[(z * z), $MachinePrecision] * z), $MachinePrecision]), $MachinePrecision] * N[Power[N[(N[(y / t), $MachinePrecision] * -1.0), $MachinePrecision], 2.0], $MachinePrecision]), $MachinePrecision] * -1.0 + N[(N[(x / z), $MachinePrecision] * -1.0), $MachinePrecision]), $MachinePrecision] - N[(N[(x / N[(z * z), $MachinePrecision]), $MachinePrecision] * N[(y / t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / t), $MachinePrecision], N[(N[(N[(x / N[(N[(y * z), $MachinePrecision] * t), $MachinePrecision]), $MachinePrecision] * -1.0 + N[(N[(x / N[Power[N[(N[(z * t), $MachinePrecision] * -1.0), $MachinePrecision], 2.0], $MachinePrecision]), $MachinePrecision] * -1.0), $MachinePrecision]), $MachinePrecision] * y), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \cdot t \leq -2 \cdot 10^{+170}:\\
\;\;\;\;\frac{\mathsf{fma}\left(\frac{x}{\left(z \cdot z\right) \cdot z} \cdot {\left(\frac{y}{t} \cdot -1\right)}^{2}, -1, \frac{x}{z} \cdot -1\right) - \frac{x}{z \cdot z} \cdot \frac{y}{t}}{t}\\
\mathbf{else}:\\
\;\;\;\;\mathsf{fma}\left(\frac{x}{\left(y \cdot z\right) \cdot t}, -1, \frac{x}{{\left(\left(z \cdot t\right) \cdot -1\right)}^{2}} \cdot -1\right) \cdot y\\
\end{array}
\end{array}
if (*.f64 z t) < -2.00000000000000007e170Initial program 84.7%
Taylor expanded in t around inf
Applied rewrites88.7%
if -2.00000000000000007e170 < (*.f64 z t) Initial program 97.5%
Taylor expanded in t around inf
lower-/.f64N/A
+-commutativeN/A
associate-*r/N/A
*-commutativeN/A
times-fracN/A
lower-fma.f64N/A
lower-/.f64N/A
unpow2N/A
lower-*.f64N/A
lower-/.f64N/A
*-commutativeN/A
lower-*.f64N/A
*-commutativeN/A
lower-*.f64N/A
lower-/.f6434.5
Applied rewrites34.5%
Taylor expanded in y around inf
*-commutativeN/A
lower-*.f64N/A
Applied rewrites31.4%
(FPCore (x y z t) :precision binary64 (* (fma (/ x (* (* y z) t)) -1.0 (* (/ x (pow (* (* z t) -1.0) 2.0)) -1.0)) y))
double code(double x, double y, double z, double t) {
return fma((x / ((y * z) * t)), -1.0, ((x / pow(((z * t) * -1.0), 2.0)) * -1.0)) * y;
}
function code(x, y, z, t) return Float64(fma(Float64(x / Float64(Float64(y * z) * t)), -1.0, Float64(Float64(x / (Float64(Float64(z * t) * -1.0) ^ 2.0)) * -1.0)) * y) end
code[x_, y_, z_, t_] := N[(N[(N[(x / N[(N[(y * z), $MachinePrecision] * t), $MachinePrecision]), $MachinePrecision] * -1.0 + N[(N[(x / N[Power[N[(N[(z * t), $MachinePrecision] * -1.0), $MachinePrecision], 2.0], $MachinePrecision]), $MachinePrecision] * -1.0), $MachinePrecision]), $MachinePrecision] * y), $MachinePrecision]
\begin{array}{l}
\\
\mathsf{fma}\left(\frac{x}{\left(y \cdot z\right) \cdot t}, -1, \frac{x}{{\left(\left(z \cdot t\right) \cdot -1\right)}^{2}} \cdot -1\right) \cdot y
\end{array}
Initial program 95.9%
Taylor expanded in t around inf
lower-/.f64N/A
+-commutativeN/A
associate-*r/N/A
*-commutativeN/A
times-fracN/A
lower-fma.f64N/A
lower-/.f64N/A
unpow2N/A
lower-*.f64N/A
lower-/.f64N/A
*-commutativeN/A
lower-*.f64N/A
*-commutativeN/A
lower-*.f64N/A
lower-/.f6440.7
Applied rewrites40.7%
Taylor expanded in y around inf
*-commutativeN/A
lower-*.f64N/A
Applied rewrites37.3%
herbie shell --seed 2025093
(FPCore (x y z t)
:name "Diagrams.Solve.Tridiagonal:solveTriDiagonal from diagrams-solve-0.1, B"
:precision binary64
(/ x (- y (* z t))))