?

Average Error: 7.8 → 0.5
Time: 11.6s
Precision: binary64
Cost: 7113

?

\[\frac{\cosh x \cdot \frac{y}{x}}{z} \]
\[\begin{array}{l} \mathbf{if}\;z \leq -6.2 \cdot 10^{+33} \lor \neg \left(z \leq 5.2 \cdot 10^{-56}\right):\\ \;\;\;\;\frac{\cosh x \cdot y}{z \cdot x}\\ \mathbf{else}:\\ \;\;\;\;\frac{\cosh x \cdot \frac{y}{x}}{z}\\ \end{array} \]
(FPCore (x y z) :precision binary64 (/ (* (cosh x) (/ y x)) z))
(FPCore (x y z)
 :precision binary64
 (if (or (<= z -6.2e+33) (not (<= z 5.2e-56)))
   (/ (* (cosh x) y) (* z x))
   (/ (* (cosh x) (/ y x)) z)))
double code(double x, double y, double z) {
	return (cosh(x) * (y / x)) / z;
}
double code(double x, double y, double z) {
	double tmp;
	if ((z <= -6.2e+33) || !(z <= 5.2e-56)) {
		tmp = (cosh(x) * y) / (z * x);
	} else {
		tmp = (cosh(x) * (y / x)) / z;
	}
	return tmp;
}
real(8) function code(x, y, z)
    real(8), intent (in) :: x
    real(8), intent (in) :: y
    real(8), intent (in) :: z
    code = (cosh(x) * (y / x)) / z
end 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 ((z <= (-6.2d+33)) .or. (.not. (z <= 5.2d-56))) then
        tmp = (cosh(x) * y) / (z * x)
    else
        tmp = (cosh(x) * (y / x)) / z
    end if
    code = tmp
end function
public static double code(double x, double y, double z) {
	return (Math.cosh(x) * (y / x)) / z;
}
public static double code(double x, double y, double z) {
	double tmp;
	if ((z <= -6.2e+33) || !(z <= 5.2e-56)) {
		tmp = (Math.cosh(x) * y) / (z * x);
	} else {
		tmp = (Math.cosh(x) * (y / x)) / z;
	}
	return tmp;
}
def code(x, y, z):
	return (math.cosh(x) * (y / x)) / z
def code(x, y, z):
	tmp = 0
	if (z <= -6.2e+33) or not (z <= 5.2e-56):
		tmp = (math.cosh(x) * y) / (z * x)
	else:
		tmp = (math.cosh(x) * (y / x)) / z
	return tmp
function code(x, y, z)
	return Float64(Float64(cosh(x) * Float64(y / x)) / z)
end
function code(x, y, z)
	tmp = 0.0
	if ((z <= -6.2e+33) || !(z <= 5.2e-56))
		tmp = Float64(Float64(cosh(x) * y) / Float64(z * x));
	else
		tmp = Float64(Float64(cosh(x) * Float64(y / x)) / z);
	end
	return tmp
end
function tmp = code(x, y, z)
	tmp = (cosh(x) * (y / x)) / z;
end
function tmp_2 = code(x, y, z)
	tmp = 0.0;
	if ((z <= -6.2e+33) || ~((z <= 5.2e-56)))
		tmp = (cosh(x) * y) / (z * x);
	else
		tmp = (cosh(x) * (y / x)) / z;
	end
	tmp_2 = tmp;
end
code[x_, y_, z_] := N[(N[(N[Cosh[x], $MachinePrecision] * N[(y / x), $MachinePrecision]), $MachinePrecision] / z), $MachinePrecision]
code[x_, y_, z_] := If[Or[LessEqual[z, -6.2e+33], N[Not[LessEqual[z, 5.2e-56]], $MachinePrecision]], N[(N[(N[Cosh[x], $MachinePrecision] * y), $MachinePrecision] / N[(z * x), $MachinePrecision]), $MachinePrecision], N[(N[(N[Cosh[x], $MachinePrecision] * N[(y / x), $MachinePrecision]), $MachinePrecision] / z), $MachinePrecision]]
\frac{\cosh x \cdot \frac{y}{x}}{z}
\begin{array}{l}
\mathbf{if}\;z \leq -6.2 \cdot 10^{+33} \lor \neg \left(z \leq 5.2 \cdot 10^{-56}\right):\\
\;\;\;\;\frac{\cosh x \cdot y}{z \cdot x}\\

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


\end{array}

Error?

Try it out?

Your Program's Arguments

Results

Enter valid numbers for all inputs

Target

Original7.8
Target0.4
Herbie0.5
\[\begin{array}{l} \mathbf{if}\;y < -4.618902267687042 \cdot 10^{-52}:\\ \;\;\;\;\frac{\frac{y}{z}}{x} \cdot \cosh x\\ \mathbf{elif}\;y < 1.038530535935153 \cdot 10^{-39}:\\ \;\;\;\;\frac{\frac{\cosh x \cdot y}{x}}{z}\\ \mathbf{else}:\\ \;\;\;\;\frac{\frac{y}{z}}{x} \cdot \cosh x\\ \end{array} \]

Derivation?

  1. Split input into 2 regimes
  2. if z < -6.2e33 or 5.19999999999999994e-56 < z

    1. Initial program 11.5

      \[\frac{\cosh x \cdot \frac{y}{x}}{z} \]
    2. Simplified0.5

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

      [Start]11.5

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

      associate-*r/ [=>]11.5

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

      associate-/l/ [=>]0.5

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

    if -6.2e33 < z < 5.19999999999999994e-56

    1. Initial program 0.5

      \[\frac{\cosh x \cdot \frac{y}{x}}{z} \]
  3. Recombined 2 regimes into one program.
  4. Final simplification0.5

    \[\leadsto \begin{array}{l} \mathbf{if}\;z \leq -6.2 \cdot 10^{+33} \lor \neg \left(z \leq 5.2 \cdot 10^{-56}\right):\\ \;\;\;\;\frac{\cosh x \cdot y}{z \cdot x}\\ \mathbf{else}:\\ \;\;\;\;\frac{\cosh x \cdot \frac{y}{x}}{z}\\ \end{array} \]

Alternatives

Alternative 1
Error1.3
Cost7113
\[\begin{array}{l} \mathbf{if}\;y \leq -1.05 \cdot 10^{-33} \lor \neg \left(y \leq 2.4 \cdot 10^{-136}\right):\\ \;\;\;\;\cosh x \cdot \frac{\frac{y}{z}}{x}\\ \mathbf{else}:\\ \;\;\;\;\frac{\frac{y}{x} + x \cdot \left(y \cdot 0.5\right)}{z}\\ \end{array} \]
Alternative 2
Error0.5
Cost7113
\[\begin{array}{l} \mathbf{if}\;z \leq -1.32 \cdot 10^{+45} \lor \neg \left(z \leq 5.2 \cdot 10^{-56}\right):\\ \;\;\;\;y \cdot \frac{\cosh x}{z \cdot x}\\ \mathbf{else}:\\ \;\;\;\;\cosh x \cdot \frac{\frac{y}{z}}{x}\\ \end{array} \]
Alternative 3
Error0.5
Cost7113
\[\begin{array}{l} \mathbf{if}\;z \leq -6 \cdot 10^{+45} \lor \neg \left(z \leq 9 \cdot 10^{-58}\right):\\ \;\;\;\;\frac{\cosh x \cdot y}{z \cdot x}\\ \mathbf{else}:\\ \;\;\;\;\cosh x \cdot \frac{\frac{y}{z}}{x}\\ \end{array} \]
Alternative 4
Error1.4
Cost1097
\[\begin{array}{l} \mathbf{if}\;z \leq -5.5 \cdot 10^{+33} \lor \neg \left(z \leq 5.2 \cdot 10^{-56}\right):\\ \;\;\;\;\frac{y}{z \cdot x} + 0.5 \cdot \frac{x \cdot y}{z}\\ \mathbf{else}:\\ \;\;\;\;\frac{\frac{y}{x} + x \cdot \left(y \cdot 0.5\right)}{z}\\ \end{array} \]
Alternative 5
Error1.5
Cost1096
\[\begin{array}{l} \mathbf{if}\;y \leq -1.6 \cdot 10^{+67}:\\ \;\;\;\;\frac{y}{z \cdot x}\\ \mathbf{elif}\;y \leq 3.8 \cdot 10^{-39}:\\ \;\;\;\;\frac{\frac{y}{x} + x \cdot \left(y \cdot 0.5\right)}{z}\\ \mathbf{else}:\\ \;\;\;\;\frac{\frac{y}{z}}{x} + 0.5 \cdot \frac{y}{\frac{z}{x}}\\ \end{array} \]
Alternative 6
Error1.4
Cost1096
\[\begin{array}{l} \mathbf{if}\;z \leq -1.55 \cdot 10^{+34}:\\ \;\;\;\;\frac{y + \left(y \cdot 0.5\right) \cdot \left(x \cdot x\right)}{z \cdot x}\\ \mathbf{elif}\;z \leq 5.2 \cdot 10^{-56}:\\ \;\;\;\;\frac{\frac{y}{x} + x \cdot \left(y \cdot 0.5\right)}{z}\\ \mathbf{else}:\\ \;\;\;\;\frac{y}{z \cdot x} + 0.5 \cdot \frac{x \cdot y}{z}\\ \end{array} \]
Alternative 7
Error1.5
Cost969
\[\begin{array}{l} \mathbf{if}\;z \leq -6 \cdot 10^{+33} \lor \neg \left(z \leq 2.9 \cdot 10^{+26}\right):\\ \;\;\;\;\frac{y}{z \cdot x}\\ \mathbf{else}:\\ \;\;\;\;\frac{y}{z} \cdot \left(x \cdot 0.5 + \frac{1}{x}\right)\\ \end{array} \]
Alternative 8
Error1.4
Cost969
\[\begin{array}{l} t_0 := x \cdot 0.5 + \frac{1}{x}\\ \mathbf{if}\;z \leq -5 \cdot 10^{+33} \lor \neg \left(z \leq 1.85 \cdot 10^{-56}\right):\\ \;\;\;\;\frac{y}{\frac{z}{t_0}}\\ \mathbf{else}:\\ \;\;\;\;\frac{y}{z} \cdot t_0\\ \end{array} \]
Alternative 9
Error1.5
Cost968
\[\begin{array}{l} \mathbf{if}\;y \leq -1.3 \cdot 10^{+67}:\\ \;\;\;\;\frac{y}{z \cdot x}\\ \mathbf{elif}\;y \leq 0.001:\\ \;\;\;\;\frac{\frac{y}{x} + x \cdot \left(y \cdot 0.5\right)}{z}\\ \mathbf{else}:\\ \;\;\;\;\frac{y}{\frac{z}{x \cdot 0.5 + \frac{1}{x}}}\\ \end{array} \]
Alternative 10
Error1.8
Cost585
\[\begin{array}{l} \mathbf{if}\;z \leq -5.05 \cdot 10^{+33} \lor \neg \left(z \leq 5.2 \cdot 10^{-56}\right):\\ \;\;\;\;\frac{y}{z \cdot x}\\ \mathbf{else}:\\ \;\;\;\;\frac{\frac{y}{x}}{z}\\ \end{array} \]
Alternative 11
Error8.0
Cost320
\[\frac{y}{z \cdot x} \]

Error

Reproduce?

herbie shell --seed 2023018 
(FPCore (x y z)
  :name "Linear.Quaternion:$ctan from linear-1.19.1.3"
  :precision binary64

  :herbie-target
  (if (< y -4.618902267687042e-52) (* (/ (/ y z) x) (cosh x)) (if (< y 1.038530535935153e-39) (/ (/ (* (cosh x) y) x) z) (* (/ (/ y z) x) (cosh x))))

  (/ (* (cosh x) (/ y x)) z))