?

Average Accuracy: 99.9% → 100.0%
Time: 9.4s
Precision: binary64
Cost: 832

?

\[1 + \frac{4 \cdot \left(\left(x + y \cdot 0.25\right) - z\right)}{y} \]
\[\left(2 + 4 \cdot \frac{x}{y}\right) + \frac{z}{y} \cdot -4 \]
(FPCore (x y z)
 :precision binary64
 (+ 1.0 (/ (* 4.0 (- (+ x (* y 0.25)) z)) y)))
(FPCore (x y z)
 :precision binary64
 (+ (+ 2.0 (* 4.0 (/ x y))) (* (/ z y) -4.0)))
double code(double x, double y, double z) {
	return 1.0 + ((4.0 * ((x + (y * 0.25)) - z)) / y);
}
double code(double x, double y, double z) {
	return (2.0 + (4.0 * (x / y))) + ((z / y) * -4.0);
}
real(8) function code(x, y, z)
    real(8), intent (in) :: x
    real(8), intent (in) :: y
    real(8), intent (in) :: z
    code = 1.0d0 + ((4.0d0 * ((x + (y * 0.25d0)) - z)) / y)
end function
real(8) function code(x, y, z)
    real(8), intent (in) :: x
    real(8), intent (in) :: y
    real(8), intent (in) :: z
    code = (2.0d0 + (4.0d0 * (x / y))) + ((z / y) * (-4.0d0))
end function
public static double code(double x, double y, double z) {
	return 1.0 + ((4.0 * ((x + (y * 0.25)) - z)) / y);
}
public static double code(double x, double y, double z) {
	return (2.0 + (4.0 * (x / y))) + ((z / y) * -4.0);
}
def code(x, y, z):
	return 1.0 + ((4.0 * ((x + (y * 0.25)) - z)) / y)
def code(x, y, z):
	return (2.0 + (4.0 * (x / y))) + ((z / y) * -4.0)
function code(x, y, z)
	return Float64(1.0 + Float64(Float64(4.0 * Float64(Float64(x + Float64(y * 0.25)) - z)) / y))
end
function code(x, y, z)
	return Float64(Float64(2.0 + Float64(4.0 * Float64(x / y))) + Float64(Float64(z / y) * -4.0))
end
function tmp = code(x, y, z)
	tmp = 1.0 + ((4.0 * ((x + (y * 0.25)) - z)) / y);
end
function tmp = code(x, y, z)
	tmp = (2.0 + (4.0 * (x / y))) + ((z / y) * -4.0);
end
code[x_, y_, z_] := N[(1.0 + N[(N[(4.0 * N[(N[(x + N[(y * 0.25), $MachinePrecision]), $MachinePrecision] - z), $MachinePrecision]), $MachinePrecision] / y), $MachinePrecision]), $MachinePrecision]
code[x_, y_, z_] := N[(N[(2.0 + N[(4.0 * N[(x / y), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + N[(N[(z / y), $MachinePrecision] * -4.0), $MachinePrecision]), $MachinePrecision]
1 + \frac{4 \cdot \left(\left(x + y \cdot 0.25\right) - z\right)}{y}
\left(2 + 4 \cdot \frac{x}{y}\right) + \frac{z}{y} \cdot -4

Error?

Try it out?

Your Program's Arguments

Results

Enter valid numbers for all inputs

Derivation?

  1. Initial program 99.9%

    \[1 + \frac{4 \cdot \left(\left(x + y \cdot 0.25\right) - z\right)}{y} \]
  2. Simplified99.7%

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

    [Start]99.9

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

    associate-/l* [=>]99.7

    \[ 1 + \color{blue}{\frac{4}{\frac{y}{\left(x + y \cdot 0.25\right) - z}}} \]

    associate--l+ [=>]99.7

    \[ 1 + \frac{4}{\frac{y}{\color{blue}{x + \left(y \cdot 0.25 - z\right)}}} \]
  3. Taylor expanded in z around inf 100.0%

    \[\leadsto \color{blue}{1 + \left(-4 \cdot \frac{z}{y} + 4 \cdot \left(0.25 + \frac{x}{y}\right)\right)} \]
  4. Simplified100.0%

    \[\leadsto \color{blue}{\frac{z}{y} \cdot -4 + \left(2 + 4 \cdot \frac{x}{y}\right)} \]
    Proof

    [Start]100.0

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

    associate-+r+ [=>]100.0

    \[ \color{blue}{\left(1 + -4 \cdot \frac{z}{y}\right) + 4 \cdot \left(0.25 + \frac{x}{y}\right)} \]

    +-commutative [=>]100.0

    \[ \color{blue}{\left(-4 \cdot \frac{z}{y} + 1\right)} + 4 \cdot \left(0.25 + \frac{x}{y}\right) \]

    associate-+l+ [=>]100.0

    \[ \color{blue}{-4 \cdot \frac{z}{y} + \left(1 + 4 \cdot \left(0.25 + \frac{x}{y}\right)\right)} \]

    *-commutative [=>]100.0

    \[ \color{blue}{\frac{z}{y} \cdot -4} + \left(1 + 4 \cdot \left(0.25 + \frac{x}{y}\right)\right) \]

    distribute-lft-in [=>]100.0

    \[ \frac{z}{y} \cdot -4 + \left(1 + \color{blue}{\left(4 \cdot 0.25 + 4 \cdot \frac{x}{y}\right)}\right) \]

    metadata-eval [=>]100.0

    \[ \frac{z}{y} \cdot -4 + \left(1 + \left(\color{blue}{1} + 4 \cdot \frac{x}{y}\right)\right) \]

    associate-*r/ [=>]100.0

    \[ \frac{z}{y} \cdot -4 + \left(1 + \left(1 + \color{blue}{\frac{4 \cdot x}{y}}\right)\right) \]

    associate-*l/ [<=]99.9

    \[ \frac{z}{y} \cdot -4 + \left(1 + \left(1 + \color{blue}{\frac{4}{y} \cdot x}\right)\right) \]

    associate-+r+ [=>]99.9

    \[ \frac{z}{y} \cdot -4 + \color{blue}{\left(\left(1 + 1\right) + \frac{4}{y} \cdot x\right)} \]

    metadata-eval [=>]99.9

    \[ \frac{z}{y} \cdot -4 + \left(\color{blue}{2} + \frac{4}{y} \cdot x\right) \]

    associate-*l/ [=>]100.0

    \[ \frac{z}{y} \cdot -4 + \left(2 + \color{blue}{\frac{4 \cdot x}{y}}\right) \]

    associate-*r/ [<=]100.0

    \[ \frac{z}{y} \cdot -4 + \left(2 + \color{blue}{4 \cdot \frac{x}{y}}\right) \]
  5. Final simplification100.0%

    \[\leadsto \left(2 + 4 \cdot \frac{x}{y}\right) + \frac{z}{y} \cdot -4 \]

Alternatives

Alternative 1
Accuracy52.1%
Cost1640
\[\begin{array}{l} t_0 := \frac{z}{y} \cdot -4\\ t_1 := 4 \cdot \frac{x}{y}\\ \mathbf{if}\;z \leq -1.6 \cdot 10^{+112}:\\ \;\;\;\;t_0\\ \mathbf{elif}\;z \leq -7 \cdot 10^{+78}:\\ \;\;\;\;t_1\\ \mathbf{elif}\;z \leq -2.2 \cdot 10^{+52}:\\ \;\;\;\;t_0\\ \mathbf{elif}\;z \leq -1.6 \cdot 10^{-210}:\\ \;\;\;\;2\\ \mathbf{elif}\;z \leq -1.5 \cdot 10^{-263}:\\ \;\;\;\;t_1\\ \mathbf{elif}\;z \leq 1.7 \cdot 10^{-252}:\\ \;\;\;\;2\\ \mathbf{elif}\;z \leq 2 \cdot 10^{-222}:\\ \;\;\;\;t_1\\ \mathbf{elif}\;z \leq 3.35 \cdot 10^{-127}:\\ \;\;\;\;2\\ \mathbf{elif}\;z \leq 6.1 \cdot 10^{-102}:\\ \;\;\;\;t_1\\ \mathbf{elif}\;z \leq 1.95 \cdot 10^{+42}:\\ \;\;\;\;2\\ \mathbf{else}:\\ \;\;\;\;t_0\\ \end{array} \]
Alternative 2
Accuracy70.6%
Cost1242
\[\begin{array}{l} \mathbf{if}\;y \leq -1.48 \cdot 10^{+231}:\\ \;\;\;\;2\\ \mathbf{elif}\;y \leq -4.6 \cdot 10^{+173} \lor \neg \left(y \leq -1.25 \cdot 10^{+138}\right) \land \left(y \leq 340000000 \lor \neg \left(y \leq 3.2 \cdot 10^{+76}\right) \land y \leq 2.65 \cdot 10^{+113}\right):\\ \;\;\;\;4 \cdot \frac{x - z}{y}\\ \mathbf{else}:\\ \;\;\;\;2\\ \end{array} \]
Alternative 3
Accuracy82.8%
Cost1104
\[\begin{array}{l} t_0 := 1 + \frac{4}{\frac{y}{x - z}}\\ \mathbf{if}\;z \leq -1.7 \cdot 10^{+93}:\\ \;\;\;\;t_0\\ \mathbf{elif}\;z \leq -1.35 \cdot 10^{+17}:\\ \;\;\;\;2 + \frac{z}{y} \cdot -4\\ \mathbf{elif}\;z \leq -42000000000:\\ \;\;\;\;4 \cdot \frac{x - z}{y}\\ \mathbf{elif}\;z \leq 1.95 \cdot 10^{-75}:\\ \;\;\;\;2 + 4 \cdot \frac{x}{y}\\ \mathbf{else}:\\ \;\;\;\;t_0\\ \end{array} \]
Alternative 4
Accuracy81.5%
Cost978
\[\begin{array}{l} \mathbf{if}\;x \leq -1.45 \cdot 10^{+41} \lor \neg \left(x \leq 9.2 \cdot 10^{+61} \lor \neg \left(x \leq 1.85 \cdot 10^{+160}\right) \land x \leq 2.8 \cdot 10^{+189}\right):\\ \;\;\;\;4 \cdot \frac{x - z}{y}\\ \mathbf{else}:\\ \;\;\;\;2 + \frac{z}{y} \cdot -4\\ \end{array} \]
Alternative 5
Accuracy99.7%
Cost832
\[1 + \frac{4}{\frac{y}{x + \left(y \cdot 0.25 - z\right)}} \]
Alternative 6
Accuracy81.8%
Cost713
\[\begin{array}{l} \mathbf{if}\;z \leq -2.7 \cdot 10^{+54} \lor \neg \left(z \leq 1.06 \cdot 10^{+45}\right):\\ \;\;\;\;4 \cdot \frac{x - z}{y}\\ \mathbf{else}:\\ \;\;\;\;2 + 4 \cdot \frac{x}{y}\\ \end{array} \]
Alternative 7
Accuracy54.4%
Cost585
\[\begin{array}{l} \mathbf{if}\;z \leq -6.6 \cdot 10^{+53} \lor \neg \left(z \leq 7.8 \cdot 10^{+40}\right):\\ \;\;\;\;\frac{z}{y} \cdot -4\\ \mathbf{else}:\\ \;\;\;\;2\\ \end{array} \]
Alternative 8
Accuracy99.8%
Cost576
\[2 + \left(x - z\right) \cdot \frac{4}{y} \]
Alternative 9
Accuracy43.4%
Cost64
\[2 \]

Error

Reproduce?

herbie shell --seed 2023144 
(FPCore (x y z)
  :name "Data.Array.Repa.Algorithms.ColorRamp:rampColorHotToCold from repa-algorithms-3.4.0.1, C"
  :precision binary64
  (+ 1.0 (/ (* 4.0 (- (+ x (* y 0.25)) z)) y)))