?

Average Error: 0.5 → 0.6
Time: 1.7min
Precision: binary64
Cost: 836

?

\[1 - \frac{x}{\left(y - z\right) \cdot \left(y - t\right)} \]
\[\begin{array}{l} \mathbf{if}\;t \leq -1.75 \cdot 10^{+51}:\\ \;\;\;\;1 - \frac{x}{t \cdot \left(z - y\right)}\\ \mathbf{else}:\\ \;\;\;\;\frac{\frac{x}{y - z}}{t - y} + 1\\ \end{array} \]
(FPCore (x y z t) :precision binary64 (- 1.0 (/ x (* (- y z) (- y t)))))
(FPCore (x y z t)
 :precision binary64
 (if (<= t -1.75e+51)
   (- 1.0 (/ x (* t (- z y))))
   (+ (/ (/ x (- y z)) (- t y)) 1.0)))
double code(double x, double y, double z, double t) {
	return 1.0 - (x / ((y - z) * (y - t)));
}
double code(double x, double y, double z, double t) {
	double tmp;
	if (t <= -1.75e+51) {
		tmp = 1.0 - (x / (t * (z - y)));
	} else {
		tmp = ((x / (y - z)) / (t - y)) + 1.0;
	}
	return tmp;
}
real(8) function code(x, y, z, t)
    real(8), intent (in) :: x
    real(8), intent (in) :: y
    real(8), intent (in) :: z
    real(8), intent (in) :: t
    code = 1.0d0 - (x / ((y - z) * (y - t)))
end function
real(8) function code(x, y, z, t)
    real(8), intent (in) :: x
    real(8), intent (in) :: y
    real(8), intent (in) :: z
    real(8), intent (in) :: t
    real(8) :: tmp
    if (t <= (-1.75d+51)) then
        tmp = 1.0d0 - (x / (t * (z - y)))
    else
        tmp = ((x / (y - z)) / (t - y)) + 1.0d0
    end if
    code = tmp
end function
public static double code(double x, double y, double z, double t) {
	return 1.0 - (x / ((y - z) * (y - t)));
}
public static double code(double x, double y, double z, double t) {
	double tmp;
	if (t <= -1.75e+51) {
		tmp = 1.0 - (x / (t * (z - y)));
	} else {
		tmp = ((x / (y - z)) / (t - y)) + 1.0;
	}
	return tmp;
}
def code(x, y, z, t):
	return 1.0 - (x / ((y - z) * (y - t)))
def code(x, y, z, t):
	tmp = 0
	if t <= -1.75e+51:
		tmp = 1.0 - (x / (t * (z - y)))
	else:
		tmp = ((x / (y - z)) / (t - y)) + 1.0
	return tmp
function code(x, y, z, t)
	return Float64(1.0 - Float64(x / Float64(Float64(y - z) * Float64(y - t))))
end
function code(x, y, z, t)
	tmp = 0.0
	if (t <= -1.75e+51)
		tmp = Float64(1.0 - Float64(x / Float64(t * Float64(z - y))));
	else
		tmp = Float64(Float64(Float64(x / Float64(y - z)) / Float64(t - y)) + 1.0);
	end
	return tmp
end
function tmp = code(x, y, z, t)
	tmp = 1.0 - (x / ((y - z) * (y - t)));
end
function tmp_2 = code(x, y, z, t)
	tmp = 0.0;
	if (t <= -1.75e+51)
		tmp = 1.0 - (x / (t * (z - y)));
	else
		tmp = ((x / (y - z)) / (t - y)) + 1.0;
	end
	tmp_2 = tmp;
end
code[x_, y_, z_, t_] := N[(1.0 - N[(x / N[(N[(y - z), $MachinePrecision] * N[(y - t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
code[x_, y_, z_, t_] := If[LessEqual[t, -1.75e+51], N[(1.0 - N[(x / N[(t * N[(z - y), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(N[(x / N[(y - z), $MachinePrecision]), $MachinePrecision] / N[(t - y), $MachinePrecision]), $MachinePrecision] + 1.0), $MachinePrecision]]
1 - \frac{x}{\left(y - z\right) \cdot \left(y - t\right)}
\begin{array}{l}
\mathbf{if}\;t \leq -1.75 \cdot 10^{+51}:\\
\;\;\;\;1 - \frac{x}{t \cdot \left(z - y\right)}\\

\mathbf{else}:\\
\;\;\;\;\frac{\frac{x}{y - z}}{t - y} + 1\\


\end{array}

Error?

Try it out?

Your Program's Arguments

Results

Enter valid numbers for all inputs

Derivation?

  1. Split input into 2 regimes
  2. if t < -1.75e51

    1. Initial program 0.0

      \[1 - \frac{x}{\left(y - z\right) \cdot \left(y - t\right)} \]
    2. Taylor expanded in t around inf 0.4

      \[\leadsto 1 - \frac{x}{\color{blue}{-1 \cdot \left(t \cdot \left(y - z\right)\right)}} \]
    3. Simplified0.4

      \[\leadsto 1 - \frac{x}{\color{blue}{t \cdot \left(z - y\right)}} \]
      Proof

    if -1.75e51 < t

    1. Initial program 0.7

      \[1 - \frac{x}{\left(y - z\right) \cdot \left(y - t\right)} \]
    2. Simplified0.6

      \[\leadsto \color{blue}{\frac{\frac{x}{y - z}}{t - y} + 1} \]
      Proof
  3. Recombined 2 regimes into one program.

Alternatives

Alternative 1
Error8.7
Cost1104
\[\begin{array}{l} \mathbf{if}\;y \leq -7.6 \cdot 10^{+35}:\\ \;\;\;\;1\\ \mathbf{elif}\;y \leq -2.95 \cdot 10^{-30}:\\ \;\;\;\;\frac{\frac{x}{z}}{y} + 1\\ \mathbf{elif}\;y \leq -3.4 \cdot 10^{-71}:\\ \;\;\;\;1\\ \mathbf{elif}\;y \leq 1.8 \cdot 10^{-25}:\\ \;\;\;\;1 - \frac{x}{t \cdot \left(z - y\right)}\\ \mathbf{else}:\\ \;\;\;\;1\\ \end{array} \]
Alternative 2
Error11.0
Cost976
\[\begin{array}{l} \mathbf{if}\;y \leq -7.6 \cdot 10^{+35}:\\ \;\;\;\;1\\ \mathbf{elif}\;y \leq -4.6 \cdot 10^{-30}:\\ \;\;\;\;\frac{\frac{x}{z}}{y} + 1\\ \mathbf{elif}\;y \leq -1.08 \cdot 10^{-160}:\\ \;\;\;\;1\\ \mathbf{elif}\;y \leq 2.4 \cdot 10^{-37}:\\ \;\;\;\;1 - \frac{x}{z \cdot t}\\ \mathbf{else}:\\ \;\;\;\;1\\ \end{array} \]
Alternative 3
Error7.1
Cost972
\[\begin{array}{l} t_1 := 1 - \frac{x}{y \cdot \left(y - t\right)}\\ \mathbf{if}\;y \leq -7 \cdot 10^{+23}:\\ \;\;\;\;t_1\\ \mathbf{elif}\;y \leq -7.6 \cdot 10^{-31}:\\ \;\;\;\;\frac{\frac{x}{z}}{y} + 1\\ \mathbf{elif}\;y \leq 5 \cdot 10^{-37}:\\ \;\;\;\;1 - \frac{x}{t \cdot \left(z - y\right)}\\ \mathbf{else}:\\ \;\;\;\;t_1\\ \end{array} \]
Alternative 4
Error5.3
Cost840
\[\begin{array}{l} t_1 := 1 - \frac{x}{\left(t - y\right) \cdot z}\\ \mathbf{if}\;z \leq -6 \cdot 10^{-102}:\\ \;\;\;\;t_1\\ \mathbf{elif}\;z \leq 5.4 \cdot 10^{-101}:\\ \;\;\;\;1 - \frac{x}{y \cdot \left(y - t\right)}\\ \mathbf{else}:\\ \;\;\;\;t_1\\ \end{array} \]
Alternative 5
Error5.5
Cost840
\[\begin{array}{l} t_1 := 1 - \frac{x}{\left(t - y\right) \cdot z}\\ \mathbf{if}\;z \leq -9.8 \cdot 10^{-101}:\\ \;\;\;\;t_1\\ \mathbf{elif}\;z \leq 5.4 \cdot 10^{-99}:\\ \;\;\;\;1 - \frac{\frac{x}{y}}{y - t}\\ \mathbf{else}:\\ \;\;\;\;t_1\\ \end{array} \]
Alternative 6
Error13.7
Cost712
\[\begin{array}{l} \mathbf{if}\;t \leq -1.3 \cdot 10^{-126}:\\ \;\;\;\;1\\ \mathbf{elif}\;t \leq 1.02 \cdot 10^{-241}:\\ \;\;\;\;\frac{x}{y \cdot z} + 1\\ \mathbf{else}:\\ \;\;\;\;1\\ \end{array} \]
Alternative 7
Error13.7
Cost712
\[\begin{array}{l} \mathbf{if}\;t \leq -1.4 \cdot 10^{-126}:\\ \;\;\;\;1\\ \mathbf{elif}\;t \leq 1.22 \cdot 10^{-240}:\\ \;\;\;\;\frac{\frac{x}{z}}{y} + 1\\ \mathbf{else}:\\ \;\;\;\;1\\ \end{array} \]
Alternative 8
Error0.5
Cost704
\[1 - \frac{x}{\left(y - z\right) \cdot \left(y - t\right)} \]
Alternative 9
Error13.5
Cost64
\[1 \]

Error

Reproduce?

herbie shell --seed 2023033 
(FPCore (x y z t)
  :name "Data.Random.Distribution.Triangular:triangularCDF from random-fu-0.2.6.2, A"
  :precision binary64
  (- 1.0 (/ x (* (- y z) (- y t)))))