Diagrams.Solve.Tridiagonal:solveCyclicTriDiagonal from diagrams-solve-0.1, A

Percentage Accurate: 92.2% → 96.9%
Time: 2.9s
Alternatives: 4
Speedup: 0.5×

Specification

?
\[\begin{array}{l} \\ \frac{x \cdot y}{z} \end{array} \]
(FPCore (x y z) :precision binary64 (/ (* x y) z))
double code(double x, double y, double z) {
	return (x * y) / z;
}
real(8) function code(x, y, z)
    real(8), intent (in) :: x
    real(8), intent (in) :: y
    real(8), intent (in) :: z
    code = (x * y) / z
end function
public static double code(double x, double y, double z) {
	return (x * y) / z;
}
def code(x, y, z):
	return (x * y) / z
function code(x, y, z)
	return Float64(Float64(x * y) / z)
end
function tmp = code(x, y, z)
	tmp = (x * y) / z;
end
code[x_, y_, z_] := N[(N[(x * y), $MachinePrecision] / z), $MachinePrecision]
\begin{array}{l}

\\
\frac{x \cdot y}{z}
\end{array}

Sampling outcomes in binary64 precision:

Local Percentage Accuracy vs ?

The average percentage accuracy by input value. Horizontal axis shows value of an input variable; the variable is choosen in the title. Vertical axis is accuracy; higher is better. Red represent the original program, while blue represents Herbie's suggestion. These can be toggled with buttons below the plot. The line is an average while dots represent individual samples.

Accuracy vs Speed?

Herbie found 4 alternatives:

AlternativeAccuracySpeedup
The accuracy (vertical axis) and speed (horizontal axis) of each alternatives. Up and to the right is better. The red square shows the initial program, and each blue circle shows an alternative.The line shows the best available speed-accuracy tradeoffs.

Initial Program: 92.2% accurate, 1.0× speedup?

\[\begin{array}{l} \\ \frac{x \cdot y}{z} \end{array} \]
(FPCore (x y z) :precision binary64 (/ (* x y) z))
double code(double x, double y, double z) {
	return (x * y) / z;
}
real(8) function code(x, y, z)
    real(8), intent (in) :: x
    real(8), intent (in) :: y
    real(8), intent (in) :: z
    code = (x * y) / z
end function
public static double code(double x, double y, double z) {
	return (x * y) / z;
}
def code(x, y, z):
	return (x * y) / z
function code(x, y, z)
	return Float64(Float64(x * y) / z)
end
function tmp = code(x, y, z)
	tmp = (x * y) / z;
end
code[x_, y_, z_] := N[(N[(x * y), $MachinePrecision] / z), $MachinePrecision]
\begin{array}{l}

\\
\frac{x \cdot y}{z}
\end{array}

Alternative 1: 96.9% accurate, 0.2× speedup?

\[\begin{array}{l} [x, y] = \mathsf{sort}([x, y])\\ \\ \begin{array}{l} t_0 := \frac{x \cdot y}{z}\\ \mathbf{if}\;t_0 \leq -4 \cdot 10^{-257}:\\ \;\;\;\;t_0\\ \mathbf{elif}\;t_0 \leq 0:\\ \;\;\;\;y \cdot \frac{x}{z}\\ \mathbf{elif}\;t_0 \leq 5 \cdot 10^{+293}:\\ \;\;\;\;t_0\\ \mathbf{else}:\\ \;\;\;\;x \cdot \frac{y}{z}\\ \end{array} \end{array} \]
NOTE: x and y should be sorted in increasing order before calling this function.
(FPCore (x y z)
 :precision binary64
 (let* ((t_0 (/ (* x y) z)))
   (if (<= t_0 -4e-257)
     t_0
     (if (<= t_0 0.0) (* y (/ x z)) (if (<= t_0 5e+293) t_0 (* x (/ y z)))))))
assert(x < y);
double code(double x, double y, double z) {
	double t_0 = (x * y) / z;
	double tmp;
	if (t_0 <= -4e-257) {
		tmp = t_0;
	} else if (t_0 <= 0.0) {
		tmp = y * (x / z);
	} else if (t_0 <= 5e+293) {
		tmp = t_0;
	} else {
		tmp = x * (y / z);
	}
	return tmp;
}
NOTE: x and y should be sorted in increasing order before calling this function.
real(8) function code(x, y, z)
    real(8), intent (in) :: x
    real(8), intent (in) :: y
    real(8), intent (in) :: z
    real(8) :: t_0
    real(8) :: tmp
    t_0 = (x * y) / z
    if (t_0 <= (-4d-257)) then
        tmp = t_0
    else if (t_0 <= 0.0d0) then
        tmp = y * (x / z)
    else if (t_0 <= 5d+293) then
        tmp = t_0
    else
        tmp = x * (y / z)
    end if
    code = tmp
end function
assert x < y;
public static double code(double x, double y, double z) {
	double t_0 = (x * y) / z;
	double tmp;
	if (t_0 <= -4e-257) {
		tmp = t_0;
	} else if (t_0 <= 0.0) {
		tmp = y * (x / z);
	} else if (t_0 <= 5e+293) {
		tmp = t_0;
	} else {
		tmp = x * (y / z);
	}
	return tmp;
}
[x, y] = sort([x, y])
def code(x, y, z):
	t_0 = (x * y) / z
	tmp = 0
	if t_0 <= -4e-257:
		tmp = t_0
	elif t_0 <= 0.0:
		tmp = y * (x / z)
	elif t_0 <= 5e+293:
		tmp = t_0
	else:
		tmp = x * (y / z)
	return tmp
x, y = sort([x, y])
function code(x, y, z)
	t_0 = Float64(Float64(x * y) / z)
	tmp = 0.0
	if (t_0 <= -4e-257)
		tmp = t_0;
	elseif (t_0 <= 0.0)
		tmp = Float64(y * Float64(x / z));
	elseif (t_0 <= 5e+293)
		tmp = t_0;
	else
		tmp = Float64(x * Float64(y / z));
	end
	return tmp
end
x, y = num2cell(sort([x, y])){:}
function tmp_2 = code(x, y, z)
	t_0 = (x * y) / z;
	tmp = 0.0;
	if (t_0 <= -4e-257)
		tmp = t_0;
	elseif (t_0 <= 0.0)
		tmp = y * (x / z);
	elseif (t_0 <= 5e+293)
		tmp = t_0;
	else
		tmp = x * (y / z);
	end
	tmp_2 = tmp;
end
NOTE: x and y should be sorted in increasing order before calling this function.
code[x_, y_, z_] := Block[{t$95$0 = N[(N[(x * y), $MachinePrecision] / z), $MachinePrecision]}, If[LessEqual[t$95$0, -4e-257], t$95$0, If[LessEqual[t$95$0, 0.0], N[(y * N[(x / z), $MachinePrecision]), $MachinePrecision], If[LessEqual[t$95$0, 5e+293], t$95$0, N[(x * N[(y / z), $MachinePrecision]), $MachinePrecision]]]]]
\begin{array}{l}
[x, y] = \mathsf{sort}([x, y])\\
\\
\begin{array}{l}
t_0 := \frac{x \cdot y}{z}\\
\mathbf{if}\;t_0 \leq -4 \cdot 10^{-257}:\\
\;\;\;\;t_0\\

\mathbf{elif}\;t_0 \leq 0:\\
\;\;\;\;y \cdot \frac{x}{z}\\

\mathbf{elif}\;t_0 \leq 5 \cdot 10^{+293}:\\
\;\;\;\;t_0\\

\mathbf{else}:\\
\;\;\;\;x \cdot \frac{y}{z}\\


\end{array}
\end{array}
Derivation
  1. Split input into 3 regimes
  2. if (/.f64 (*.f64 x y) z) < -3.9999999999999999e-257 or -0.0 < (/.f64 (*.f64 x y) z) < 5.00000000000000033e293

    1. Initial program 97.6%

      \[\frac{x \cdot y}{z} \]

    if -3.9999999999999999e-257 < (/.f64 (*.f64 x y) z) < -0.0

    1. Initial program 88.2%

      \[\frac{x \cdot y}{z} \]
    2. Step-by-step derivation
      1. associate-*l/99.6%

        \[\leadsto \color{blue}{\frac{x}{z} \cdot y} \]
    3. Simplified99.6%

      \[\leadsto \color{blue}{\frac{x}{z} \cdot y} \]

    if 5.00000000000000033e293 < (/.f64 (*.f64 x y) z)

    1. Initial program 70.8%

      \[\frac{x \cdot y}{z} \]
    2. Step-by-step derivation
      1. associate-*r/96.5%

        \[\leadsto \color{blue}{x \cdot \frac{y}{z}} \]
    3. Simplified96.5%

      \[\leadsto \color{blue}{x \cdot \frac{y}{z}} \]
  3. Recombined 3 regimes into one program.
  4. Final simplification97.9%

    \[\leadsto \begin{array}{l} \mathbf{if}\;\frac{x \cdot y}{z} \leq -4 \cdot 10^{-257}:\\ \;\;\;\;\frac{x \cdot y}{z}\\ \mathbf{elif}\;\frac{x \cdot y}{z} \leq 0:\\ \;\;\;\;y \cdot \frac{x}{z}\\ \mathbf{elif}\;\frac{x \cdot y}{z} \leq 5 \cdot 10^{+293}:\\ \;\;\;\;\frac{x \cdot y}{z}\\ \mathbf{else}:\\ \;\;\;\;x \cdot \frac{y}{z}\\ \end{array} \]

Alternative 2: 92.3% accurate, 0.5× speedup?

\[\begin{array}{l} [x, y] = \mathsf{sort}([x, y])\\ \\ \begin{array}{l} \mathbf{if}\;y \leq -1.78 \cdot 10^{-261} \lor \neg \left(y \leq 1.35 \cdot 10^{+141}\right):\\ \;\;\;\;y \cdot \frac{x}{z}\\ \mathbf{else}:\\ \;\;\;\;x \cdot \frac{y}{z}\\ \end{array} \end{array} \]
NOTE: x and y should be sorted in increasing order before calling this function.
(FPCore (x y z)
 :precision binary64
 (if (or (<= y -1.78e-261) (not (<= y 1.35e+141)))
   (* y (/ x z))
   (* x (/ y z))))
assert(x < y);
double code(double x, double y, double z) {
	double tmp;
	if ((y <= -1.78e-261) || !(y <= 1.35e+141)) {
		tmp = y * (x / z);
	} else {
		tmp = x * (y / z);
	}
	return tmp;
}
NOTE: x and y should be sorted in increasing order before calling this function.
real(8) function code(x, y, z)
    real(8), intent (in) :: x
    real(8), intent (in) :: y
    real(8), intent (in) :: z
    real(8) :: tmp
    if ((y <= (-1.78d-261)) .or. (.not. (y <= 1.35d+141))) then
        tmp = y * (x / z)
    else
        tmp = x * (y / z)
    end if
    code = tmp
end function
assert x < y;
public static double code(double x, double y, double z) {
	double tmp;
	if ((y <= -1.78e-261) || !(y <= 1.35e+141)) {
		tmp = y * (x / z);
	} else {
		tmp = x * (y / z);
	}
	return tmp;
}
[x, y] = sort([x, y])
def code(x, y, z):
	tmp = 0
	if (y <= -1.78e-261) or not (y <= 1.35e+141):
		tmp = y * (x / z)
	else:
		tmp = x * (y / z)
	return tmp
x, y = sort([x, y])
function code(x, y, z)
	tmp = 0.0
	if ((y <= -1.78e-261) || !(y <= 1.35e+141))
		tmp = Float64(y * Float64(x / z));
	else
		tmp = Float64(x * Float64(y / z));
	end
	return tmp
end
x, y = num2cell(sort([x, y])){:}
function tmp_2 = code(x, y, z)
	tmp = 0.0;
	if ((y <= -1.78e-261) || ~((y <= 1.35e+141)))
		tmp = y * (x / z);
	else
		tmp = x * (y / z);
	end
	tmp_2 = tmp;
end
NOTE: x and y should be sorted in increasing order before calling this function.
code[x_, y_, z_] := If[Or[LessEqual[y, -1.78e-261], N[Not[LessEqual[y, 1.35e+141]], $MachinePrecision]], N[(y * N[(x / z), $MachinePrecision]), $MachinePrecision], N[(x * N[(y / z), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
[x, y] = \mathsf{sort}([x, y])\\
\\
\begin{array}{l}
\mathbf{if}\;y \leq -1.78 \cdot 10^{-261} \lor \neg \left(y \leq 1.35 \cdot 10^{+141}\right):\\
\;\;\;\;y \cdot \frac{x}{z}\\

\mathbf{else}:\\
\;\;\;\;x \cdot \frac{y}{z}\\


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if y < -1.77999999999999995e-261 or 1.35e141 < y

    1. Initial program 92.1%

      \[\frac{x \cdot y}{z} \]
    2. Step-by-step derivation
      1. associate-*l/91.2%

        \[\leadsto \color{blue}{\frac{x}{z} \cdot y} \]
    3. Simplified91.2%

      \[\leadsto \color{blue}{\frac{x}{z} \cdot y} \]

    if -1.77999999999999995e-261 < y < 1.35e141

    1. Initial program 93.6%

      \[\frac{x \cdot y}{z} \]
    2. Step-by-step derivation
      1. associate-*r/92.4%

        \[\leadsto \color{blue}{x \cdot \frac{y}{z}} \]
    3. Simplified92.4%

      \[\leadsto \color{blue}{x \cdot \frac{y}{z}} \]
  3. Recombined 2 regimes into one program.
  4. Final simplification91.7%

    \[\leadsto \begin{array}{l} \mathbf{if}\;y \leq -1.78 \cdot 10^{-261} \lor \neg \left(y \leq 1.35 \cdot 10^{+141}\right):\\ \;\;\;\;y \cdot \frac{x}{z}\\ \mathbf{else}:\\ \;\;\;\;x \cdot \frac{y}{z}\\ \end{array} \]

Alternative 3: 92.5% accurate, 0.5× speedup?

\[\begin{array}{l} [x, y] = \mathsf{sort}([x, y])\\ \\ \begin{array}{l} \mathbf{if}\;y \leq -4.5 \cdot 10^{-259}:\\ \;\;\;\;\frac{y}{\frac{z}{x}}\\ \mathbf{elif}\;y \leq 2.9 \cdot 10^{+140}:\\ \;\;\;\;x \cdot \frac{y}{z}\\ \mathbf{else}:\\ \;\;\;\;y \cdot \frac{x}{z}\\ \end{array} \end{array} \]
NOTE: x and y should be sorted in increasing order before calling this function.
(FPCore (x y z)
 :precision binary64
 (if (<= y -4.5e-259)
   (/ y (/ z x))
   (if (<= y 2.9e+140) (* x (/ y z)) (* y (/ x z)))))
assert(x < y);
double code(double x, double y, double z) {
	double tmp;
	if (y <= -4.5e-259) {
		tmp = y / (z / x);
	} else if (y <= 2.9e+140) {
		tmp = x * (y / z);
	} else {
		tmp = y * (x / z);
	}
	return tmp;
}
NOTE: x and y should be sorted in increasing order before calling this function.
real(8) function code(x, y, z)
    real(8), intent (in) :: x
    real(8), intent (in) :: y
    real(8), intent (in) :: z
    real(8) :: tmp
    if (y <= (-4.5d-259)) then
        tmp = y / (z / x)
    else if (y <= 2.9d+140) then
        tmp = x * (y / z)
    else
        tmp = y * (x / z)
    end if
    code = tmp
end function
assert x < y;
public static double code(double x, double y, double z) {
	double tmp;
	if (y <= -4.5e-259) {
		tmp = y / (z / x);
	} else if (y <= 2.9e+140) {
		tmp = x * (y / z);
	} else {
		tmp = y * (x / z);
	}
	return tmp;
}
[x, y] = sort([x, y])
def code(x, y, z):
	tmp = 0
	if y <= -4.5e-259:
		tmp = y / (z / x)
	elif y <= 2.9e+140:
		tmp = x * (y / z)
	else:
		tmp = y * (x / z)
	return tmp
x, y = sort([x, y])
function code(x, y, z)
	tmp = 0.0
	if (y <= -4.5e-259)
		tmp = Float64(y / Float64(z / x));
	elseif (y <= 2.9e+140)
		tmp = Float64(x * Float64(y / z));
	else
		tmp = Float64(y * Float64(x / z));
	end
	return tmp
end
x, y = num2cell(sort([x, y])){:}
function tmp_2 = code(x, y, z)
	tmp = 0.0;
	if (y <= -4.5e-259)
		tmp = y / (z / x);
	elseif (y <= 2.9e+140)
		tmp = x * (y / z);
	else
		tmp = y * (x / z);
	end
	tmp_2 = tmp;
end
NOTE: x and y should be sorted in increasing order before calling this function.
code[x_, y_, z_] := If[LessEqual[y, -4.5e-259], N[(y / N[(z / x), $MachinePrecision]), $MachinePrecision], If[LessEqual[y, 2.9e+140], N[(x * N[(y / z), $MachinePrecision]), $MachinePrecision], N[(y * N[(x / z), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
[x, y] = \mathsf{sort}([x, y])\\
\\
\begin{array}{l}
\mathbf{if}\;y \leq -4.5 \cdot 10^{-259}:\\
\;\;\;\;\frac{y}{\frac{z}{x}}\\

\mathbf{elif}\;y \leq 2.9 \cdot 10^{+140}:\\
\;\;\;\;x \cdot \frac{y}{z}\\

\mathbf{else}:\\
\;\;\;\;y \cdot \frac{x}{z}\\


\end{array}
\end{array}
Derivation
  1. Split input into 3 regimes
  2. if y < -4.49999999999999974e-259

    1. Initial program 91.2%

      \[\frac{x \cdot y}{z} \]
    2. Step-by-step derivation
      1. associate-*r/93.8%

        \[\leadsto \color{blue}{x \cdot \frac{y}{z}} \]
    3. Simplified93.8%

      \[\leadsto \color{blue}{x \cdot \frac{y}{z}} \]
    4. Step-by-step derivation
      1. *-commutative93.8%

        \[\leadsto \color{blue}{\frac{y}{z} \cdot x} \]
      2. associate-*l/91.2%

        \[\leadsto \color{blue}{\frac{y \cdot x}{z}} \]
      3. associate-/l*91.6%

        \[\leadsto \color{blue}{\frac{y}{\frac{z}{x}}} \]
    5. Applied egg-rr91.6%

      \[\leadsto \color{blue}{\frac{y}{\frac{z}{x}}} \]

    if -4.49999999999999974e-259 < y < 2.8999999999999999e140

    1. Initial program 93.6%

      \[\frac{x \cdot y}{z} \]
    2. Step-by-step derivation
      1. associate-*r/92.4%

        \[\leadsto \color{blue}{x \cdot \frac{y}{z}} \]
    3. Simplified92.4%

      \[\leadsto \color{blue}{x \cdot \frac{y}{z}} \]

    if 2.8999999999999999e140 < y

    1. Initial program 94.5%

      \[\frac{x \cdot y}{z} \]
    2. Step-by-step derivation
      1. associate-*l/88.4%

        \[\leadsto \color{blue}{\frac{x}{z} \cdot y} \]
    3. Simplified88.4%

      \[\leadsto \color{blue}{\frac{x}{z} \cdot y} \]
  3. Recombined 3 regimes into one program.
  4. Final simplification91.5%

    \[\leadsto \begin{array}{l} \mathbf{if}\;y \leq -4.5 \cdot 10^{-259}:\\ \;\;\;\;\frac{y}{\frac{z}{x}}\\ \mathbf{elif}\;y \leq 2.9 \cdot 10^{+140}:\\ \;\;\;\;x \cdot \frac{y}{z}\\ \mathbf{else}:\\ \;\;\;\;y \cdot \frac{x}{z}\\ \end{array} \]

Alternative 4: 92.0% accurate, 1.0× speedup?

\[\begin{array}{l} [x, y] = \mathsf{sort}([x, y])\\ \\ x \cdot \frac{y}{z} \end{array} \]
NOTE: x and y should be sorted in increasing order before calling this function.
(FPCore (x y z) :precision binary64 (* x (/ y z)))
assert(x < y);
double code(double x, double y, double z) {
	return x * (y / z);
}
NOTE: x and y should be sorted in increasing order before calling this function.
real(8) function code(x, y, z)
    real(8), intent (in) :: x
    real(8), intent (in) :: y
    real(8), intent (in) :: z
    code = x * (y / z)
end function
assert x < y;
public static double code(double x, double y, double z) {
	return x * (y / z);
}
[x, y] = sort([x, y])
def code(x, y, z):
	return x * (y / z)
x, y = sort([x, y])
function code(x, y, z)
	return Float64(x * Float64(y / z))
end
x, y = num2cell(sort([x, y])){:}
function tmp = code(x, y, z)
	tmp = x * (y / z);
end
NOTE: x and y should be sorted in increasing order before calling this function.
code[x_, y_, z_] := N[(x * N[(y / z), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
[x, y] = \mathsf{sort}([x, y])\\
\\
x \cdot \frac{y}{z}
\end{array}
Derivation
  1. Initial program 92.7%

    \[\frac{x \cdot y}{z} \]
  2. Step-by-step derivation
    1. associate-*r/92.6%

      \[\leadsto \color{blue}{x \cdot \frac{y}{z}} \]
  3. Simplified92.6%

    \[\leadsto \color{blue}{x \cdot \frac{y}{z}} \]
  4. Final simplification92.6%

    \[\leadsto x \cdot \frac{y}{z} \]

Developer target: 92.1% accurate, 0.5× speedup?

\[\begin{array}{l} \\ \begin{array}{l} \mathbf{if}\;z < -4.262230790519429 \cdot 10^{-138}:\\ \;\;\;\;\frac{x \cdot y}{z}\\ \mathbf{elif}\;z < 1.7042130660650472 \cdot 10^{-164}:\\ \;\;\;\;\frac{x}{\frac{z}{y}}\\ \mathbf{else}:\\ \;\;\;\;\frac{x}{z} \cdot y\\ \end{array} \end{array} \]
(FPCore (x y z)
 :precision binary64
 (if (< z -4.262230790519429e-138)
   (/ (* x y) z)
   (if (< z 1.7042130660650472e-164) (/ x (/ z y)) (* (/ x z) y))))
double code(double x, double y, double z) {
	double tmp;
	if (z < -4.262230790519429e-138) {
		tmp = (x * y) / z;
	} else if (z < 1.7042130660650472e-164) {
		tmp = x / (z / y);
	} else {
		tmp = (x / z) * y;
	}
	return tmp;
}
real(8) function code(x, y, z)
    real(8), intent (in) :: x
    real(8), intent (in) :: y
    real(8), intent (in) :: z
    real(8) :: tmp
    if (z < (-4.262230790519429d-138)) then
        tmp = (x * y) / z
    else if (z < 1.7042130660650472d-164) then
        tmp = x / (z / y)
    else
        tmp = (x / z) * y
    end if
    code = tmp
end function
public static double code(double x, double y, double z) {
	double tmp;
	if (z < -4.262230790519429e-138) {
		tmp = (x * y) / z;
	} else if (z < 1.7042130660650472e-164) {
		tmp = x / (z / y);
	} else {
		tmp = (x / z) * y;
	}
	return tmp;
}
def code(x, y, z):
	tmp = 0
	if z < -4.262230790519429e-138:
		tmp = (x * y) / z
	elif z < 1.7042130660650472e-164:
		tmp = x / (z / y)
	else:
		tmp = (x / z) * y
	return tmp
function code(x, y, z)
	tmp = 0.0
	if (z < -4.262230790519429e-138)
		tmp = Float64(Float64(x * y) / z);
	elseif (z < 1.7042130660650472e-164)
		tmp = Float64(x / Float64(z / y));
	else
		tmp = Float64(Float64(x / z) * y);
	end
	return tmp
end
function tmp_2 = code(x, y, z)
	tmp = 0.0;
	if (z < -4.262230790519429e-138)
		tmp = (x * y) / z;
	elseif (z < 1.7042130660650472e-164)
		tmp = x / (z / y);
	else
		tmp = (x / z) * y;
	end
	tmp_2 = tmp;
end
code[x_, y_, z_] := If[Less[z, -4.262230790519429e-138], N[(N[(x * y), $MachinePrecision] / z), $MachinePrecision], If[Less[z, 1.7042130660650472e-164], N[(x / N[(z / y), $MachinePrecision]), $MachinePrecision], N[(N[(x / z), $MachinePrecision] * y), $MachinePrecision]]]
\begin{array}{l}

\\
\begin{array}{l}
\mathbf{if}\;z < -4.262230790519429 \cdot 10^{-138}:\\
\;\;\;\;\frac{x \cdot y}{z}\\

\mathbf{elif}\;z < 1.7042130660650472 \cdot 10^{-164}:\\
\;\;\;\;\frac{x}{\frac{z}{y}}\\

\mathbf{else}:\\
\;\;\;\;\frac{x}{z} \cdot y\\


\end{array}
\end{array}

Reproduce

?
herbie shell --seed 2023196 
(FPCore (x y z)
  :name "Diagrams.Solve.Tridiagonal:solveCyclicTriDiagonal from diagrams-solve-0.1, A"
  :precision binary64

  :herbie-target
  (if (< z -4.262230790519429e-138) (/ (* x y) z) (if (< z 1.7042130660650472e-164) (/ x (/ z y)) (* (/ x z) y)))

  (/ (* x y) z))