
(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 (fma (- x y) (/ 4.0 z) -2.0))
double code(double x, double y, double z) {
return fma((x - y), (4.0 / z), -2.0);
}
function code(x, y, z) return fma(Float64(x - y), Float64(4.0 / z), -2.0) end
code[x_, y_, z_] := N[(N[(x - y), $MachinePrecision] * N[(4.0 / z), $MachinePrecision] + -2.0), $MachinePrecision]
\begin{array}{l}
\\
\mathsf{fma}\left(x - y, \frac{4}{z}, -2\right)
\end{array}
Initial program 99.2%
*-commutative99.2%
associate-/l*100.0%
div-sub100.0%
*-lft-identity100.0%
metadata-eval100.0%
associate-/l*99.9%
associate-/r/99.9%
fma-neg99.9%
metadata-eval99.9%
/-rgt-identity99.9%
associate-/r/99.9%
distribute-rgt-neg-in99.9%
Simplified99.9%
Final simplification99.9%
(FPCore (x y z)
:precision binary64
(let* ((t_0 (* -4.0 (/ y z))) (t_1 (* 4.0 (/ x z))))
(if (<= z -3.1e+60)
-2.0
(if (<= z -2.65e-230)
t_1
(if (<= z 2.02e-187)
t_0
(if (<= z 1.85e-42)
t_1
(if (<= z 2.32e+86) t_0 (if (<= z 3.7e+104) t_1 -2.0))))))))
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 (z <= -3.1e+60) {
tmp = -2.0;
} else if (z <= -2.65e-230) {
tmp = t_1;
} else if (z <= 2.02e-187) {
tmp = t_0;
} else if (z <= 1.85e-42) {
tmp = t_1;
} else if (z <= 2.32e+86) {
tmp = t_0;
} else if (z <= 3.7e+104) {
tmp = t_1;
} 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) :: t_0
real(8) :: t_1
real(8) :: tmp
t_0 = (-4.0d0) * (y / z)
t_1 = 4.0d0 * (x / z)
if (z <= (-3.1d+60)) then
tmp = -2.0d0
else if (z <= (-2.65d-230)) then
tmp = t_1
else if (z <= 2.02d-187) then
tmp = t_0
else if (z <= 1.85d-42) then
tmp = t_1
else if (z <= 2.32d+86) then
tmp = t_0
else if (z <= 3.7d+104) then
tmp = t_1
else
tmp = -2.0d0
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 (z <= -3.1e+60) {
tmp = -2.0;
} else if (z <= -2.65e-230) {
tmp = t_1;
} else if (z <= 2.02e-187) {
tmp = t_0;
} else if (z <= 1.85e-42) {
tmp = t_1;
} else if (z <= 2.32e+86) {
tmp = t_0;
} else if (z <= 3.7e+104) {
tmp = t_1;
} else {
tmp = -2.0;
}
return tmp;
}
def code(x, y, z): t_0 = -4.0 * (y / z) t_1 = 4.0 * (x / z) tmp = 0 if z <= -3.1e+60: tmp = -2.0 elif z <= -2.65e-230: tmp = t_1 elif z <= 2.02e-187: tmp = t_0 elif z <= 1.85e-42: tmp = t_1 elif z <= 2.32e+86: tmp = t_0 elif z <= 3.7e+104: tmp = t_1 else: tmp = -2.0 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 (z <= -3.1e+60) tmp = -2.0; elseif (z <= -2.65e-230) tmp = t_1; elseif (z <= 2.02e-187) tmp = t_0; elseif (z <= 1.85e-42) tmp = t_1; elseif (z <= 2.32e+86) tmp = t_0; elseif (z <= 3.7e+104) tmp = t_1; else tmp = -2.0; 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 (z <= -3.1e+60) tmp = -2.0; elseif (z <= -2.65e-230) tmp = t_1; elseif (z <= 2.02e-187) tmp = t_0; elseif (z <= 1.85e-42) tmp = t_1; elseif (z <= 2.32e+86) tmp = t_0; elseif (z <= 3.7e+104) tmp = t_1; else tmp = -2.0; 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[z, -3.1e+60], -2.0, If[LessEqual[z, -2.65e-230], t$95$1, If[LessEqual[z, 2.02e-187], t$95$0, If[LessEqual[z, 1.85e-42], t$95$1, If[LessEqual[z, 2.32e+86], t$95$0, If[LessEqual[z, 3.7e+104], t$95$1, -2.0]]]]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := -4 \cdot \frac{y}{z}\\
t_1 := 4 \cdot \frac{x}{z}\\
\mathbf{if}\;z \leq -3.1 \cdot 10^{+60}:\\
\;\;\;\;-2\\
\mathbf{elif}\;z \leq -2.65 \cdot 10^{-230}:\\
\;\;\;\;t_1\\
\mathbf{elif}\;z \leq 2.02 \cdot 10^{-187}:\\
\;\;\;\;t_0\\
\mathbf{elif}\;z \leq 1.85 \cdot 10^{-42}:\\
\;\;\;\;t_1\\
\mathbf{elif}\;z \leq 2.32 \cdot 10^{+86}:\\
\;\;\;\;t_0\\
\mathbf{elif}\;z \leq 3.7 \cdot 10^{+104}:\\
\;\;\;\;t_1\\
\mathbf{else}:\\
\;\;\;\;-2\\
\end{array}
\end{array}
if z < -3.1000000000000001e60 or 3.6999999999999998e104 < z Initial program 98.1%
associate-*l/99.7%
sub-neg99.7%
distribute-rgt-neg-in99.7%
metadata-eval99.7%
Simplified99.7%
Taylor expanded in z around inf 75.9%
if -3.1000000000000001e60 < z < -2.6499999999999999e-230 or 2.0199999999999999e-187 < z < 1.8500000000000001e-42 or 2.31999999999999998e86 < z < 3.6999999999999998e104Initial program 100.0%
associate-*l/99.9%
sub-neg99.9%
distribute-rgt-neg-in99.9%
metadata-eval99.9%
Simplified99.9%
Taylor expanded in x around inf 55.6%
if -2.6499999999999999e-230 < z < 2.0199999999999999e-187 or 1.8500000000000001e-42 < z < 2.31999999999999998e86Initial program 100.0%
associate-*l/99.8%
sub-neg99.8%
distribute-rgt-neg-in99.8%
metadata-eval99.8%
Simplified99.8%
Taylor expanded in y around inf 59.1%
Final simplification64.6%
(FPCore (x y z) :precision binary64 (if (or (<= z -5.3e+62) (not (<= z 2.85e+106))) (- (* -4.0 (/ y z)) 2.0) (* 4.0 (/ (- x y) z))))
double code(double x, double y, double z) {
double tmp;
if ((z <= -5.3e+62) || !(z <= 2.85e+106)) {
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 ((z <= (-5.3d+62)) .or. (.not. (z <= 2.85d+106))) 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 ((z <= -5.3e+62) || !(z <= 2.85e+106)) {
tmp = (-4.0 * (y / z)) - 2.0;
} else {
tmp = 4.0 * ((x - y) / z);
}
return tmp;
}
def code(x, y, z): tmp = 0 if (z <= -5.3e+62) or not (z <= 2.85e+106): 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 ((z <= -5.3e+62) || !(z <= 2.85e+106)) 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 ((z <= -5.3e+62) || ~((z <= 2.85e+106))) tmp = (-4.0 * (y / z)) - 2.0; else tmp = 4.0 * ((x - y) / z); end tmp_2 = tmp; end
code[x_, y_, z_] := If[Or[LessEqual[z, -5.3e+62], N[Not[LessEqual[z, 2.85e+106]], $MachinePrecision]], 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}\;z \leq -5.3 \cdot 10^{+62} \lor \neg \left(z \leq 2.85 \cdot 10^{+106}\right):\\
\;\;\;\;-4 \cdot \frac{y}{z} - 2\\
\mathbf{else}:\\
\;\;\;\;4 \cdot \frac{x - y}{z}\\
\end{array}
\end{array}
if z < -5.3000000000000003e62 or 2.8499999999999999e106 < z Initial program 98.1%
*-commutative98.1%
associate-/l*100.0%
div-sub100.0%
*-lft-identity100.0%
metadata-eval100.0%
associate-/l*100.0%
associate-/r/99.9%
fma-neg99.9%
metadata-eval99.9%
/-rgt-identity99.9%
associate-/r/99.9%
distribute-rgt-neg-in99.9%
Simplified99.9%
Taylor expanded in x around 0 86.9%
if -5.3000000000000003e62 < z < 2.8499999999999999e106Initial 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 89.5%
Final simplification88.5%
(FPCore (x y z) :precision binary64 (if (<= z -2.1e+138) -2.0 (if (<= z 7.2e+106) (* 4.0 (/ (- x y) z)) -2.0)))
double code(double x, double y, double z) {
double tmp;
if (z <= -2.1e+138) {
tmp = -2.0;
} else if (z <= 7.2e+106) {
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 <= (-2.1d+138)) then
tmp = -2.0d0
else if (z <= 7.2d+106) 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 <= -2.1e+138) {
tmp = -2.0;
} else if (z <= 7.2e+106) {
tmp = 4.0 * ((x - y) / z);
} else {
tmp = -2.0;
}
return tmp;
}
def code(x, y, z): tmp = 0 if z <= -2.1e+138: tmp = -2.0 elif z <= 7.2e+106: tmp = 4.0 * ((x - y) / z) else: tmp = -2.0 return tmp
function code(x, y, z) tmp = 0.0 if (z <= -2.1e+138) tmp = -2.0; elseif (z <= 7.2e+106) 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 <= -2.1e+138) tmp = -2.0; elseif (z <= 7.2e+106) tmp = 4.0 * ((x - y) / z); else tmp = -2.0; end tmp_2 = tmp; end
code[x_, y_, z_] := If[LessEqual[z, -2.1e+138], -2.0, If[LessEqual[z, 7.2e+106], N[(4.0 * N[(N[(x - y), $MachinePrecision] / z), $MachinePrecision]), $MachinePrecision], -2.0]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \leq -2.1 \cdot 10^{+138}:\\
\;\;\;\;-2\\
\mathbf{elif}\;z \leq 7.2 \cdot 10^{+106}:\\
\;\;\;\;4 \cdot \frac{x - y}{z}\\
\mathbf{else}:\\
\;\;\;\;-2\\
\end{array}
\end{array}
if z < -2.10000000000000007e138 or 7.2000000000000002e106 < z Initial program 97.9%
associate-*l/99.7%
sub-neg99.7%
distribute-rgt-neg-in99.7%
metadata-eval99.7%
Simplified99.7%
Taylor expanded in z around inf 79.5%
if -2.10000000000000007e138 < z < 7.2000000000000002e106Initial 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.8%
Final simplification84.8%
(FPCore (x y z) :precision binary64 (if (<= z -1.22e+62) (- (* -4.0 (/ y z)) 2.0) (if (<= z 5e+86) (* 4.0 (/ (- x y) z)) (- (* 4.0 (/ x z)) 2.0))))
double code(double x, double y, double z) {
double tmp;
if (z <= -1.22e+62) {
tmp = (-4.0 * (y / z)) - 2.0;
} else if (z <= 5e+86) {
tmp = 4.0 * ((x - y) / z);
} else {
tmp = (4.0 * (x / 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 (z <= (-1.22d+62)) then
tmp = ((-4.0d0) * (y / z)) - 2.0d0
else if (z <= 5d+86) then
tmp = 4.0d0 * ((x - y) / z)
else
tmp = (4.0d0 * (x / z)) - 2.0d0
end if
code = tmp
end function
public static double code(double x, double y, double z) {
double tmp;
if (z <= -1.22e+62) {
tmp = (-4.0 * (y / z)) - 2.0;
} else if (z <= 5e+86) {
tmp = 4.0 * ((x - y) / z);
} else {
tmp = (4.0 * (x / z)) - 2.0;
}
return tmp;
}
def code(x, y, z): tmp = 0 if z <= -1.22e+62: tmp = (-4.0 * (y / z)) - 2.0 elif z <= 5e+86: tmp = 4.0 * ((x - y) / z) else: tmp = (4.0 * (x / z)) - 2.0 return tmp
function code(x, y, z) tmp = 0.0 if (z <= -1.22e+62) tmp = Float64(Float64(-4.0 * Float64(y / z)) - 2.0); elseif (z <= 5e+86) tmp = Float64(4.0 * Float64(Float64(x - y) / z)); else tmp = Float64(Float64(4.0 * Float64(x / z)) - 2.0); end return tmp end
function tmp_2 = code(x, y, z) tmp = 0.0; if (z <= -1.22e+62) tmp = (-4.0 * (y / z)) - 2.0; elseif (z <= 5e+86) tmp = 4.0 * ((x - y) / z); else tmp = (4.0 * (x / z)) - 2.0; end tmp_2 = tmp; end
code[x_, y_, z_] := If[LessEqual[z, -1.22e+62], N[(N[(-4.0 * N[(y / z), $MachinePrecision]), $MachinePrecision] - 2.0), $MachinePrecision], If[LessEqual[z, 5e+86], N[(4.0 * N[(N[(x - y), $MachinePrecision] / z), $MachinePrecision]), $MachinePrecision], N[(N[(4.0 * N[(x / z), $MachinePrecision]), $MachinePrecision] - 2.0), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \leq -1.22 \cdot 10^{+62}:\\
\;\;\;\;-4 \cdot \frac{y}{z} - 2\\
\mathbf{elif}\;z \leq 5 \cdot 10^{+86}:\\
\;\;\;\;4 \cdot \frac{x - y}{z}\\
\mathbf{else}:\\
\;\;\;\;4 \cdot \frac{x}{z} - 2\\
\end{array}
\end{array}
if z < -1.21999999999999998e62Initial program 98.4%
*-commutative98.4%
associate-/l*100.0%
div-sub100.0%
*-lft-identity100.0%
metadata-eval100.0%
associate-/l*100.0%
associate-/r/99.9%
fma-neg99.9%
metadata-eval99.9%
/-rgt-identity99.9%
associate-/r/99.9%
distribute-rgt-neg-in99.9%
Simplified99.9%
Taylor expanded in x around 0 92.0%
if -1.21999999999999998e62 < z < 4.9999999999999998e86Initial 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 89.4%
if 4.9999999999999998e86 < z Initial program 97.9%
*-commutative97.9%
associate-/l*100.0%
div-sub100.0%
*-lft-identity100.0%
metadata-eval100.0%
associate-/l*100.0%
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 y around 0 95.7%
Final simplification91.1%
(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 99.2%
associate-*l/99.8%
sub-neg99.8%
distribute-rgt-neg-in99.8%
metadata-eval99.8%
Simplified99.8%
Final simplification99.8%
(FPCore (x y z) :precision binary64 (if (<= z -9.8e+61) -2.0 (if (<= z 7.4e+87) (* -4.0 (/ y z)) -2.0)))
double code(double x, double y, double z) {
double tmp;
if (z <= -9.8e+61) {
tmp = -2.0;
} else if (z <= 7.4e+87) {
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 <= (-9.8d+61)) then
tmp = -2.0d0
else if (z <= 7.4d+87) 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 <= -9.8e+61) {
tmp = -2.0;
} else if (z <= 7.4e+87) {
tmp = -4.0 * (y / z);
} else {
tmp = -2.0;
}
return tmp;
}
def code(x, y, z): tmp = 0 if z <= -9.8e+61: tmp = -2.0 elif z <= 7.4e+87: tmp = -4.0 * (y / z) else: tmp = -2.0 return tmp
function code(x, y, z) tmp = 0.0 if (z <= -9.8e+61) tmp = -2.0; elseif (z <= 7.4e+87) 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 <= -9.8e+61) tmp = -2.0; elseif (z <= 7.4e+87) tmp = -4.0 * (y / z); else tmp = -2.0; end tmp_2 = tmp; end
code[x_, y_, z_] := If[LessEqual[z, -9.8e+61], -2.0, If[LessEqual[z, 7.4e+87], N[(-4.0 * N[(y / z), $MachinePrecision]), $MachinePrecision], -2.0]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \leq -9.8 \cdot 10^{+61}:\\
\;\;\;\;-2\\
\mathbf{elif}\;z \leq 7.4 \cdot 10^{+87}:\\
\;\;\;\;-4 \cdot \frac{y}{z}\\
\mathbf{else}:\\
\;\;\;\;-2\\
\end{array}
\end{array}
if z < -9.8000000000000005e61 or 7.40000000000000005e87 < z Initial program 98.1%
associate-*l/99.7%
sub-neg99.7%
distribute-rgt-neg-in99.7%
metadata-eval99.7%
Simplified99.7%
Taylor expanded in z around inf 75.2%
if -9.8000000000000005e61 < z < 7.40000000000000005e87Initial program 100.0%
associate-*l/99.8%
sub-neg99.8%
distribute-rgt-neg-in99.8%
metadata-eval99.8%
Simplified99.8%
Taylor expanded in y around inf 46.8%
Final simplification58.2%
(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 99.2%
associate-*l/99.8%
sub-neg99.8%
distribute-rgt-neg-in99.8%
metadata-eval99.8%
Simplified99.8%
Taylor expanded in z around inf 37.1%
Final simplification37.1%
(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 2023310
(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))