
(FPCore (x y z) :precision binary64 (/ (* 4.0 (- (- x y) (* z 0.5))) z))
double code(double x, double y, double z) {
return (4.0 * ((x - y) - (z * 0.5))) / z;
}
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) - (z * 0.5d0))) / z
end function
public static double code(double x, double y, double z) {
return (4.0 * ((x - y) - (z * 0.5))) / z;
}
def code(x, y, z): return (4.0 * ((x - y) - (z * 0.5))) / z
function code(x, y, z) return Float64(Float64(4.0 * Float64(Float64(x - y) - Float64(z * 0.5))) / z) end
function tmp = code(x, y, z) tmp = (4.0 * ((x - y) - (z * 0.5))) / z; end
code[x_, y_, z_] := N[(N[(4.0 * N[(N[(x - y), $MachinePrecision] - N[(z * 0.5), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / z), $MachinePrecision]
\begin{array}{l}
\\
\frac{4 \cdot \left(\left(x - y\right) - z \cdot 0.5\right)}{z}
\end{array}
Sampling outcomes in binary64 precision:
Herbie found 8 alternatives:
| Alternative | Accuracy | Speedup |
|---|
(FPCore (x y z) :precision binary64 (/ (* 4.0 (- (- x y) (* z 0.5))) z))
double code(double x, double y, double z) {
return (4.0 * ((x - y) - (z * 0.5))) / z;
}
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) - (z * 0.5d0))) / z
end function
public static double code(double x, double y, double z) {
return (4.0 * ((x - y) - (z * 0.5))) / z;
}
def code(x, y, z): return (4.0 * ((x - y) - (z * 0.5))) / z
function code(x, y, z) return Float64(Float64(4.0 * Float64(Float64(x - y) - Float64(z * 0.5))) / z) end
function tmp = code(x, y, z) tmp = (4.0 * ((x - y) - (z * 0.5))) / z; end
code[x_, y_, z_] := N[(N[(4.0 * N[(N[(x - y), $MachinePrecision] - N[(z * 0.5), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / z), $MachinePrecision]
\begin{array}{l}
\\
\frac{4 \cdot \left(\left(x - y\right) - z \cdot 0.5\right)}{z}
\end{array}
(FPCore (x y z) :precision binary64 (/ (* 4.0 (- (- x y) (* z 0.5))) z))
double code(double x, double y, double z) {
return (4.0 * ((x - y) - (z * 0.5))) / z;
}
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) - (z * 0.5d0))) / z
end function
public static double code(double x, double y, double z) {
return (4.0 * ((x - y) - (z * 0.5))) / z;
}
def code(x, y, z): return (4.0 * ((x - y) - (z * 0.5))) / z
function code(x, y, z) return Float64(Float64(4.0 * Float64(Float64(x - y) - Float64(z * 0.5))) / z) end
function tmp = code(x, y, z) tmp = (4.0 * ((x - y) - (z * 0.5))) / z; end
code[x_, y_, z_] := N[(N[(4.0 * N[(N[(x - y), $MachinePrecision] - N[(z * 0.5), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / z), $MachinePrecision]
\begin{array}{l}
\\
\frac{4 \cdot \left(\left(x - y\right) - z \cdot 0.5\right)}{z}
\end{array}
Initial program 100.0%
Final simplification100.0%
(FPCore (x y z)
:precision binary64
(let* ((t_0 (* -4.0 (/ y z))) (t_1 (* 4.0 (/ x z))))
(if (<= x -2.2e+105)
t_1
(if (<= x -3.9e-50)
-2.0
(if (<= x 3.2e-284)
t_0
(if (<= x 3.75e-84) -2.0 (if (<= x 1.25e+133) t_0 t_1)))))))
double code(double x, double y, double z) {
double t_0 = -4.0 * (y / z);
double t_1 = 4.0 * (x / z);
double tmp;
if (x <= -2.2e+105) {
tmp = t_1;
} else if (x <= -3.9e-50) {
tmp = -2.0;
} else if (x <= 3.2e-284) {
tmp = t_0;
} else if (x <= 3.75e-84) {
tmp = -2.0;
} else if (x <= 1.25e+133) {
tmp = t_0;
} else {
tmp = t_1;
}
return tmp;
}
real(8) function code(x, y, z)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8) :: t_0
real(8) :: t_1
real(8) :: tmp
t_0 = (-4.0d0) * (y / z)
t_1 = 4.0d0 * (x / z)
if (x <= (-2.2d+105)) then
tmp = t_1
else if (x <= (-3.9d-50)) then
tmp = -2.0d0
else if (x <= 3.2d-284) then
tmp = t_0
else if (x <= 3.75d-84) then
tmp = -2.0d0
else if (x <= 1.25d+133) then
tmp = t_0
else
tmp = t_1
end if
code = tmp
end function
public static double code(double x, double y, double z) {
double t_0 = -4.0 * (y / z);
double t_1 = 4.0 * (x / z);
double tmp;
if (x <= -2.2e+105) {
tmp = t_1;
} else if (x <= -3.9e-50) {
tmp = -2.0;
} else if (x <= 3.2e-284) {
tmp = t_0;
} else if (x <= 3.75e-84) {
tmp = -2.0;
} else if (x <= 1.25e+133) {
tmp = t_0;
} else {
tmp = t_1;
}
return tmp;
}
def code(x, y, z): t_0 = -4.0 * (y / z) t_1 = 4.0 * (x / z) tmp = 0 if x <= -2.2e+105: tmp = t_1 elif x <= -3.9e-50: tmp = -2.0 elif x <= 3.2e-284: tmp = t_0 elif x <= 3.75e-84: tmp = -2.0 elif x <= 1.25e+133: tmp = t_0 else: tmp = t_1 return tmp
function code(x, y, z) t_0 = Float64(-4.0 * Float64(y / z)) t_1 = Float64(4.0 * Float64(x / z)) tmp = 0.0 if (x <= -2.2e+105) tmp = t_1; elseif (x <= -3.9e-50) tmp = -2.0; elseif (x <= 3.2e-284) tmp = t_0; elseif (x <= 3.75e-84) tmp = -2.0; elseif (x <= 1.25e+133) tmp = t_0; else tmp = t_1; end return tmp end
function tmp_2 = code(x, y, z) t_0 = -4.0 * (y / z); t_1 = 4.0 * (x / z); tmp = 0.0; if (x <= -2.2e+105) tmp = t_1; elseif (x <= -3.9e-50) tmp = -2.0; elseif (x <= 3.2e-284) tmp = t_0; elseif (x <= 3.75e-84) tmp = -2.0; elseif (x <= 1.25e+133) tmp = t_0; else tmp = t_1; end tmp_2 = tmp; end
code[x_, y_, z_] := Block[{t$95$0 = N[(-4.0 * N[(y / z), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$1 = N[(4.0 * N[(x / z), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[x, -2.2e+105], t$95$1, If[LessEqual[x, -3.9e-50], -2.0, If[LessEqual[x, 3.2e-284], t$95$0, If[LessEqual[x, 3.75e-84], -2.0, If[LessEqual[x, 1.25e+133], t$95$0, t$95$1]]]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := -4 \cdot \frac{y}{z}\\
t_1 := 4 \cdot \frac{x}{z}\\
\mathbf{if}\;x \leq -2.2 \cdot 10^{+105}:\\
\;\;\;\;t_1\\
\mathbf{elif}\;x \leq -3.9 \cdot 10^{-50}:\\
\;\;\;\;-2\\
\mathbf{elif}\;x \leq 3.2 \cdot 10^{-284}:\\
\;\;\;\;t_0\\
\mathbf{elif}\;x \leq 3.75 \cdot 10^{-84}:\\
\;\;\;\;-2\\
\mathbf{elif}\;x \leq 1.25 \cdot 10^{+133}:\\
\;\;\;\;t_0\\
\mathbf{else}:\\
\;\;\;\;t_1\\
\end{array}
\end{array}
if x < -2.20000000000000007e105 or 1.2499999999999999e133 < x Initial program 100.0%
associate-*l/99.7%
sub-neg99.7%
distribute-rgt-neg-in99.7%
metadata-eval99.7%
Simplified99.7%
Taylor expanded in x around inf 83.6%
if -2.20000000000000007e105 < x < -3.90000000000000021e-50 or 3.20000000000000024e-284 < x < 3.75000000000000013e-84Initial program 99.9%
associate-*l/99.7%
sub-neg99.7%
distribute-rgt-neg-in99.7%
metadata-eval99.7%
Simplified99.7%
Taylor expanded in z around inf 61.0%
if -3.90000000000000021e-50 < x < 3.20000000000000024e-284 or 3.75000000000000013e-84 < x < 1.2499999999999999e133Initial program 100.0%
associate-*l/99.7%
sub-neg99.7%
distribute-rgt-neg-in99.7%
metadata-eval99.7%
Simplified99.7%
Taylor expanded in y around inf 58.6%
Final simplification66.8%
(FPCore (x y z) :precision binary64 (if (or (<= x -9e+108) (not (<= x 108000000000.0))) (* 4.0 (/ (- x y) z)) (- (* -4.0 (/ y z)) 2.0)))
double code(double x, double y, double z) {
double tmp;
if ((x <= -9e+108) || !(x <= 108000000000.0)) {
tmp = 4.0 * ((x - y) / z);
} else {
tmp = (-4.0 * (y / z)) - 2.0;
}
return tmp;
}
real(8) function code(x, y, z)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8) :: tmp
if ((x <= (-9d+108)) .or. (.not. (x <= 108000000000.0d0))) then
tmp = 4.0d0 * ((x - y) / z)
else
tmp = ((-4.0d0) * (y / z)) - 2.0d0
end if
code = tmp
end function
public static double code(double x, double y, double z) {
double tmp;
if ((x <= -9e+108) || !(x <= 108000000000.0)) {
tmp = 4.0 * ((x - y) / z);
} else {
tmp = (-4.0 * (y / z)) - 2.0;
}
return tmp;
}
def code(x, y, z): tmp = 0 if (x <= -9e+108) or not (x <= 108000000000.0): tmp = 4.0 * ((x - y) / z) else: tmp = (-4.0 * (y / z)) - 2.0 return tmp
function code(x, y, z) tmp = 0.0 if ((x <= -9e+108) || !(x <= 108000000000.0)) tmp = Float64(4.0 * Float64(Float64(x - y) / z)); else tmp = Float64(Float64(-4.0 * Float64(y / z)) - 2.0); end return tmp end
function tmp_2 = code(x, y, z) tmp = 0.0; if ((x <= -9e+108) || ~((x <= 108000000000.0))) tmp = 4.0 * ((x - y) / z); else tmp = (-4.0 * (y / z)) - 2.0; end tmp_2 = tmp; end
code[x_, y_, z_] := If[Or[LessEqual[x, -9e+108], N[Not[LessEqual[x, 108000000000.0]], $MachinePrecision]], N[(4.0 * N[(N[(x - y), $MachinePrecision] / z), $MachinePrecision]), $MachinePrecision], N[(N[(-4.0 * N[(y / z), $MachinePrecision]), $MachinePrecision] - 2.0), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x \leq -9 \cdot 10^{+108} \lor \neg \left(x \leq 108000000000\right):\\
\;\;\;\;4 \cdot \frac{x - y}{z}\\
\mathbf{else}:\\
\;\;\;\;-4 \cdot \frac{y}{z} - 2\\
\end{array}
\end{array}
if x < -9e108 or 1.08e11 < x Initial program 100.0%
associate-*l/99.7%
sub-neg99.7%
distribute-rgt-neg-in99.7%
metadata-eval99.7%
Simplified99.7%
Taylor expanded in z around 0 87.3%
if -9e108 < x < 1.08e11Initial program 100.0%
*-commutative100.0%
associate-/l*100.0%
div-sub100.0%
*-lft-identity100.0%
metadata-eval100.0%
associate-/l*99.9%
associate-/r/99.8%
fma-neg99.8%
metadata-eval99.8%
/-rgt-identity99.8%
associate-/r/99.8%
distribute-rgt-neg-in99.8%
Simplified99.8%
Taylor expanded in x around 0 89.9%
Final simplification88.9%
(FPCore (x y z) :precision binary64 (if (<= z -1.75e+96) -2.0 (if (<= z 1.1e+221) (* 4.0 (/ (- x y) z)) -2.0)))
double code(double x, double y, double z) {
double tmp;
if (z <= -1.75e+96) {
tmp = -2.0;
} else if (z <= 1.1e+221) {
tmp = 4.0 * ((x - y) / z);
} else {
tmp = -2.0;
}
return tmp;
}
real(8) function code(x, y, z)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8) :: tmp
if (z <= (-1.75d+96)) then
tmp = -2.0d0
else if (z <= 1.1d+221) then
tmp = 4.0d0 * ((x - y) / z)
else
tmp = -2.0d0
end if
code = tmp
end function
public static double code(double x, double y, double z) {
double tmp;
if (z <= -1.75e+96) {
tmp = -2.0;
} else if (z <= 1.1e+221) {
tmp = 4.0 * ((x - y) / z);
} else {
tmp = -2.0;
}
return tmp;
}
def code(x, y, z): tmp = 0 if z <= -1.75e+96: tmp = -2.0 elif z <= 1.1e+221: tmp = 4.0 * ((x - y) / z) else: tmp = -2.0 return tmp
function code(x, y, z) tmp = 0.0 if (z <= -1.75e+96) tmp = -2.0; elseif (z <= 1.1e+221) tmp = Float64(4.0 * Float64(Float64(x - y) / z)); else tmp = -2.0; end return tmp end
function tmp_2 = code(x, y, z) tmp = 0.0; if (z <= -1.75e+96) tmp = -2.0; elseif (z <= 1.1e+221) tmp = 4.0 * ((x - y) / z); else tmp = -2.0; end tmp_2 = tmp; end
code[x_, y_, z_] := If[LessEqual[z, -1.75e+96], -2.0, If[LessEqual[z, 1.1e+221], N[(4.0 * N[(N[(x - y), $MachinePrecision] / z), $MachinePrecision]), $MachinePrecision], -2.0]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \leq -1.75 \cdot 10^{+96}:\\
\;\;\;\;-2\\
\mathbf{elif}\;z \leq 1.1 \cdot 10^{+221}:\\
\;\;\;\;4 \cdot \frac{x - y}{z}\\
\mathbf{else}:\\
\;\;\;\;-2\\
\end{array}
\end{array}
if z < -1.7499999999999999e96 or 1.1e221 < z Initial program 100.0%
associate-*l/99.7%
sub-neg99.7%
distribute-rgt-neg-in99.7%
metadata-eval99.7%
Simplified99.7%
Taylor expanded in z around inf 84.7%
if -1.7499999999999999e96 < z < 1.1e221Initial program 100.0%
associate-*l/99.7%
sub-neg99.7%
distribute-rgt-neg-in99.7%
metadata-eval99.7%
Simplified99.7%
Taylor expanded in z around 0 82.3%
Final simplification82.8%
(FPCore (x y z) :precision binary64 (if (<= x -5e+86) (- (* 4.0 (/ x z)) 2.0) (if (<= x 2.4e+16) (- (* -4.0 (/ y z)) 2.0) (* 4.0 (/ (- x y) z)))))
double code(double x, double y, double z) {
double tmp;
if (x <= -5e+86) {
tmp = (4.0 * (x / z)) - 2.0;
} else if (x <= 2.4e+16) {
tmp = (-4.0 * (y / z)) - 2.0;
} else {
tmp = 4.0 * ((x - y) / z);
}
return tmp;
}
real(8) function code(x, y, z)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8) :: tmp
if (x <= (-5d+86)) then
tmp = (4.0d0 * (x / z)) - 2.0d0
else if (x <= 2.4d+16) then
tmp = ((-4.0d0) * (y / z)) - 2.0d0
else
tmp = 4.0d0 * ((x - y) / z)
end if
code = tmp
end function
public static double code(double x, double y, double z) {
double tmp;
if (x <= -5e+86) {
tmp = (4.0 * (x / z)) - 2.0;
} else if (x <= 2.4e+16) {
tmp = (-4.0 * (y / z)) - 2.0;
} else {
tmp = 4.0 * ((x - y) / z);
}
return tmp;
}
def code(x, y, z): tmp = 0 if x <= -5e+86: tmp = (4.0 * (x / z)) - 2.0 elif x <= 2.4e+16: tmp = (-4.0 * (y / z)) - 2.0 else: tmp = 4.0 * ((x - y) / z) return tmp
function code(x, y, z) tmp = 0.0 if (x <= -5e+86) tmp = Float64(Float64(4.0 * Float64(x / z)) - 2.0); elseif (x <= 2.4e+16) tmp = Float64(Float64(-4.0 * Float64(y / z)) - 2.0); else tmp = Float64(4.0 * Float64(Float64(x - y) / z)); end return tmp end
function tmp_2 = code(x, y, z) tmp = 0.0; if (x <= -5e+86) tmp = (4.0 * (x / z)) - 2.0; elseif (x <= 2.4e+16) tmp = (-4.0 * (y / z)) - 2.0; else tmp = 4.0 * ((x - y) / z); end tmp_2 = tmp; end
code[x_, y_, z_] := If[LessEqual[x, -5e+86], N[(N[(4.0 * N[(x / z), $MachinePrecision]), $MachinePrecision] - 2.0), $MachinePrecision], If[LessEqual[x, 2.4e+16], N[(N[(-4.0 * N[(y / z), $MachinePrecision]), $MachinePrecision] - 2.0), $MachinePrecision], N[(4.0 * N[(N[(x - y), $MachinePrecision] / z), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x \leq -5 \cdot 10^{+86}:\\
\;\;\;\;4 \cdot \frac{x}{z} - 2\\
\mathbf{elif}\;x \leq 2.4 \cdot 10^{+16}:\\
\;\;\;\;-4 \cdot \frac{y}{z} - 2\\
\mathbf{else}:\\
\;\;\;\;4 \cdot \frac{x - y}{z}\\
\end{array}
\end{array}
if x < -4.9999999999999998e86Initial program 100.0%
*-commutative100.0%
associate-/l*100.0%
div-sub100.0%
*-lft-identity100.0%
metadata-eval100.0%
associate-/l*99.9%
associate-/r/99.7%
fma-neg99.7%
metadata-eval99.7%
/-rgt-identity99.7%
associate-/r/99.7%
distribute-rgt-neg-in99.7%
Simplified99.7%
Taylor expanded in y around 0 97.3%
if -4.9999999999999998e86 < x < 2.4e16Initial program 100.0%
*-commutative100.0%
associate-/l*100.0%
div-sub100.0%
*-lft-identity100.0%
metadata-eval100.0%
associate-/l*99.9%
associate-/r/99.8%
fma-neg99.8%
metadata-eval99.8%
/-rgt-identity99.8%
associate-/r/99.8%
distribute-rgt-neg-in99.8%
Simplified99.8%
Taylor expanded in x around 0 90.3%
if 2.4e16 < x Initial program 100.0%
associate-*l/99.8%
sub-neg99.8%
distribute-rgt-neg-in99.8%
metadata-eval99.8%
Simplified99.8%
Taylor expanded in z around 0 87.9%
Final simplification91.0%
(FPCore (x y z) :precision binary64 (* (/ 4.0 z) (+ (- x y) (* z -0.5))))
double code(double x, double y, double z) {
return (4.0 / z) * ((x - y) + (z * -0.5));
}
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 / z) * ((x - y) + (z * (-0.5d0)))
end function
public static double code(double x, double y, double z) {
return (4.0 / z) * ((x - y) + (z * -0.5));
}
def code(x, y, z): return (4.0 / z) * ((x - y) + (z * -0.5))
function code(x, y, z) return Float64(Float64(4.0 / z) * Float64(Float64(x - y) + Float64(z * -0.5))) end
function tmp = code(x, y, z) tmp = (4.0 / z) * ((x - y) + (z * -0.5)); end
code[x_, y_, z_] := N[(N[(4.0 / z), $MachinePrecision] * N[(N[(x - y), $MachinePrecision] + N[(z * -0.5), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
\frac{4}{z} \cdot \left(\left(x - y\right) + z \cdot -0.5\right)
\end{array}
Initial program 100.0%
associate-*l/99.7%
sub-neg99.7%
distribute-rgt-neg-in99.7%
metadata-eval99.7%
Simplified99.7%
Final simplification99.7%
(FPCore (x y z) :precision binary64 (if (<= z -2.25e+66) -2.0 (if (<= z 1.25e-21) (* -4.0 (/ y z)) -2.0)))
double code(double x, double y, double z) {
double tmp;
if (z <= -2.25e+66) {
tmp = -2.0;
} else if (z <= 1.25e-21) {
tmp = -4.0 * (y / z);
} else {
tmp = -2.0;
}
return tmp;
}
real(8) function code(x, y, z)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8) :: tmp
if (z <= (-2.25d+66)) then
tmp = -2.0d0
else if (z <= 1.25d-21) then
tmp = (-4.0d0) * (y / z)
else
tmp = -2.0d0
end if
code = tmp
end function
public static double code(double x, double y, double z) {
double tmp;
if (z <= -2.25e+66) {
tmp = -2.0;
} else if (z <= 1.25e-21) {
tmp = -4.0 * (y / z);
} else {
tmp = -2.0;
}
return tmp;
}
def code(x, y, z): tmp = 0 if z <= -2.25e+66: tmp = -2.0 elif z <= 1.25e-21: tmp = -4.0 * (y / z) else: tmp = -2.0 return tmp
function code(x, y, z) tmp = 0.0 if (z <= -2.25e+66) tmp = -2.0; elseif (z <= 1.25e-21) tmp = Float64(-4.0 * Float64(y / z)); else tmp = -2.0; end return tmp end
function tmp_2 = code(x, y, z) tmp = 0.0; if (z <= -2.25e+66) tmp = -2.0; elseif (z <= 1.25e-21) tmp = -4.0 * (y / z); else tmp = -2.0; end tmp_2 = tmp; end
code[x_, y_, z_] := If[LessEqual[z, -2.25e+66], -2.0, If[LessEqual[z, 1.25e-21], N[(-4.0 * N[(y / z), $MachinePrecision]), $MachinePrecision], -2.0]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \leq -2.25 \cdot 10^{+66}:\\
\;\;\;\;-2\\
\mathbf{elif}\;z \leq 1.25 \cdot 10^{-21}:\\
\;\;\;\;-4 \cdot \frac{y}{z}\\
\mathbf{else}:\\
\;\;\;\;-2\\
\end{array}
\end{array}
if z < -2.2499999999999999e66 or 1.24999999999999993e-21 < z Initial program 100.0%
associate-*l/99.7%
sub-neg99.7%
distribute-rgt-neg-in99.7%
metadata-eval99.7%
Simplified99.7%
Taylor expanded in z around inf 59.1%
if -2.2499999999999999e66 < z < 1.24999999999999993e-21Initial program 100.0%
associate-*l/99.7%
sub-neg99.7%
distribute-rgt-neg-in99.7%
metadata-eval99.7%
Simplified99.7%
Taylor expanded in y around inf 51.4%
Final simplification55.0%
(FPCore (x y z) :precision binary64 -2.0)
double code(double x, double y, double z) {
return -2.0;
}
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
end function
public static double code(double x, double y, double z) {
return -2.0;
}
def code(x, y, z): return -2.0
function code(x, y, z) return -2.0 end
function tmp = code(x, y, z) tmp = -2.0; end
code[x_, y_, z_] := -2.0
\begin{array}{l}
\\
-2
\end{array}
Initial program 100.0%
associate-*l/99.7%
sub-neg99.7%
distribute-rgt-neg-in99.7%
metadata-eval99.7%
Simplified99.7%
Taylor expanded in z around inf 32.5%
Final simplification32.5%
(FPCore (x y z) :precision binary64 (- (* 4.0 (/ x z)) (+ 2.0 (* 4.0 (/ y z)))))
double code(double x, double y, double z) {
return (4.0 * (x / z)) - (2.0 + (4.0 * (y / z)));
}
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 / z)) - (2.0d0 + (4.0d0 * (y / z)))
end function
public static double code(double x, double y, double z) {
return (4.0 * (x / z)) - (2.0 + (4.0 * (y / z)));
}
def code(x, y, z): return (4.0 * (x / z)) - (2.0 + (4.0 * (y / z)))
function code(x, y, z) return Float64(Float64(4.0 * Float64(x / z)) - Float64(2.0 + Float64(4.0 * Float64(y / z)))) end
function tmp = code(x, y, z) tmp = (4.0 * (x / z)) - (2.0 + (4.0 * (y / z))); end
code[x_, y_, z_] := N[(N[(4.0 * N[(x / z), $MachinePrecision]), $MachinePrecision] - N[(2.0 + N[(4.0 * N[(y / z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
4 \cdot \frac{x}{z} - \left(2 + 4 \cdot \frac{y}{z}\right)
\end{array}
herbie shell --seed 2023311
(FPCore (x y z)
:name "Data.Array.Repa.Algorithms.ColorRamp:rampColorHotToCold from repa-algorithms-3.4.0.1, B"
:precision binary64
:herbie-target
(- (* 4.0 (/ x z)) (+ 2.0 (* 4.0 (/ y z))))
(/ (* 4.0 (- (- x y) (* z 0.5))) z))