?

Average Error: 0.1 → 0.0
Time: 10.1s
Precision: binary64
Cost: 832

?

\[1 + \frac{4 \cdot \left(\left(x + y \cdot 0.25\right) - z\right)}{y} \]
\[\left(4 \cdot \frac{x}{y} + 2\right) - 4 \cdot \frac{z}{y} \]
(FPCore (x y z)
 :precision binary64
 (+ 1.0 (/ (* 4.0 (- (+ x (* y 0.25)) z)) y)))
(FPCore (x y z)
 :precision binary64
 (- (+ (* 4.0 (/ x y)) 2.0) (* 4.0 (/ z y))))
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 ((4.0 * (x / y)) + 2.0) - (4.0 * (z / y));
}
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 = ((4.0d0 * (x / y)) + 2.0d0) - (4.0d0 * (z / y))
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 ((4.0 * (x / y)) + 2.0) - (4.0 * (z / y));
}
def code(x, y, z):
	return 1.0 + ((4.0 * ((x + (y * 0.25)) - z)) / y)
def code(x, y, z):
	return ((4.0 * (x / y)) + 2.0) - (4.0 * (z / y))
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(Float64(4.0 * Float64(x / y)) + 2.0) - Float64(4.0 * Float64(z / y)))
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 = ((4.0 * (x / y)) + 2.0) - (4.0 * (z / y));
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[(N[(4.0 * N[(x / y), $MachinePrecision]), $MachinePrecision] + 2.0), $MachinePrecision] - N[(4.0 * N[(z / y), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
1 + \frac{4 \cdot \left(\left(x + y \cdot 0.25\right) - z\right)}{y}
\left(4 \cdot \frac{x}{y} + 2\right) - 4 \cdot \frac{z}{y}

Error?

Try it out?

Your Program's Arguments

Results

Enter valid numbers for all inputs

Derivation?

  1. Initial program 0.1

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

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

    [Start]0.1

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

    rational_best-simplify-73 [=>]0.1

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

    rational_best-simplify-63 [=>]0.1

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

    rational_best-simplify-1 [=>]0.1

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

    rational_best-simplify-3 [=>]0.1

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

    rational_best-simplify-75 [=>]0.1

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

    rational_best-simplify-58 [=>]0.1

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

    rational_best-simplify-1 [=>]0.1

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

    rational_best-simplify-1 [=>]0.1

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

    rational_best-simplify-53 [=>]0.1

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

    metadata-eval [=>]0.1

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

    metadata-eval [<=]0.1

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

    rational_best-simplify-61 [<=]0.1

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

    rational_best-simplify-1 [<=]0.1

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

    rational_best-simplify-11 [<=]0.1

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

    rational_best-simplify-13 [<=]0.1

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

    rational_best-simplify-64 [=>]0.1

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

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

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

    [Start]0.0

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

    rational_best-simplify-3 [=>]0.0

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

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

Alternatives

Alternative 1
Error18.7
Cost976
\[\begin{array}{l} t_0 := 4 \cdot \frac{x - z}{y}\\ \mathbf{if}\;y \leq -7.6 \cdot 10^{+28}:\\ \;\;\;\;2\\ \mathbf{elif}\;y \leq 2.8 \cdot 10^{+26}:\\ \;\;\;\;t_0\\ \mathbf{elif}\;y \leq 9.5 \cdot 10^{+64}:\\ \;\;\;\;2\\ \mathbf{elif}\;y \leq 1.8 \cdot 10^{+102}:\\ \;\;\;\;t_0\\ \mathbf{else}:\\ \;\;\;\;2\\ \end{array} \]
Alternative 2
Error11.8
Cost976
\[\begin{array}{l} t_0 := 2 - -4 \cdot \frac{x}{y}\\ t_1 := 4 \cdot \frac{x - z}{y}\\ \mathbf{if}\;z \leq -3.4 \cdot 10^{+125}:\\ \;\;\;\;t_1\\ \mathbf{elif}\;z \leq -8.5 \cdot 10^{+38}:\\ \;\;\;\;t_0\\ \mathbf{elif}\;z \leq -1.1 \cdot 10^{-13}:\\ \;\;\;\;t_1\\ \mathbf{elif}\;z \leq 4.6 \cdot 10^{+54}:\\ \;\;\;\;t_0\\ \mathbf{else}:\\ \;\;\;\;t_1\\ \end{array} \]
Alternative 3
Error8.5
Cost712
\[\begin{array}{l} t_0 := 2 - 4 \cdot \frac{z}{y}\\ \mathbf{if}\;z \leq -1.85 \cdot 10^{-28}:\\ \;\;\;\;t_0\\ \mathbf{elif}\;z \leq 2.95 \cdot 10^{+35}:\\ \;\;\;\;2 - -4 \cdot \frac{x}{y}\\ \mathbf{else}:\\ \;\;\;\;t_0\\ \end{array} \]
Alternative 4
Error0.1
Cost704
\[1 + \frac{y - \left(x - z\right) \cdot -4}{y} \]
Alternative 5
Error30.4
Cost584
\[\begin{array}{l} t_0 := 4 \cdot \frac{x}{y}\\ \mathbf{if}\;x \leq -1.75 \cdot 10^{+45}:\\ \;\;\;\;t_0\\ \mathbf{elif}\;x \leq 5.6 \cdot 10^{+120}:\\ \;\;\;\;2\\ \mathbf{else}:\\ \;\;\;\;t_0\\ \end{array} \]
Alternative 6
Error0.2
Cost576
\[2 - \frac{4}{y} \cdot \left(z - x\right) \]
Alternative 7
Error57.7
Cost64
\[1 \]
Alternative 8
Error36.8
Cost64
\[2 \]

Error

Reproduce?

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