?

Average Error: 6.0 → 5.3
Time: 2.8s
Precision: binary64
Cost: 708

?

\[x + \frac{y \cdot y}{z} \]
\[\begin{array}{l} \mathbf{if}\;y \cdot y \leq 2 \cdot 10^{+302}:\\ \;\;\;\;x + \frac{y \cdot y}{z}\\ \mathbf{else}:\\ \;\;\;\;x\\ \end{array} \]
(FPCore (x y z) :precision binary64 (+ x (/ (* y y) z)))
(FPCore (x y z)
 :precision binary64
 (if (<= (* y y) 2e+302) (+ x (/ (* y y) z)) x))
double code(double x, double y, double z) {
	return x + ((y * y) / z);
}
double code(double x, double y, double z) {
	double tmp;
	if ((y * y) <= 2e+302) {
		tmp = x + ((y * y) / z);
	} else {
		tmp = x;
	}
	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 = x + ((y * y) / 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 ((y * y) <= 2d+302) then
        tmp = x + ((y * y) / z)
    else
        tmp = x
    end if
    code = tmp
end function
public static double code(double x, double y, double z) {
	return x + ((y * y) / z);
}
public static double code(double x, double y, double z) {
	double tmp;
	if ((y * y) <= 2e+302) {
		tmp = x + ((y * y) / z);
	} else {
		tmp = x;
	}
	return tmp;
}
def code(x, y, z):
	return x + ((y * y) / z)
def code(x, y, z):
	tmp = 0
	if (y * y) <= 2e+302:
		tmp = x + ((y * y) / z)
	else:
		tmp = x
	return tmp
function code(x, y, z)
	return Float64(x + Float64(Float64(y * y) / z))
end
function code(x, y, z)
	tmp = 0.0
	if (Float64(y * y) <= 2e+302)
		tmp = Float64(x + Float64(Float64(y * y) / z));
	else
		tmp = x;
	end
	return tmp
end
function tmp = code(x, y, z)
	tmp = x + ((y * y) / z);
end
function tmp_2 = code(x, y, z)
	tmp = 0.0;
	if ((y * y) <= 2e+302)
		tmp = x + ((y * y) / z);
	else
		tmp = x;
	end
	tmp_2 = tmp;
end
code[x_, y_, z_] := N[(x + N[(N[(y * y), $MachinePrecision] / z), $MachinePrecision]), $MachinePrecision]
code[x_, y_, z_] := If[LessEqual[N[(y * y), $MachinePrecision], 2e+302], N[(x + N[(N[(y * y), $MachinePrecision] / z), $MachinePrecision]), $MachinePrecision], x]
x + \frac{y \cdot y}{z}
\begin{array}{l}
\mathbf{if}\;y \cdot y \leq 2 \cdot 10^{+302}:\\
\;\;\;\;x + \frac{y \cdot y}{z}\\

\mathbf{else}:\\
\;\;\;\;x\\


\end{array}

Error?

Try it out?

Your Program's Arguments

Results

Enter valid numbers for all inputs

Target

Original6.0
Target0.1
Herbie5.3
\[x + y \cdot \frac{y}{z} \]

Derivation?

  1. Split input into 2 regimes
  2. if (*.f64 y y) < 2.0000000000000002e302

    1. Initial program 0.9

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

    if 2.0000000000000002e302 < (*.f64 y y)

    1. Initial program 62.0

      \[x + \frac{y \cdot y}{z} \]
    2. Taylor expanded in x around inf 53.9

      \[\leadsto \color{blue}{x} \]
  3. Recombined 2 regimes into one program.
  4. Final simplification5.3

    \[\leadsto \begin{array}{l} \mathbf{if}\;y \cdot y \leq 2 \cdot 10^{+302}:\\ \;\;\;\;x + \frac{y \cdot y}{z}\\ \mathbf{else}:\\ \;\;\;\;x\\ \end{array} \]

Alternatives

Alternative 1
Error21.5
Cost64
\[x \]

Error

Reproduce?

herbie shell --seed 2023090 
(FPCore (x y z)
  :name "Crypto.Random.Test:calculate from crypto-random-0.0.9"
  :precision binary64

  :herbie-target
  (+ x (* y (/ y z)))

  (+ x (/ (* y y) z)))