
(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 7 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)) 2.0))
double code(double x, double y, double z) {
return (4.0 * ((x - y) / z)) - 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 = (4.0d0 * ((x - y) / z)) - 2.0d0
end function
public static double code(double x, double y, double z) {
return (4.0 * ((x - y) / z)) - 2.0;
}
def code(x, y, z): return (4.0 * ((x - y) / z)) - 2.0
function code(x, y, z) return Float64(Float64(4.0 * Float64(Float64(x - y) / z)) - 2.0) end
function tmp = code(x, y, z) tmp = (4.0 * ((x - y) / z)) - 2.0; end
code[x_, y_, z_] := N[(N[(4.0 * N[(N[(x - y), $MachinePrecision] / z), $MachinePrecision]), $MachinePrecision] - 2.0), $MachinePrecision]
\begin{array}{l}
\\
4 \cdot \frac{x - y}{z} - 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 0 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 -1.45e+15)
t_1
(if (<= x -1.05e-106)
-2.0
(if (<= x -2.1e-130)
t_0
(if (<= x -2.55e-257)
-2.0
(if (<= x -3e-293)
t_0
(if (<= x 6.6e-152)
-2.0
(if (<= x 2.4e-42) t_0 (if (<= x 2.05e+180) -2.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 <= -1.45e+15) {
tmp = t_1;
} else if (x <= -1.05e-106) {
tmp = -2.0;
} else if (x <= -2.1e-130) {
tmp = t_0;
} else if (x <= -2.55e-257) {
tmp = -2.0;
} else if (x <= -3e-293) {
tmp = t_0;
} else if (x <= 6.6e-152) {
tmp = -2.0;
} else if (x <= 2.4e-42) {
tmp = t_0;
} else if (x <= 2.05e+180) {
tmp = -2.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 <= (-1.45d+15)) then
tmp = t_1
else if (x <= (-1.05d-106)) then
tmp = -2.0d0
else if (x <= (-2.1d-130)) then
tmp = t_0
else if (x <= (-2.55d-257)) then
tmp = -2.0d0
else if (x <= (-3d-293)) then
tmp = t_0
else if (x <= 6.6d-152) then
tmp = -2.0d0
else if (x <= 2.4d-42) then
tmp = t_0
else if (x <= 2.05d+180) then
tmp = -2.0d0
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 <= -1.45e+15) {
tmp = t_1;
} else if (x <= -1.05e-106) {
tmp = -2.0;
} else if (x <= -2.1e-130) {
tmp = t_0;
} else if (x <= -2.55e-257) {
tmp = -2.0;
} else if (x <= -3e-293) {
tmp = t_0;
} else if (x <= 6.6e-152) {
tmp = -2.0;
} else if (x <= 2.4e-42) {
tmp = t_0;
} else if (x <= 2.05e+180) {
tmp = -2.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 <= -1.45e+15: tmp = t_1 elif x <= -1.05e-106: tmp = -2.0 elif x <= -2.1e-130: tmp = t_0 elif x <= -2.55e-257: tmp = -2.0 elif x <= -3e-293: tmp = t_0 elif x <= 6.6e-152: tmp = -2.0 elif x <= 2.4e-42: tmp = t_0 elif x <= 2.05e+180: tmp = -2.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 <= -1.45e+15) tmp = t_1; elseif (x <= -1.05e-106) tmp = -2.0; elseif (x <= -2.1e-130) tmp = t_0; elseif (x <= -2.55e-257) tmp = -2.0; elseif (x <= -3e-293) tmp = t_0; elseif (x <= 6.6e-152) tmp = -2.0; elseif (x <= 2.4e-42) tmp = t_0; elseif (x <= 2.05e+180) tmp = -2.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 <= -1.45e+15) tmp = t_1; elseif (x <= -1.05e-106) tmp = -2.0; elseif (x <= -2.1e-130) tmp = t_0; elseif (x <= -2.55e-257) tmp = -2.0; elseif (x <= -3e-293) tmp = t_0; elseif (x <= 6.6e-152) tmp = -2.0; elseif (x <= 2.4e-42) tmp = t_0; elseif (x <= 2.05e+180) tmp = -2.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, -1.45e+15], t$95$1, If[LessEqual[x, -1.05e-106], -2.0, If[LessEqual[x, -2.1e-130], t$95$0, If[LessEqual[x, -2.55e-257], -2.0, If[LessEqual[x, -3e-293], t$95$0, If[LessEqual[x, 6.6e-152], -2.0, If[LessEqual[x, 2.4e-42], t$95$0, If[LessEqual[x, 2.05e+180], -2.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 -1.45 \cdot 10^{+15}:\\
\;\;\;\;t_1\\
\mathbf{elif}\;x \leq -1.05 \cdot 10^{-106}:\\
\;\;\;\;-2\\
\mathbf{elif}\;x \leq -2.1 \cdot 10^{-130}:\\
\;\;\;\;t_0\\
\mathbf{elif}\;x \leq -2.55 \cdot 10^{-257}:\\
\;\;\;\;-2\\
\mathbf{elif}\;x \leq -3 \cdot 10^{-293}:\\
\;\;\;\;t_0\\
\mathbf{elif}\;x \leq 6.6 \cdot 10^{-152}:\\
\;\;\;\;-2\\
\mathbf{elif}\;x \leq 2.4 \cdot 10^{-42}:\\
\;\;\;\;t_0\\
\mathbf{elif}\;x \leq 2.05 \cdot 10^{+180}:\\
\;\;\;\;-2\\
\mathbf{else}:\\
\;\;\;\;t_1\\
\end{array}
\end{array}
if x < -1.45e15 or 2.05e180 < x Initial program 99.9%
associate-*l/99.7%
sub-neg99.7%
distribute-rgt-neg-in99.7%
metadata-eval99.7%
Simplified99.7%
Taylor expanded in x around inf 71.1%
if -1.45e15 < x < -1.05000000000000002e-106 or -2.10000000000000002e-130 < x < -2.54999999999999983e-257 or -3.0000000000000002e-293 < x < 6.59999999999999997e-152 or 2.40000000000000003e-42 < x < 2.05e180Initial 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 inf 60.7%
if -1.05000000000000002e-106 < x < -2.10000000000000002e-130 or -2.54999999999999983e-257 < x < -3.0000000000000002e-293 or 6.59999999999999997e-152 < x < 2.40000000000000003e-42Initial 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 77.9%
Final simplification66.8%
(FPCore (x y z) :precision binary64 (if (or (<= x -3.9e+183) (not (<= x 2.7e+180))) (* 4.0 (/ x z)) (- (* -4.0 (/ y z)) 2.0)))
double code(double x, double y, double z) {
double tmp;
if ((x <= -3.9e+183) || !(x <= 2.7e+180)) {
tmp = 4.0 * (x / 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 <= (-3.9d+183)) .or. (.not. (x <= 2.7d+180))) then
tmp = 4.0d0 * (x / 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 <= -3.9e+183) || !(x <= 2.7e+180)) {
tmp = 4.0 * (x / z);
} else {
tmp = (-4.0 * (y / z)) - 2.0;
}
return tmp;
}
def code(x, y, z): tmp = 0 if (x <= -3.9e+183) or not (x <= 2.7e+180): tmp = 4.0 * (x / z) else: tmp = (-4.0 * (y / z)) - 2.0 return tmp
function code(x, y, z) tmp = 0.0 if ((x <= -3.9e+183) || !(x <= 2.7e+180)) tmp = Float64(4.0 * Float64(x / 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 <= -3.9e+183) || ~((x <= 2.7e+180))) tmp = 4.0 * (x / z); else tmp = (-4.0 * (y / z)) - 2.0; end tmp_2 = tmp; end
code[x_, y_, z_] := If[Or[LessEqual[x, -3.9e+183], N[Not[LessEqual[x, 2.7e+180]], $MachinePrecision]], N[(4.0 * N[(x / 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 -3.9 \cdot 10^{+183} \lor \neg \left(x \leq 2.7 \cdot 10^{+180}\right):\\
\;\;\;\;4 \cdot \frac{x}{z}\\
\mathbf{else}:\\
\;\;\;\;-4 \cdot \frac{y}{z} - 2\\
\end{array}
\end{array}
if x < -3.8999999999999999e183 or 2.70000000000000016e180 < x Initial program 99.9%
associate-*l/99.7%
sub-neg99.7%
distribute-rgt-neg-in99.7%
metadata-eval99.7%
Simplified99.7%
Taylor expanded in x around inf 86.4%
if -3.8999999999999999e183 < x < 2.70000000000000016e180Initial 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 100.0%
Taylor expanded in x around 0 82.9%
Final simplification83.7%
(FPCore (x y z) :precision binary64 (if (or (<= x -7.2e+22) (not (<= x 0.135))) (- (* 4.0 (/ x z)) 2.0) (- (* -4.0 (/ y z)) 2.0)))
double code(double x, double y, double z) {
double tmp;
if ((x <= -7.2e+22) || !(x <= 0.135)) {
tmp = (4.0 * (x / z)) - 2.0;
} 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 <= (-7.2d+22)) .or. (.not. (x <= 0.135d0))) then
tmp = (4.0d0 * (x / z)) - 2.0d0
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 <= -7.2e+22) || !(x <= 0.135)) {
tmp = (4.0 * (x / z)) - 2.0;
} else {
tmp = (-4.0 * (y / z)) - 2.0;
}
return tmp;
}
def code(x, y, z): tmp = 0 if (x <= -7.2e+22) or not (x <= 0.135): tmp = (4.0 * (x / z)) - 2.0 else: tmp = (-4.0 * (y / z)) - 2.0 return tmp
function code(x, y, z) tmp = 0.0 if ((x <= -7.2e+22) || !(x <= 0.135)) tmp = Float64(Float64(4.0 * Float64(x / z)) - 2.0); 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 <= -7.2e+22) || ~((x <= 0.135))) tmp = (4.0 * (x / z)) - 2.0; else tmp = (-4.0 * (y / z)) - 2.0; end tmp_2 = tmp; end
code[x_, y_, z_] := If[Or[LessEqual[x, -7.2e+22], N[Not[LessEqual[x, 0.135]], $MachinePrecision]], N[(N[(4.0 * N[(x / z), $MachinePrecision]), $MachinePrecision] - 2.0), $MachinePrecision], N[(N[(-4.0 * N[(y / z), $MachinePrecision]), $MachinePrecision] - 2.0), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x \leq -7.2 \cdot 10^{+22} \lor \neg \left(x \leq 0.135\right):\\
\;\;\;\;4 \cdot \frac{x}{z} - 2\\
\mathbf{else}:\\
\;\;\;\;-4 \cdot \frac{y}{z} - 2\\
\end{array}
\end{array}
if x < -7.2e22 or 0.13500000000000001 < 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 100.0%
Taylor expanded in x around inf 85.6%
if -7.2e22 < x < 0.13500000000000001Initial 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 100.0%
Taylor expanded in x around 0 96.2%
Final simplification90.8%
(FPCore (x y z) :precision binary64 (if (<= y -1.5e+106) (/ 4.0 (/ z (- x y))) (if (<= y 1.24e+76) (- (* 4.0 (/ x z)) 2.0) (- (* -4.0 (/ y z)) 2.0))))
double code(double x, double y, double z) {
double tmp;
if (y <= -1.5e+106) {
tmp = 4.0 / (z / (x - y));
} else if (y <= 1.24e+76) {
tmp = (4.0 * (x / z)) - 2.0;
} 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 (y <= (-1.5d+106)) then
tmp = 4.0d0 / (z / (x - y))
else if (y <= 1.24d+76) then
tmp = (4.0d0 * (x / z)) - 2.0d0
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 (y <= -1.5e+106) {
tmp = 4.0 / (z / (x - y));
} else if (y <= 1.24e+76) {
tmp = (4.0 * (x / z)) - 2.0;
} else {
tmp = (-4.0 * (y / z)) - 2.0;
}
return tmp;
}
def code(x, y, z): tmp = 0 if y <= -1.5e+106: tmp = 4.0 / (z / (x - y)) elif y <= 1.24e+76: tmp = (4.0 * (x / z)) - 2.0 else: tmp = (-4.0 * (y / z)) - 2.0 return tmp
function code(x, y, z) tmp = 0.0 if (y <= -1.5e+106) tmp = Float64(4.0 / Float64(z / Float64(x - y))); elseif (y <= 1.24e+76) tmp = Float64(Float64(4.0 * Float64(x / z)) - 2.0); 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 (y <= -1.5e+106) tmp = 4.0 / (z / (x - y)); elseif (y <= 1.24e+76) tmp = (4.0 * (x / z)) - 2.0; else tmp = (-4.0 * (y / z)) - 2.0; end tmp_2 = tmp; end
code[x_, y_, z_] := If[LessEqual[y, -1.5e+106], N[(4.0 / N[(z / N[(x - y), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[y, 1.24e+76], N[(N[(4.0 * N[(x / z), $MachinePrecision]), $MachinePrecision] - 2.0), $MachinePrecision], N[(N[(-4.0 * N[(y / z), $MachinePrecision]), $MachinePrecision] - 2.0), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;y \leq -1.5 \cdot 10^{+106}:\\
\;\;\;\;\frac{4}{\frac{z}{x - y}}\\
\mathbf{elif}\;y \leq 1.24 \cdot 10^{+76}:\\
\;\;\;\;4 \cdot \frac{x}{z} - 2\\
\mathbf{else}:\\
\;\;\;\;-4 \cdot \frac{y}{z} - 2\\
\end{array}
\end{array}
if y < -1.5e106Initial program 100.0%
associate-*l/99.9%
sub-neg99.9%
distribute-rgt-neg-in99.9%
metadata-eval99.9%
Simplified99.9%
Taylor expanded in z around 0 93.3%
associate-*r/93.3%
associate-/l*93.2%
Simplified93.2%
if -1.5e106 < y < 1.24e76Initial 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 100.0%
Taylor expanded in x around inf 92.1%
if 1.24e76 < y Initial program 99.9%
associate-*l/99.8%
sub-neg99.8%
distribute-rgt-neg-in99.8%
metadata-eval99.8%
Simplified99.8%
Taylor expanded in z around 0 100.0%
Taylor expanded in x around 0 88.3%
Final simplification91.6%
(FPCore (x y z) :precision binary64 (if (<= z -75000.0) -2.0 (if (<= z 2.9e+113) (* -4.0 (/ y z)) -2.0)))
double code(double x, double y, double z) {
double tmp;
if (z <= -75000.0) {
tmp = -2.0;
} else if (z <= 2.9e+113) {
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 <= (-75000.0d0)) then
tmp = -2.0d0
else if (z <= 2.9d+113) 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 <= -75000.0) {
tmp = -2.0;
} else if (z <= 2.9e+113) {
tmp = -4.0 * (y / z);
} else {
tmp = -2.0;
}
return tmp;
}
def code(x, y, z): tmp = 0 if z <= -75000.0: tmp = -2.0 elif z <= 2.9e+113: tmp = -4.0 * (y / z) else: tmp = -2.0 return tmp
function code(x, y, z) tmp = 0.0 if (z <= -75000.0) tmp = -2.0; elseif (z <= 2.9e+113) 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 <= -75000.0) tmp = -2.0; elseif (z <= 2.9e+113) tmp = -4.0 * (y / z); else tmp = -2.0; end tmp_2 = tmp; end
code[x_, y_, z_] := If[LessEqual[z, -75000.0], -2.0, If[LessEqual[z, 2.9e+113], N[(-4.0 * N[(y / z), $MachinePrecision]), $MachinePrecision], -2.0]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \leq -75000:\\
\;\;\;\;-2\\
\mathbf{elif}\;z \leq 2.9 \cdot 10^{+113}:\\
\;\;\;\;-4 \cdot \frac{y}{z}\\
\mathbf{else}:\\
\;\;\;\;-2\\
\end{array}
\end{array}
if z < -75000 or 2.89999999999999984e113 < z Initial program 99.9%
associate-*l/99.6%
sub-neg99.6%
distribute-rgt-neg-in99.6%
metadata-eval99.6%
Simplified99.6%
Taylor expanded in z around inf 70.6%
if -75000 < z < 2.89999999999999984e113Initial program 100.0%
associate-*l/99.9%
sub-neg99.9%
distribute-rgt-neg-in99.9%
metadata-eval99.9%
Simplified99.9%
Taylor expanded in y around inf 44.9%
Final simplification56.1%
(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 39.3%
Final simplification39.3%
(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 2023230
(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))