Average Error: 3.3 → 0.1
Time: 4.2s
Precision: binary64
\[[y, z] = \mathsf{sort}([y, z]) \\]
\[x \cdot \left(1 - y \cdot z\right) \]
\[\begin{array}{l} t_0 := -y \cdot \left(z \cdot x\right)\\ \mathbf{if}\;y \cdot z \leq -7.916302931072885 \cdot 10^{+255}:\\ \;\;\;\;t_0\\ \mathbf{elif}\;y \cdot z \leq 1.5426552752051337 \cdot 10^{+250}:\\ \;\;\;\;x - \left(y \cdot z\right) \cdot x\\ \mathbf{else}:\\ \;\;\;\;t_0\\ \end{array} \]
x \cdot \left(1 - y \cdot z\right)
\begin{array}{l}
t_0 := -y \cdot \left(z \cdot x\right)\\
\mathbf{if}\;y \cdot z \leq -7.916302931072885 \cdot 10^{+255}:\\
\;\;\;\;t_0\\

\mathbf{elif}\;y \cdot z \leq 1.5426552752051337 \cdot 10^{+250}:\\
\;\;\;\;x - \left(y \cdot z\right) \cdot x\\

\mathbf{else}:\\
\;\;\;\;t_0\\


\end{array}
(FPCore (x y z) :precision binary64 (* x (- 1.0 (* y z))))
(FPCore (x y z)
 :precision binary64
 (let* ((t_0 (- (* y (* z x)))))
   (if (<= (* y z) -7.916302931072885e+255)
     t_0
     (if (<= (* y z) 1.5426552752051337e+250) (- x (* (* y z) x)) t_0))))
double code(double x, double y, double z) {
	return x * (1.0 - (y * z));
}
double code(double x, double y, double z) {
	double t_0 = -(y * (z * x));
	double tmp;
	if ((y * z) <= -7.916302931072885e+255) {
		tmp = t_0;
	} else if ((y * z) <= 1.5426552752051337e+250) {
		tmp = x - ((y * z) * x);
	} else {
		tmp = t_0;
	}
	return tmp;
}

Error

Bits error versus x

Bits error versus y

Bits error versus z

Try it out

Your Program's Arguments

Results

Enter valid numbers for all inputs

Derivation

  1. Split input into 2 regimes
  2. if (*.f64 y z) < -7.9163029310728848e255 or 1.5426552752051337e250 < (*.f64 y z)

    1. Initial program 40.7

      \[x \cdot \left(1 - y \cdot z\right) \]
    2. Taylor expanded in y around inf 0.5

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

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

    if -7.9163029310728848e255 < (*.f64 y z) < 1.5426552752051337e250

    1. Initial program 0.1

      \[x \cdot \left(1 - y \cdot z\right) \]
    2. Applied cancel-sign-sub-inv_binary640.1

      \[\leadsto x \cdot \color{blue}{\left(1 + \left(-y\right) \cdot z\right)} \]
    3. Applied distribute-lft-in_binary640.1

      \[\leadsto \color{blue}{x \cdot 1 + x \cdot \left(\left(-y\right) \cdot z\right)} \]
  3. Recombined 2 regimes into one program.
  4. Final simplification0.1

    \[\leadsto \begin{array}{l} \mathbf{if}\;y \cdot z \leq -7.916302931072885 \cdot 10^{+255}:\\ \;\;\;\;-y \cdot \left(z \cdot x\right)\\ \mathbf{elif}\;y \cdot z \leq 1.5426552752051337 \cdot 10^{+250}:\\ \;\;\;\;x - \left(y \cdot z\right) \cdot x\\ \mathbf{else}:\\ \;\;\;\;-y \cdot \left(z \cdot x\right)\\ \end{array} \]

Reproduce

herbie shell --seed 2022077 
(FPCore (x y z)
  :name "Data.Colour.RGBSpace.HSV:hsv from colour-2.3.3, I"
  :precision binary64
  (* x (- 1.0 (* y z))))