Average Error: 0.6 → 0.3
Time: 11.2s
Precision: binary64
Cost: 1348
\[1 - \frac{x}{\left(y - z\right) \cdot \left(y - t\right)} \]
\[\begin{array}{l} t_1 := \frac{x}{\left(y - z\right) \cdot \left(y - t\right)}\\ \mathbf{if}\;t_1 \leq 2 \cdot 10^{+301}:\\ \;\;\;\;1 - t_1\\ \mathbf{else}:\\ \;\;\;\;1 + \frac{\frac{x}{y - z}}{t - y}\\ \end{array} \]
(FPCore (x y z t) :precision binary64 (- 1.0 (/ x (* (- y z) (- y t)))))
(FPCore (x y z t)
 :precision binary64
 (let* ((t_1 (/ x (* (- y z) (- y t)))))
   (if (<= t_1 2e+301) (- 1.0 t_1) (+ 1.0 (/ (/ x (- y z)) (- t y))))))
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 t_1 = x / ((y - z) * (y - t));
	double tmp;
	if (t_1 <= 2e+301) {
		tmp = 1.0 - t_1;
	} else {
		tmp = 1.0 + ((x / (y - z)) / (t - y));
	}
	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) :: t_1
    real(8) :: tmp
    t_1 = x / ((y - z) * (y - t))
    if (t_1 <= 2d+301) then
        tmp = 1.0d0 - t_1
    else
        tmp = 1.0d0 + ((x / (y - z)) / (t - y))
    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 t_1 = x / ((y - z) * (y - t));
	double tmp;
	if (t_1 <= 2e+301) {
		tmp = 1.0 - t_1;
	} else {
		tmp = 1.0 + ((x / (y - z)) / (t - y));
	}
	return tmp;
}
def code(x, y, z, t):
	return 1.0 - (x / ((y - z) * (y - t)))
def code(x, y, z, t):
	t_1 = x / ((y - z) * (y - t))
	tmp = 0
	if t_1 <= 2e+301:
		tmp = 1.0 - t_1
	else:
		tmp = 1.0 + ((x / (y - z)) / (t - y))
	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)
	t_1 = Float64(x / Float64(Float64(y - z) * Float64(y - t)))
	tmp = 0.0
	if (t_1 <= 2e+301)
		tmp = Float64(1.0 - t_1);
	else
		tmp = Float64(1.0 + Float64(Float64(x / Float64(y - z)) / Float64(t - y)));
	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)
	t_1 = x / ((y - z) * (y - t));
	tmp = 0.0;
	if (t_1 <= 2e+301)
		tmp = 1.0 - t_1;
	else
		tmp = 1.0 + ((x / (y - z)) / (t - y));
	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_] := Block[{t$95$1 = N[(x / N[(N[(y - z), $MachinePrecision] * N[(y - t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[t$95$1, 2e+301], N[(1.0 - t$95$1), $MachinePrecision], N[(1.0 + N[(N[(x / N[(y - z), $MachinePrecision]), $MachinePrecision] / N[(t - y), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]
1 - \frac{x}{\left(y - z\right) \cdot \left(y - t\right)}
\begin{array}{l}
t_1 := \frac{x}{\left(y - z\right) \cdot \left(y - t\right)}\\
\mathbf{if}\;t_1 \leq 2 \cdot 10^{+301}:\\
\;\;\;\;1 - t_1\\

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


\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 (/.f64 x (*.f64 (-.f64 y z) (-.f64 y t))) < 2.00000000000000011e301

    1. Initial program 0.3

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

    if 2.00000000000000011e301 < (/.f64 x (*.f64 (-.f64 y z) (-.f64 y t)))

    1. Initial program 52.8

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

      \[\leadsto \color{blue}{1 + \frac{\frac{x}{y - z}}{t - y}} \]
      Proof
      (+.f64 1 (/.f64 (/.f64 x (-.f64 y z)) (-.f64 t y))): 0 points increase in error, 0 points decrease in error
      (+.f64 1 (/.f64 (/.f64 x (-.f64 y z)) (Rewrite<= remove-double-neg_binary64 (neg.f64 (neg.f64 (-.f64 t y)))))): 0 points increase in error, 0 points decrease in error
      (+.f64 1 (/.f64 (/.f64 x (-.f64 y z)) (neg.f64 (Rewrite<= sub0-neg_binary64 (-.f64 0 (-.f64 t y)))))): 0 points increase in error, 0 points decrease in error
      (+.f64 1 (/.f64 (/.f64 x (-.f64 y z)) (neg.f64 (Rewrite<= associate-+l-_binary64 (+.f64 (-.f64 0 t) y))))): 0 points increase in error, 0 points decrease in error
      (+.f64 1 (/.f64 (/.f64 x (-.f64 y z)) (neg.f64 (+.f64 (Rewrite<= neg-sub0_binary64 (neg.f64 t)) y)))): 0 points increase in error, 0 points decrease in error
      (+.f64 1 (/.f64 (/.f64 x (-.f64 y z)) (neg.f64 (Rewrite<= +-commutative_binary64 (+.f64 y (neg.f64 t)))))): 0 points increase in error, 0 points decrease in error
      (+.f64 1 (/.f64 (/.f64 x (-.f64 y z)) (neg.f64 (Rewrite<= sub-neg_binary64 (-.f64 y t))))): 0 points increase in error, 0 points decrease in error
      (+.f64 1 (/.f64 (/.f64 x (-.f64 y z)) (Rewrite=> neg-mul-1_binary64 (*.f64 -1 (-.f64 y t))))): 0 points increase in error, 0 points decrease in error
      (+.f64 1 (/.f64 (/.f64 x (-.f64 y z)) (Rewrite<= *-commutative_binary64 (*.f64 (-.f64 y t) -1)))): 0 points increase in error, 0 points decrease in error
      (+.f64 1 (Rewrite<= *-lft-identity_binary64 (*.f64 1 (/.f64 (/.f64 x (-.f64 y z)) (*.f64 (-.f64 y t) -1))))): 0 points increase in error, 0 points decrease in error
      (+.f64 1 (Rewrite=> associate-*r/_binary64 (/.f64 (*.f64 1 (/.f64 x (-.f64 y z))) (*.f64 (-.f64 y t) -1)))): 0 points increase in error, 0 points decrease in error
      (+.f64 1 (/.f64 (*.f64 1 (/.f64 x (-.f64 y z))) (Rewrite=> *-commutative_binary64 (*.f64 -1 (-.f64 y t))))): 0 points increase in error, 0 points decrease in error
      (+.f64 1 (Rewrite=> times-frac_binary64 (*.f64 (/.f64 1 -1) (/.f64 (/.f64 x (-.f64 y z)) (-.f64 y t))))): 0 points increase in error, 0 points decrease in error
      (+.f64 1 (*.f64 (Rewrite=> metadata-eval -1) (/.f64 (/.f64 x (-.f64 y z)) (-.f64 y t)))): 0 points increase in error, 0 points decrease in error
      (+.f64 1 (*.f64 -1 (Rewrite<= associate-/r*_binary64 (/.f64 x (*.f64 (-.f64 y z) (-.f64 y t)))))): 7 points increase in error, 10 points decrease in error
      (+.f64 1 (Rewrite<= neg-mul-1_binary64 (neg.f64 (/.f64 x (*.f64 (-.f64 y z) (-.f64 y t)))))): 0 points increase in error, 0 points decrease in error
      (Rewrite<= sub-neg_binary64 (-.f64 1 (/.f64 x (*.f64 (-.f64 y z) (-.f64 y t))))): 0 points increase in error, 0 points decrease in error
  3. Recombined 2 regimes into one program.
  4. Final simplification0.3

    \[\leadsto \begin{array}{l} \mathbf{if}\;\frac{x}{\left(y - z\right) \cdot \left(y - t\right)} \leq 2 \cdot 10^{+301}:\\ \;\;\;\;1 - \frac{x}{\left(y - z\right) \cdot \left(y - t\right)}\\ \mathbf{else}:\\ \;\;\;\;1 + \frac{\frac{x}{y - z}}{t - y}\\ \end{array} \]

Alternatives

Alternative 1
Error8.8
Cost1104
\[\begin{array}{l} t_1 := 1 - \frac{\frac{x}{y}}{y - t}\\ \mathbf{if}\;y \leq -7.129266169744647 \cdot 10^{-134}:\\ \;\;\;\;t_1\\ \mathbf{elif}\;y \leq 5.157960087661038 \cdot 10^{-108}:\\ \;\;\;\;1 - \frac{\frac{x}{t}}{z}\\ \mathbf{elif}\;y \leq 1.0830348397723031 \cdot 10^{-23}:\\ \;\;\;\;t_1\\ \mathbf{elif}\;y \leq 6.7437513697093 \cdot 10^{-23}:\\ \;\;\;\;\frac{x}{\left(y - z\right) \cdot t}\\ \mathbf{else}:\\ \;\;\;\;1 - \frac{\frac{x}{y}}{y - z}\\ \end{array} \]
Alternative 2
Error10.8
Cost976
\[\begin{array}{l} t_1 := 1 - \frac{\frac{x}{t}}{z}\\ \mathbf{if}\;t \leq -69875547912690640:\\ \;\;\;\;t_1\\ \mathbf{elif}\;t \leq 3.951087285501856 \cdot 10^{-54}:\\ \;\;\;\;1 - \frac{\frac{x}{y - z}}{y}\\ \mathbf{elif}\;t \leq 1.827194929368301 \cdot 10^{+80}:\\ \;\;\;\;1 - \frac{\frac{x}{y}}{y - t}\\ \mathbf{elif}\;t \leq 8.345525404676912 \cdot 10^{+136}:\\ \;\;\;\;t_1\\ \mathbf{else}:\\ \;\;\;\;1\\ \end{array} \]
Alternative 3
Error10.8
Cost976
\[\begin{array}{l} t_1 := 1 - \frac{\frac{x}{t}}{z}\\ \mathbf{if}\;t \leq -69875547912690640:\\ \;\;\;\;t_1\\ \mathbf{elif}\;t \leq 3.951087285501856 \cdot 10^{-54}:\\ \;\;\;\;1 - \frac{\frac{x}{y - z}}{y}\\ \mathbf{elif}\;t \leq 1.827194929368301 \cdot 10^{+80}:\\ \;\;\;\;1 - \frac{x}{y \cdot \left(y - t\right)}\\ \mathbf{elif}\;t \leq 8.345525404676912 \cdot 10^{+136}:\\ \;\;\;\;t_1\\ \mathbf{else}:\\ \;\;\;\;1\\ \end{array} \]
Alternative 4
Error13.7
Cost844
\[\begin{array}{l} \mathbf{if}\;z \leq -4.4794041708465835 \cdot 10^{-43}:\\ \;\;\;\;1\\ \mathbf{elif}\;z \leq -1 \cdot 10^{-250}:\\ \;\;\;\;1 - \frac{\frac{x}{y}}{y}\\ \mathbf{elif}\;z \leq 3.8219385440746146 \cdot 10^{-155}:\\ \;\;\;\;1 + \frac{x}{y \cdot t}\\ \mathbf{else}:\\ \;\;\;\;1\\ \end{array} \]
Alternative 5
Error8.6
Cost840
\[\begin{array}{l} t_1 := 1 - \frac{\frac{x}{y}}{y - t}\\ \mathbf{if}\;y \leq -7.129266169744647 \cdot 10^{-134}:\\ \;\;\;\;t_1\\ \mathbf{elif}\;y \leq 5.157960087661038 \cdot 10^{-108}:\\ \;\;\;\;1 - \frac{\frac{x}{t}}{z}\\ \mathbf{else}:\\ \;\;\;\;t_1\\ \end{array} \]
Alternative 6
Error8.0
Cost840
\[\begin{array}{l} \mathbf{if}\;t \leq -69875547912690640:\\ \;\;\;\;1 - \frac{\frac{x}{t}}{z}\\ \mathbf{elif}\;t \leq 1.2644090526071791 \cdot 10^{-54}:\\ \;\;\;\;1 - \frac{\frac{x}{y - z}}{y}\\ \mathbf{else}:\\ \;\;\;\;1 + \frac{x}{\left(y - z\right) \cdot t}\\ \end{array} \]
Alternative 7
Error0.7
Cost836
\[\begin{array}{l} \mathbf{if}\;t \leq 1.3619907214391076 \cdot 10^{+71}:\\ \;\;\;\;1 + \frac{\frac{x}{y - z}}{t - y}\\ \mathbf{else}:\\ \;\;\;\;1 + \frac{\frac{x}{t}}{y - z}\\ \end{array} \]
Alternative 8
Error0.9
Cost832
\[1 + \frac{-1}{\left(y - z\right) \cdot \frac{y - t}{x}} \]
Alternative 9
Error13.7
Cost712
\[\begin{array}{l} \mathbf{if}\;z \leq -4.4794041708465835 \cdot 10^{-43}:\\ \;\;\;\;1\\ \mathbf{elif}\;z \leq 6.5 \cdot 10^{-244}:\\ \;\;\;\;1 - \frac{\frac{x}{y}}{y}\\ \mathbf{else}:\\ \;\;\;\;1\\ \end{array} \]
Alternative 10
Error9.7
Cost712
\[\begin{array}{l} \mathbf{if}\;y \leq -3.6112497712242504 \cdot 10^{-163}:\\ \;\;\;\;1\\ \mathbf{elif}\;y \leq 1.9248115619139561 \cdot 10^{-134}:\\ \;\;\;\;1 - \frac{\frac{x}{t}}{z}\\ \mathbf{else}:\\ \;\;\;\;1\\ \end{array} \]
Alternative 11
Error12.8
Cost64
\[1 \]

Error

Reproduce

herbie shell --seed 2022300 
(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)))))