
(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)))
double code(double x, double y, double z) {
return 4.0 * (((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 * (((x - y) / z) + (-0.5d0))
end function
public static double code(double x, double y, double z) {
return 4.0 * (((x - y) / z) + -0.5);
}
def code(x, y, z): return 4.0 * (((x - y) / z) + -0.5)
function code(x, y, z) return Float64(4.0 * Float64(Float64(Float64(x - y) / z) + -0.5)) end
function tmp = code(x, y, z) tmp = 4.0 * (((x - y) / z) + -0.5); end
code[x_, y_, z_] := N[(4.0 * N[(N[(N[(x - y), $MachinePrecision] / z), $MachinePrecision] + -0.5), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
4 \cdot \left(\frac{x - y}{z} + -0.5\right)
\end{array}
Initial program 100.0%
associate-/l*100.0%
div-sub100.0%
associate-*l/100.0%
*-inverses100.0%
metadata-eval100.0%
sub-neg100.0%
metadata-eval100.0%
Simplified100.0%
(FPCore (x y z)
:precision binary64
(if (<= z -9e+159)
-2.0
(if (<= z -2.25e-69)
(* 4.0 (/ x z))
(if (<= z 1.8e+88) (/ (* y -4.0) z) -2.0))))
double code(double x, double y, double z) {
double tmp;
if (z <= -9e+159) {
tmp = -2.0;
} else if (z <= -2.25e-69) {
tmp = 4.0 * (x / z);
} else if (z <= 1.8e+88) {
tmp = (y * -4.0) / 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 <= (-9d+159)) then
tmp = -2.0d0
else if (z <= (-2.25d-69)) then
tmp = 4.0d0 * (x / z)
else if (z <= 1.8d+88) then
tmp = (y * (-4.0d0)) / 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 <= -9e+159) {
tmp = -2.0;
} else if (z <= -2.25e-69) {
tmp = 4.0 * (x / z);
} else if (z <= 1.8e+88) {
tmp = (y * -4.0) / z;
} else {
tmp = -2.0;
}
return tmp;
}
def code(x, y, z): tmp = 0 if z <= -9e+159: tmp = -2.0 elif z <= -2.25e-69: tmp = 4.0 * (x / z) elif z <= 1.8e+88: tmp = (y * -4.0) / z else: tmp = -2.0 return tmp
function code(x, y, z) tmp = 0.0 if (z <= -9e+159) tmp = -2.0; elseif (z <= -2.25e-69) tmp = Float64(4.0 * Float64(x / z)); elseif (z <= 1.8e+88) tmp = Float64(Float64(y * -4.0) / z); else tmp = -2.0; end return tmp end
function tmp_2 = code(x, y, z) tmp = 0.0; if (z <= -9e+159) tmp = -2.0; elseif (z <= -2.25e-69) tmp = 4.0 * (x / z); elseif (z <= 1.8e+88) tmp = (y * -4.0) / z; else tmp = -2.0; end tmp_2 = tmp; end
code[x_, y_, z_] := If[LessEqual[z, -9e+159], -2.0, If[LessEqual[z, -2.25e-69], N[(4.0 * N[(x / z), $MachinePrecision]), $MachinePrecision], If[LessEqual[z, 1.8e+88], N[(N[(y * -4.0), $MachinePrecision] / z), $MachinePrecision], -2.0]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \leq -9 \cdot 10^{+159}:\\
\;\;\;\;-2\\
\mathbf{elif}\;z \leq -2.25 \cdot 10^{-69}:\\
\;\;\;\;4 \cdot \frac{x}{z}\\
\mathbf{elif}\;z \leq 1.8 \cdot 10^{+88}:\\
\;\;\;\;\frac{y \cdot -4}{z}\\
\mathbf{else}:\\
\;\;\;\;-2\\
\end{array}
\end{array}
if z < -9.00000000000000053e159 or 1.8000000000000001e88 < z Initial program 100.0%
Taylor expanded in z around inf 72.9%
if -9.00000000000000053e159 < z < -2.25000000000000005e-69Initial program 99.9%
Taylor expanded in x around inf 47.8%
if -2.25000000000000005e-69 < z < 1.8000000000000001e88Initial program 100.0%
Taylor expanded in y around inf 61.4%
*-commutative61.4%
associate-*l/61.4%
Simplified61.4%
(FPCore (x y z)
:precision binary64
(if (<= z -9e+159)
-2.0
(if (<= z -5.6e-70)
(* 4.0 (/ x z))
(if (<= z 8e+86) (* y (/ -4.0 z)) -2.0))))
double code(double x, double y, double z) {
double tmp;
if (z <= -9e+159) {
tmp = -2.0;
} else if (z <= -5.6e-70) {
tmp = 4.0 * (x / z);
} else if (z <= 8e+86) {
tmp = y * (-4.0 / 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 <= (-9d+159)) then
tmp = -2.0d0
else if (z <= (-5.6d-70)) then
tmp = 4.0d0 * (x / z)
else if (z <= 8d+86) then
tmp = y * ((-4.0d0) / 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 <= -9e+159) {
tmp = -2.0;
} else if (z <= -5.6e-70) {
tmp = 4.0 * (x / z);
} else if (z <= 8e+86) {
tmp = y * (-4.0 / z);
} else {
tmp = -2.0;
}
return tmp;
}
def code(x, y, z): tmp = 0 if z <= -9e+159: tmp = -2.0 elif z <= -5.6e-70: tmp = 4.0 * (x / z) elif z <= 8e+86: tmp = y * (-4.0 / z) else: tmp = -2.0 return tmp
function code(x, y, z) tmp = 0.0 if (z <= -9e+159) tmp = -2.0; elseif (z <= -5.6e-70) tmp = Float64(4.0 * Float64(x / z)); elseif (z <= 8e+86) tmp = Float64(y * Float64(-4.0 / z)); else tmp = -2.0; end return tmp end
function tmp_2 = code(x, y, z) tmp = 0.0; if (z <= -9e+159) tmp = -2.0; elseif (z <= -5.6e-70) tmp = 4.0 * (x / z); elseif (z <= 8e+86) tmp = y * (-4.0 / z); else tmp = -2.0; end tmp_2 = tmp; end
code[x_, y_, z_] := If[LessEqual[z, -9e+159], -2.0, If[LessEqual[z, -5.6e-70], N[(4.0 * N[(x / z), $MachinePrecision]), $MachinePrecision], If[LessEqual[z, 8e+86], N[(y * N[(-4.0 / z), $MachinePrecision]), $MachinePrecision], -2.0]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \leq -9 \cdot 10^{+159}:\\
\;\;\;\;-2\\
\mathbf{elif}\;z \leq -5.6 \cdot 10^{-70}:\\
\;\;\;\;4 \cdot \frac{x}{z}\\
\mathbf{elif}\;z \leq 8 \cdot 10^{+86}:\\
\;\;\;\;y \cdot \frac{-4}{z}\\
\mathbf{else}:\\
\;\;\;\;-2\\
\end{array}
\end{array}
if z < -9.00000000000000053e159 or 8.0000000000000001e86 < z Initial program 100.0%
Taylor expanded in z around inf 72.9%
if -9.00000000000000053e159 < z < -5.5999999999999998e-70Initial program 99.9%
Taylor expanded in x around inf 47.8%
if -5.5999999999999998e-70 < z < 8.0000000000000001e86Initial program 100.0%
Taylor expanded in z around 0 92.0%
*-commutative92.0%
associate-*l/92.0%
associate-/l*91.9%
Simplified91.9%
Taylor expanded in x around 0 61.4%
associate-*r/61.4%
metadata-eval61.4%
associate-*r*61.4%
neg-mul-161.4%
associate-*l/61.4%
*-commutative61.4%
distribute-lft-neg-out61.4%
distribute-rgt-neg-in61.4%
distribute-neg-frac61.4%
metadata-eval61.4%
Simplified61.4%
(FPCore (x y z) :precision binary64 (if (or (<= x -3.3e+61) (not (<= x 4.4e+26))) (+ (* x (/ 4.0 z)) -2.0) (* 4.0 (- -0.5 (/ y z)))))
double code(double x, double y, double z) {
double tmp;
if ((x <= -3.3e+61) || !(x <= 4.4e+26)) {
tmp = (x * (4.0 / z)) + -2.0;
} else {
tmp = 4.0 * (-0.5 - (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 <= (-3.3d+61)) .or. (.not. (x <= 4.4d+26))) then
tmp = (x * (4.0d0 / z)) + (-2.0d0)
else
tmp = 4.0d0 * ((-0.5d0) - (y / z))
end if
code = tmp
end function
public static double code(double x, double y, double z) {
double tmp;
if ((x <= -3.3e+61) || !(x <= 4.4e+26)) {
tmp = (x * (4.0 / z)) + -2.0;
} else {
tmp = 4.0 * (-0.5 - (y / z));
}
return tmp;
}
def code(x, y, z): tmp = 0 if (x <= -3.3e+61) or not (x <= 4.4e+26): tmp = (x * (4.0 / z)) + -2.0 else: tmp = 4.0 * (-0.5 - (y / z)) return tmp
function code(x, y, z) tmp = 0.0 if ((x <= -3.3e+61) || !(x <= 4.4e+26)) tmp = Float64(Float64(x * Float64(4.0 / z)) + -2.0); else tmp = Float64(4.0 * Float64(-0.5 - Float64(y / z))); end return tmp end
function tmp_2 = code(x, y, z) tmp = 0.0; if ((x <= -3.3e+61) || ~((x <= 4.4e+26))) tmp = (x * (4.0 / z)) + -2.0; else tmp = 4.0 * (-0.5 - (y / z)); end tmp_2 = tmp; end
code[x_, y_, z_] := If[Or[LessEqual[x, -3.3e+61], N[Not[LessEqual[x, 4.4e+26]], $MachinePrecision]], N[(N[(x * N[(4.0 / z), $MachinePrecision]), $MachinePrecision] + -2.0), $MachinePrecision], N[(4.0 * N[(-0.5 - N[(y / z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x \leq -3.3 \cdot 10^{+61} \lor \neg \left(x \leq 4.4 \cdot 10^{+26}\right):\\
\;\;\;\;x \cdot \frac{4}{z} + -2\\
\mathbf{else}:\\
\;\;\;\;4 \cdot \left(-0.5 - \frac{y}{z}\right)\\
\end{array}
\end{array}
if x < -3.2999999999999998e61 or 4.40000000000000014e26 < x Initial program 100.0%
Taylor expanded in y around 0 85.8%
div-sub85.7%
associate-/l*85.7%
*-inverses85.7%
cancel-sign-sub-inv85.7%
metadata-eval85.7%
metadata-eval85.7%
distribute-rgt-in85.7%
associate-*l/85.7%
associate-*r/85.6%
metadata-eval85.6%
Simplified85.6%
if -3.2999999999999998e61 < x < 4.40000000000000014e26Initial program 100.0%
associate-/l*100.0%
div-sub100.0%
associate-*l/100.0%
*-inverses100.0%
metadata-eval100.0%
sub-neg100.0%
metadata-eval100.0%
Simplified100.0%
Taylor expanded in x around 0 91.6%
distribute-lft-in91.6%
metadata-eval91.6%
neg-mul-191.6%
unsub-neg91.6%
Simplified91.6%
Final simplification89.3%
(FPCore (x y z) :precision binary64 (if (or (<= z -1.4e+161) (not (<= z 4.6e+20))) (* 4.0 (- -0.5 (/ y z))) (* 4.0 (/ (- x y) z))))
double code(double x, double y, double z) {
double tmp;
if ((z <= -1.4e+161) || !(z <= 4.6e+20)) {
tmp = 4.0 * (-0.5 - (y / z));
} 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 <= (-1.4d+161)) .or. (.not. (z <= 4.6d+20))) then
tmp = 4.0d0 * ((-0.5d0) - (y / z))
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 <= -1.4e+161) || !(z <= 4.6e+20)) {
tmp = 4.0 * (-0.5 - (y / z));
} else {
tmp = 4.0 * ((x - y) / z);
}
return tmp;
}
def code(x, y, z): tmp = 0 if (z <= -1.4e+161) or not (z <= 4.6e+20): tmp = 4.0 * (-0.5 - (y / z)) else: tmp = 4.0 * ((x - y) / z) return tmp
function code(x, y, z) tmp = 0.0 if ((z <= -1.4e+161) || !(z <= 4.6e+20)) tmp = Float64(4.0 * Float64(-0.5 - Float64(y / z))); 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 <= -1.4e+161) || ~((z <= 4.6e+20))) tmp = 4.0 * (-0.5 - (y / z)); else tmp = 4.0 * ((x - y) / z); end tmp_2 = tmp; end
code[x_, y_, z_] := If[Or[LessEqual[z, -1.4e+161], N[Not[LessEqual[z, 4.6e+20]], $MachinePrecision]], N[(4.0 * N[(-0.5 - N[(y / z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(4.0 * N[(N[(x - y), $MachinePrecision] / z), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \leq -1.4 \cdot 10^{+161} \lor \neg \left(z \leq 4.6 \cdot 10^{+20}\right):\\
\;\;\;\;4 \cdot \left(-0.5 - \frac{y}{z}\right)\\
\mathbf{else}:\\
\;\;\;\;4 \cdot \frac{x - y}{z}\\
\end{array}
\end{array}
if z < -1.4000000000000001e161 or 4.6e20 < z Initial program 100.0%
associate-/l*100.0%
div-sub100.0%
associate-*l/100.0%
*-inverses100.0%
metadata-eval100.0%
sub-neg100.0%
metadata-eval100.0%
Simplified100.0%
Taylor expanded in x around 0 86.9%
distribute-lft-in86.9%
metadata-eval86.9%
neg-mul-186.9%
unsub-neg86.9%
Simplified86.9%
if -1.4000000000000001e161 < z < 4.6e20Initial program 100.0%
Taylor expanded in z around 0 90.1%
Final simplification89.0%
(FPCore (x y z) :precision binary64 (if (or (<= x -2.25e+167) (not (<= x 4.2e+77))) (* 4.0 (/ x z)) (* 4.0 (- -0.5 (/ y z)))))
double code(double x, double y, double z) {
double tmp;
if ((x <= -2.25e+167) || !(x <= 4.2e+77)) {
tmp = 4.0 * (x / z);
} else {
tmp = 4.0 * (-0.5 - (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 <= (-2.25d+167)) .or. (.not. (x <= 4.2d+77))) then
tmp = 4.0d0 * (x / z)
else
tmp = 4.0d0 * ((-0.5d0) - (y / z))
end if
code = tmp
end function
public static double code(double x, double y, double z) {
double tmp;
if ((x <= -2.25e+167) || !(x <= 4.2e+77)) {
tmp = 4.0 * (x / z);
} else {
tmp = 4.0 * (-0.5 - (y / z));
}
return tmp;
}
def code(x, y, z): tmp = 0 if (x <= -2.25e+167) or not (x <= 4.2e+77): tmp = 4.0 * (x / z) else: tmp = 4.0 * (-0.5 - (y / z)) return tmp
function code(x, y, z) tmp = 0.0 if ((x <= -2.25e+167) || !(x <= 4.2e+77)) tmp = Float64(4.0 * Float64(x / z)); else tmp = Float64(4.0 * Float64(-0.5 - Float64(y / z))); end return tmp end
function tmp_2 = code(x, y, z) tmp = 0.0; if ((x <= -2.25e+167) || ~((x <= 4.2e+77))) tmp = 4.0 * (x / z); else tmp = 4.0 * (-0.5 - (y / z)); end tmp_2 = tmp; end
code[x_, y_, z_] := If[Or[LessEqual[x, -2.25e+167], N[Not[LessEqual[x, 4.2e+77]], $MachinePrecision]], N[(4.0 * N[(x / z), $MachinePrecision]), $MachinePrecision], N[(4.0 * N[(-0.5 - N[(y / z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x \leq -2.25 \cdot 10^{+167} \lor \neg \left(x \leq 4.2 \cdot 10^{+77}\right):\\
\;\;\;\;4 \cdot \frac{x}{z}\\
\mathbf{else}:\\
\;\;\;\;4 \cdot \left(-0.5 - \frac{y}{z}\right)\\
\end{array}
\end{array}
if x < -2.25e167 or 4.1999999999999997e77 < x Initial program 99.9%
Taylor expanded in x around inf 76.1%
if -2.25e167 < x < 4.1999999999999997e77Initial program 100.0%
associate-/l*100.0%
div-sub100.0%
associate-*l/100.0%
*-inverses100.0%
metadata-eval100.0%
sub-neg100.0%
metadata-eval100.0%
Simplified100.0%
Taylor expanded in x around 0 85.8%
distribute-lft-in85.8%
metadata-eval85.8%
neg-mul-185.8%
unsub-neg85.8%
Simplified85.8%
Final simplification83.3%
(FPCore (x y z) :precision binary64 (if (<= z -9e+159) -2.0 (if (<= z 1.35e+39) (* 4.0 (/ x z)) -2.0)))
double code(double x, double y, double z) {
double tmp;
if (z <= -9e+159) {
tmp = -2.0;
} else if (z <= 1.35e+39) {
tmp = 4.0 * (x / 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 <= (-9d+159)) then
tmp = -2.0d0
else if (z <= 1.35d+39) then
tmp = 4.0d0 * (x / 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 <= -9e+159) {
tmp = -2.0;
} else if (z <= 1.35e+39) {
tmp = 4.0 * (x / z);
} else {
tmp = -2.0;
}
return tmp;
}
def code(x, y, z): tmp = 0 if z <= -9e+159: tmp = -2.0 elif z <= 1.35e+39: tmp = 4.0 * (x / z) else: tmp = -2.0 return tmp
function code(x, y, z) tmp = 0.0 if (z <= -9e+159) tmp = -2.0; elseif (z <= 1.35e+39) tmp = Float64(4.0 * Float64(x / z)); else tmp = -2.0; end return tmp end
function tmp_2 = code(x, y, z) tmp = 0.0; if (z <= -9e+159) tmp = -2.0; elseif (z <= 1.35e+39) tmp = 4.0 * (x / z); else tmp = -2.0; end tmp_2 = tmp; end
code[x_, y_, z_] := If[LessEqual[z, -9e+159], -2.0, If[LessEqual[z, 1.35e+39], N[(4.0 * N[(x / z), $MachinePrecision]), $MachinePrecision], -2.0]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \leq -9 \cdot 10^{+159}:\\
\;\;\;\;-2\\
\mathbf{elif}\;z \leq 1.35 \cdot 10^{+39}:\\
\;\;\;\;4 \cdot \frac{x}{z}\\
\mathbf{else}:\\
\;\;\;\;-2\\
\end{array}
\end{array}
if z < -9.00000000000000053e159 or 1.35000000000000002e39 < z Initial program 100.0%
Taylor expanded in z around inf 67.6%
if -9.00000000000000053e159 < z < 1.35000000000000002e39Initial program 100.0%
Taylor expanded in x around inf 41.7%
(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%
Taylor expanded in z around inf 30.2%
(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 2024096
(FPCore (x y z)
:name "Data.Array.Repa.Algorithms.ColorRamp:rampColorHotToCold from repa-algorithms-3.4.0.1, B"
:precision binary64
:alt
(- (* 4.0 (/ x z)) (+ 2.0 (* 4.0 (/ y z))))
(/ (* 4.0 (- (- x y) (* z 0.5))) z))