
(FPCore (x y z) :precision binary64 (/ (+ x y) (- 1.0 (/ y z))))
double code(double x, double y, double z) {
return (x + y) / (1.0 - (y / z));
}
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)
use fmin_fmax_functions
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
code = (x + y) / (1.0d0 - (y / z))
end function
public static double code(double x, double y, double z) {
return (x + y) / (1.0 - (y / z));
}
def code(x, y, z): return (x + y) / (1.0 - (y / z))
function code(x, y, z) return Float64(Float64(x + y) / Float64(1.0 - Float64(y / z))) end
function tmp = code(x, y, z) tmp = (x + y) / (1.0 - (y / z)); end
code[x_, y_, z_] := N[(N[(x + y), $MachinePrecision] / N[(1.0 - N[(y / z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
\frac{x + y}{1 - \frac{y}{z}}
\end{array}
Sampling outcomes in binary64 precision:
Herbie found 6 alternatives:
| Alternative | Accuracy | Speedup |
|---|
(FPCore (x y z) :precision binary64 (/ (+ x y) (- 1.0 (/ y z))))
double code(double x, double y, double z) {
return (x + y) / (1.0 - (y / z));
}
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)
use fmin_fmax_functions
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
code = (x + y) / (1.0d0 - (y / z))
end function
public static double code(double x, double y, double z) {
return (x + y) / (1.0 - (y / z));
}
def code(x, y, z): return (x + y) / (1.0 - (y / z))
function code(x, y, z) return Float64(Float64(x + y) / Float64(1.0 - Float64(y / z))) end
function tmp = code(x, y, z) tmp = (x + y) / (1.0 - (y / z)); end
code[x_, y_, z_] := N[(N[(x + y), $MachinePrecision] / N[(1.0 - N[(y / z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
\frac{x + y}{1 - \frac{y}{z}}
\end{array}
(FPCore (x y z)
:precision binary64
(let* ((t_0 (/ (+ x y) (- 1.0 (/ y z)))))
(if (or (<= t_0 -5e-294) (not (<= t_0 0.0)))
t_0
(fma
(/ (+ (fma z (/ (fma z x (* z z)) y) (* z x)) (* z z)) y)
-1.0
(- z)))))
double code(double x, double y, double z) {
double t_0 = (x + y) / (1.0 - (y / z));
double tmp;
if ((t_0 <= -5e-294) || !(t_0 <= 0.0)) {
tmp = t_0;
} else {
tmp = fma(((fma(z, (fma(z, x, (z * z)) / y), (z * x)) + (z * z)) / y), -1.0, -z);
}
return tmp;
}
function code(x, y, z) t_0 = Float64(Float64(x + y) / Float64(1.0 - Float64(y / z))) tmp = 0.0 if ((t_0 <= -5e-294) || !(t_0 <= 0.0)) tmp = t_0; else tmp = fma(Float64(Float64(fma(z, Float64(fma(z, x, Float64(z * z)) / y), Float64(z * x)) + Float64(z * z)) / y), -1.0, Float64(-z)); end return tmp end
code[x_, y_, z_] := Block[{t$95$0 = N[(N[(x + y), $MachinePrecision] / N[(1.0 - N[(y / z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, If[Or[LessEqual[t$95$0, -5e-294], N[Not[LessEqual[t$95$0, 0.0]], $MachinePrecision]], t$95$0, N[(N[(N[(N[(z * N[(N[(z * x + N[(z * z), $MachinePrecision]), $MachinePrecision] / y), $MachinePrecision] + N[(z * x), $MachinePrecision]), $MachinePrecision] + N[(z * z), $MachinePrecision]), $MachinePrecision] / y), $MachinePrecision] * -1.0 + (-z)), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := \frac{x + y}{1 - \frac{y}{z}}\\
\mathbf{if}\;t\_0 \leq -5 \cdot 10^{-294} \lor \neg \left(t\_0 \leq 0\right):\\
\;\;\;\;t\_0\\
\mathbf{else}:\\
\;\;\;\;\mathsf{fma}\left(\frac{\mathsf{fma}\left(z, \frac{\mathsf{fma}\left(z, x, z \cdot z\right)}{y}, z \cdot x\right) + z \cdot z}{y}, -1, -z\right)\\
\end{array}
\end{array}
if (/.f64 (+.f64 x y) (-.f64 #s(literal 1 binary64) (/.f64 y z))) < -5.0000000000000003e-294 or -0.0 < (/.f64 (+.f64 x y) (-.f64 #s(literal 1 binary64) (/.f64 y z))) Initial program 99.8%
if -5.0000000000000003e-294 < (/.f64 (+.f64 x y) (-.f64 #s(literal 1 binary64) (/.f64 y z))) < -0.0Initial program 5.9%
Taylor expanded in y around -inf
+-commutativeN/A
*-commutativeN/A
lower-fma.f64N/A
Applied rewrites100.0%
Final simplification99.9%
(FPCore (x y z)
:precision binary64
(let* ((t_0 (/ (+ x y) (- 1.0 (/ y z)))))
(if (or (<= t_0 -5e-294) (not (<= t_0 4e-298)))
(/ (+ x y) (* (- (pow y -1.0) (pow z -1.0)) y))
(fma
(/ (+ (fma z (/ (fma z x (* z z)) y) (* z x)) (* z z)) y)
-1.0
(- z)))))
double code(double x, double y, double z) {
double t_0 = (x + y) / (1.0 - (y / z));
double tmp;
if ((t_0 <= -5e-294) || !(t_0 <= 4e-298)) {
tmp = (x + y) / ((pow(y, -1.0) - pow(z, -1.0)) * y);
} else {
tmp = fma(((fma(z, (fma(z, x, (z * z)) / y), (z * x)) + (z * z)) / y), -1.0, -z);
}
return tmp;
}
function code(x, y, z) t_0 = Float64(Float64(x + y) / Float64(1.0 - Float64(y / z))) tmp = 0.0 if ((t_0 <= -5e-294) || !(t_0 <= 4e-298)) tmp = Float64(Float64(x + y) / Float64(Float64((y ^ -1.0) - (z ^ -1.0)) * y)); else tmp = fma(Float64(Float64(fma(z, Float64(fma(z, x, Float64(z * z)) / y), Float64(z * x)) + Float64(z * z)) / y), -1.0, Float64(-z)); end return tmp end
code[x_, y_, z_] := Block[{t$95$0 = N[(N[(x + y), $MachinePrecision] / N[(1.0 - N[(y / z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, If[Or[LessEqual[t$95$0, -5e-294], N[Not[LessEqual[t$95$0, 4e-298]], $MachinePrecision]], N[(N[(x + y), $MachinePrecision] / N[(N[(N[Power[y, -1.0], $MachinePrecision] - N[Power[z, -1.0], $MachinePrecision]), $MachinePrecision] * y), $MachinePrecision]), $MachinePrecision], N[(N[(N[(N[(z * N[(N[(z * x + N[(z * z), $MachinePrecision]), $MachinePrecision] / y), $MachinePrecision] + N[(z * x), $MachinePrecision]), $MachinePrecision] + N[(z * z), $MachinePrecision]), $MachinePrecision] / y), $MachinePrecision] * -1.0 + (-z)), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := \frac{x + y}{1 - \frac{y}{z}}\\
\mathbf{if}\;t\_0 \leq -5 \cdot 10^{-294} \lor \neg \left(t\_0 \leq 4 \cdot 10^{-298}\right):\\
\;\;\;\;\frac{x + y}{\left({y}^{-1} - {z}^{-1}\right) \cdot y}\\
\mathbf{else}:\\
\;\;\;\;\mathsf{fma}\left(\frac{\mathsf{fma}\left(z, \frac{\mathsf{fma}\left(z, x, z \cdot z\right)}{y}, z \cdot x\right) + z \cdot z}{y}, -1, -z\right)\\
\end{array}
\end{array}
if (/.f64 (+.f64 x y) (-.f64 #s(literal 1 binary64) (/.f64 y z))) < -5.0000000000000003e-294 or 3.99999999999999965e-298 < (/.f64 (+.f64 x y) (-.f64 #s(literal 1 binary64) (/.f64 y z))) Initial program 99.8%
Taylor expanded in y around inf
*-commutativeN/A
lower-*.f64N/A
lower--.f64N/A
inv-powN/A
lower-pow.f64N/A
inv-powN/A
lower-pow.f6499.6
Applied rewrites99.6%
if -5.0000000000000003e-294 < (/.f64 (+.f64 x y) (-.f64 #s(literal 1 binary64) (/.f64 y z))) < 3.99999999999999965e-298Initial program 11.1%
Taylor expanded in y around -inf
+-commutativeN/A
*-commutativeN/A
lower-fma.f64N/A
Applied rewrites100.0%
Final simplification99.7%
(FPCore (x y z)
:precision binary64
(if (<= z -5.2e+20)
(+ (fma y (/ (+ y x) z) y) x)
(if (<= z 4.5e-104)
(fma (/ (+ (fma z (/ (fma z x (* z z)) y) (* z x)) (* z z)) y) -1.0 (- z))
(/ (+ x y) (* (- (pow y -1.0) (* (pow z -0.5) (pow z -0.5))) y)))))
double code(double x, double y, double z) {
double tmp;
if (z <= -5.2e+20) {
tmp = fma(y, ((y + x) / z), y) + x;
} else if (z <= 4.5e-104) {
tmp = fma(((fma(z, (fma(z, x, (z * z)) / y), (z * x)) + (z * z)) / y), -1.0, -z);
} else {
tmp = (x + y) / ((pow(y, -1.0) - (pow(z, -0.5) * pow(z, -0.5))) * y);
}
return tmp;
}
function code(x, y, z) tmp = 0.0 if (z <= -5.2e+20) tmp = Float64(fma(y, Float64(Float64(y + x) / z), y) + x); elseif (z <= 4.5e-104) tmp = fma(Float64(Float64(fma(z, Float64(fma(z, x, Float64(z * z)) / y), Float64(z * x)) + Float64(z * z)) / y), -1.0, Float64(-z)); else tmp = Float64(Float64(x + y) / Float64(Float64((y ^ -1.0) - Float64((z ^ -0.5) * (z ^ -0.5))) * y)); end return tmp end
code[x_, y_, z_] := If[LessEqual[z, -5.2e+20], N[(N[(y * N[(N[(y + x), $MachinePrecision] / z), $MachinePrecision] + y), $MachinePrecision] + x), $MachinePrecision], If[LessEqual[z, 4.5e-104], N[(N[(N[(N[(z * N[(N[(z * x + N[(z * z), $MachinePrecision]), $MachinePrecision] / y), $MachinePrecision] + N[(z * x), $MachinePrecision]), $MachinePrecision] + N[(z * z), $MachinePrecision]), $MachinePrecision] / y), $MachinePrecision] * -1.0 + (-z)), $MachinePrecision], N[(N[(x + y), $MachinePrecision] / N[(N[(N[Power[y, -1.0], $MachinePrecision] - N[(N[Power[z, -0.5], $MachinePrecision] * N[Power[z, -0.5], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * y), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \leq -5.2 \cdot 10^{+20}:\\
\;\;\;\;\mathsf{fma}\left(y, \frac{y + x}{z}, y\right) + x\\
\mathbf{elif}\;z \leq 4.5 \cdot 10^{-104}:\\
\;\;\;\;\mathsf{fma}\left(\frac{\mathsf{fma}\left(z, \frac{\mathsf{fma}\left(z, x, z \cdot z\right)}{y}, z \cdot x\right) + z \cdot z}{y}, -1, -z\right)\\
\mathbf{else}:\\
\;\;\;\;\frac{x + y}{\left({y}^{-1} - {z}^{-0.5} \cdot {z}^{-0.5}\right) \cdot y}\\
\end{array}
\end{array}
if z < -5.2e20Initial program 100.0%
Taylor expanded in z around inf
+-commutativeN/A
lower-+.f64N/A
+-commutativeN/A
associate-/l*N/A
lower-fma.f64N/A
lower-/.f64N/A
+-commutativeN/A
lower-+.f6479.9
Applied rewrites79.9%
if -5.2e20 < z < 4.4999999999999997e-104Initial program 69.7%
Taylor expanded in y around -inf
+-commutativeN/A
*-commutativeN/A
lower-fma.f64N/A
Applied rewrites80.4%
if 4.4999999999999997e-104 < z Initial program 97.8%
Taylor expanded in y around inf
*-commutativeN/A
lower-*.f64N/A
lower--.f64N/A
inv-powN/A
lower-pow.f64N/A
inv-powN/A
lower-pow.f6497.6
Applied rewrites97.6%
lift-pow.f64N/A
sqr-powN/A
lower-*.f64N/A
lower-pow.f64N/A
metadata-evalN/A
lower-pow.f64N/A
metadata-eval97.6
Applied rewrites97.6%
Final simplification86.5%
(FPCore (x y z) :precision binary64 (if (or (<= z -5.2e+20) (not (<= z 1.8e+26))) (+ (fma y (/ (+ y x) z) y) x) (fma (/ (+ (fma z (/ (fma z x (* z z)) y) (* z x)) (* z z)) y) -1.0 (- z))))
double code(double x, double y, double z) {
double tmp;
if ((z <= -5.2e+20) || !(z <= 1.8e+26)) {
tmp = fma(y, ((y + x) / z), y) + x;
} else {
tmp = fma(((fma(z, (fma(z, x, (z * z)) / y), (z * x)) + (z * z)) / y), -1.0, -z);
}
return tmp;
}
function code(x, y, z) tmp = 0.0 if ((z <= -5.2e+20) || !(z <= 1.8e+26)) tmp = Float64(fma(y, Float64(Float64(y + x) / z), y) + x); else tmp = fma(Float64(Float64(fma(z, Float64(fma(z, x, Float64(z * z)) / y), Float64(z * x)) + Float64(z * z)) / y), -1.0, Float64(-z)); end return tmp end
code[x_, y_, z_] := If[Or[LessEqual[z, -5.2e+20], N[Not[LessEqual[z, 1.8e+26]], $MachinePrecision]], N[(N[(y * N[(N[(y + x), $MachinePrecision] / z), $MachinePrecision] + y), $MachinePrecision] + x), $MachinePrecision], N[(N[(N[(N[(z * N[(N[(z * x + N[(z * z), $MachinePrecision]), $MachinePrecision] / y), $MachinePrecision] + N[(z * x), $MachinePrecision]), $MachinePrecision] + N[(z * z), $MachinePrecision]), $MachinePrecision] / y), $MachinePrecision] * -1.0 + (-z)), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \leq -5.2 \cdot 10^{+20} \lor \neg \left(z \leq 1.8 \cdot 10^{+26}\right):\\
\;\;\;\;\mathsf{fma}\left(y, \frac{y + x}{z}, y\right) + x\\
\mathbf{else}:\\
\;\;\;\;\mathsf{fma}\left(\frac{\mathsf{fma}\left(z, \frac{\mathsf{fma}\left(z, x, z \cdot z\right)}{y}, z \cdot x\right) + z \cdot z}{y}, -1, -z\right)\\
\end{array}
\end{array}
if z < -5.2e20 or 1.80000000000000012e26 < z Initial program 99.9%
Taylor expanded in z around inf
+-commutativeN/A
lower-+.f64N/A
+-commutativeN/A
associate-/l*N/A
lower-fma.f64N/A
lower-/.f64N/A
+-commutativeN/A
lower-+.f6482.7
Applied rewrites82.7%
if -5.2e20 < z < 1.80000000000000012e26Initial program 73.3%
Taylor expanded in y around -inf
+-commutativeN/A
*-commutativeN/A
lower-fma.f64N/A
Applied rewrites78.1%
Final simplification80.5%
(FPCore (x y z)
:precision binary64
(if (or (<= z -5.2e+20) (not (<= z 2900000000.0)))
(+ (fma y (/ (+ y x) z) y) x)
(*
(fma
(-
(- (* (- z) (+ (/ x (pow y 3.0)) (pow y -2.0))) (pow y -1.0))
(/ x (* y y)))
z
(/ (+ y x) (- y)))
z)))
double code(double x, double y, double z) {
double tmp;
if ((z <= -5.2e+20) || !(z <= 2900000000.0)) {
tmp = fma(y, ((y + x) / z), y) + x;
} else {
tmp = fma((((-z * ((x / pow(y, 3.0)) + pow(y, -2.0))) - pow(y, -1.0)) - (x / (y * y))), z, ((y + x) / -y)) * z;
}
return tmp;
}
function code(x, y, z) tmp = 0.0 if ((z <= -5.2e+20) || !(z <= 2900000000.0)) tmp = Float64(fma(y, Float64(Float64(y + x) / z), y) + x); else tmp = Float64(fma(Float64(Float64(Float64(Float64(-z) * Float64(Float64(x / (y ^ 3.0)) + (y ^ -2.0))) - (y ^ -1.0)) - Float64(x / Float64(y * y))), z, Float64(Float64(y + x) / Float64(-y))) * z); end return tmp end
code[x_, y_, z_] := If[Or[LessEqual[z, -5.2e+20], N[Not[LessEqual[z, 2900000000.0]], $MachinePrecision]], N[(N[(y * N[(N[(y + x), $MachinePrecision] / z), $MachinePrecision] + y), $MachinePrecision] + x), $MachinePrecision], N[(N[(N[(N[(N[((-z) * N[(N[(x / N[Power[y, 3.0], $MachinePrecision]), $MachinePrecision] + N[Power[y, -2.0], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] - N[Power[y, -1.0], $MachinePrecision]), $MachinePrecision] - N[(x / N[(y * y), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * z + N[(N[(y + x), $MachinePrecision] / (-y)), $MachinePrecision]), $MachinePrecision] * z), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \leq -5.2 \cdot 10^{+20} \lor \neg \left(z \leq 2900000000\right):\\
\;\;\;\;\mathsf{fma}\left(y, \frac{y + x}{z}, y\right) + x\\
\mathbf{else}:\\
\;\;\;\;\mathsf{fma}\left(\left(\left(-z\right) \cdot \left(\frac{x}{{y}^{3}} + {y}^{-2}\right) - {y}^{-1}\right) - \frac{x}{y \cdot y}, z, \frac{y + x}{-y}\right) \cdot z\\
\end{array}
\end{array}
if z < -5.2e20 or 2.9e9 < z Initial program 99.9%
Taylor expanded in z around inf
+-commutativeN/A
lower-+.f64N/A
+-commutativeN/A
associate-/l*N/A
lower-fma.f64N/A
lower-/.f64N/A
+-commutativeN/A
lower-+.f6481.7
Applied rewrites81.7%
if -5.2e20 < z < 2.9e9Initial program 72.4%
Taylor expanded in z around 0
*-commutativeN/A
lower-*.f64N/A
Applied rewrites71.9%
Final simplification77.2%
(FPCore (x y z)
:precision binary64
(*
(fma
(-
(- (* (- z) (+ (/ x (pow y 3.0)) (pow y -2.0))) (pow y -1.0))
(/ x (* y y)))
z
(/ (+ y x) (- y)))
z))
double code(double x, double y, double z) {
return fma((((-z * ((x / pow(y, 3.0)) + pow(y, -2.0))) - pow(y, -1.0)) - (x / (y * y))), z, ((y + x) / -y)) * z;
}
function code(x, y, z) return Float64(fma(Float64(Float64(Float64(Float64(-z) * Float64(Float64(x / (y ^ 3.0)) + (y ^ -2.0))) - (y ^ -1.0)) - Float64(x / Float64(y * y))), z, Float64(Float64(y + x) / Float64(-y))) * z) end
code[x_, y_, z_] := N[(N[(N[(N[(N[((-z) * N[(N[(x / N[Power[y, 3.0], $MachinePrecision]), $MachinePrecision] + N[Power[y, -2.0], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] - N[Power[y, -1.0], $MachinePrecision]), $MachinePrecision] - N[(x / N[(y * y), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * z + N[(N[(y + x), $MachinePrecision] / (-y)), $MachinePrecision]), $MachinePrecision] * z), $MachinePrecision]
\begin{array}{l}
\\
\mathsf{fma}\left(\left(\left(-z\right) \cdot \left(\frac{x}{{y}^{3}} + {y}^{-2}\right) - {y}^{-1}\right) - \frac{x}{y \cdot y}, z, \frac{y + x}{-y}\right) \cdot z
\end{array}
Initial program 87.4%
Taylor expanded in z around 0
*-commutativeN/A
lower-*.f64N/A
Applied rewrites42.7%
Final simplification42.7%
herbie shell --seed 2025057
(FPCore (x y z)
:name "Graphics.Rendering.Chart.Backend.Diagrams:calcFontMetrics from Chart-diagrams-1.5.1, A"
:precision binary64
:alt
(! :herbie-platform default (if (< y -3742931076268985600000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000) (* (/ (+ y x) (- y)) z) (if (< y 3553466245608673400000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000) (/ (+ x y) (- 1 (/ y z))) (* (/ (+ y x) (- y)) z))))
(/ (+ x y) (- 1.0 (/ y z))))