
(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 (- (/ (- y x) z) -0.5)))
double code(double x, double y, double z) {
return -4.0 * (((y - x) / 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) * (((y - x) / z) - (-0.5d0))
end function
public static double code(double x, double y, double z) {
return -4.0 * (((y - x) / z) - -0.5);
}
def code(x, y, z): return -4.0 * (((y - x) / z) - -0.5)
function code(x, y, z) return Float64(-4.0 * Float64(Float64(Float64(y - x) / z) - -0.5)) end
function tmp = code(x, y, z) tmp = -4.0 * (((y - x) / z) - -0.5); end
code[x_, y_, z_] := N[(-4.0 * N[(N[(N[(y - x), $MachinePrecision] / z), $MachinePrecision] - -0.5), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
-4 \cdot \left(\frac{y - x}{z} - -0.5\right)
\end{array}
Initial program 99.6%
remove-double-neg99.6%
neg-mul-199.6%
times-frac100.0%
metadata-eval100.0%
div-sub100.0%
distribute-frac-neg2100.0%
distribute-frac-neg100.0%
sub-neg100.0%
+-commutative100.0%
distribute-neg-out100.0%
remove-double-neg100.0%
sub-neg100.0%
*-commutative100.0%
neg-mul-1100.0%
times-frac100.0%
metadata-eval100.0%
*-inverses100.0%
metadata-eval100.0%
Simplified100.0%
(FPCore (x y z) :precision binary64 (if (or (<= z -7.4e+87) (not (<= z 4.2e+85))) (* 4.0 (+ -0.5 (/ x z))) (* -4.0 (/ (- y x) z))))
double code(double x, double y, double z) {
double tmp;
if ((z <= -7.4e+87) || !(z <= 4.2e+85)) {
tmp = 4.0 * (-0.5 + (x / z));
} else {
tmp = -4.0 * ((y - x) / 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 <= (-7.4d+87)) .or. (.not. (z <= 4.2d+85))) then
tmp = 4.0d0 * ((-0.5d0) + (x / z))
else
tmp = (-4.0d0) * ((y - x) / z)
end if
code = tmp
end function
public static double code(double x, double y, double z) {
double tmp;
if ((z <= -7.4e+87) || !(z <= 4.2e+85)) {
tmp = 4.0 * (-0.5 + (x / z));
} else {
tmp = -4.0 * ((y - x) / z);
}
return tmp;
}
def code(x, y, z): tmp = 0 if (z <= -7.4e+87) or not (z <= 4.2e+85): tmp = 4.0 * (-0.5 + (x / z)) else: tmp = -4.0 * ((y - x) / z) return tmp
function code(x, y, z) tmp = 0.0 if ((z <= -7.4e+87) || !(z <= 4.2e+85)) tmp = Float64(4.0 * Float64(-0.5 + Float64(x / z))); else tmp = Float64(-4.0 * Float64(Float64(y - x) / z)); end return tmp end
function tmp_2 = code(x, y, z) tmp = 0.0; if ((z <= -7.4e+87) || ~((z <= 4.2e+85))) tmp = 4.0 * (-0.5 + (x / z)); else tmp = -4.0 * ((y - x) / z); end tmp_2 = tmp; end
code[x_, y_, z_] := If[Or[LessEqual[z, -7.4e+87], N[Not[LessEqual[z, 4.2e+85]], $MachinePrecision]], N[(4.0 * N[(-0.5 + N[(x / z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(-4.0 * N[(N[(y - x), $MachinePrecision] / z), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \leq -7.4 \cdot 10^{+87} \lor \neg \left(z \leq 4.2 \cdot 10^{+85}\right):\\
\;\;\;\;4 \cdot \left(-0.5 + \frac{x}{z}\right)\\
\mathbf{else}:\\
\;\;\;\;-4 \cdot \frac{y - x}{z}\\
\end{array}
\end{array}
if z < -7.40000000000000005e87 or 4.2000000000000002e85 < z Initial program 98.9%
remove-double-neg98.9%
neg-mul-198.9%
times-frac100.0%
metadata-eval100.0%
div-sub100.0%
distribute-frac-neg2100.0%
distribute-frac-neg100.0%
sub-neg100.0%
+-commutative100.0%
distribute-neg-out100.0%
remove-double-neg100.0%
sub-neg100.0%
*-commutative100.0%
neg-mul-1100.0%
times-frac100.0%
metadata-eval100.0%
*-inverses100.0%
metadata-eval100.0%
Simplified100.0%
Taylor expanded in y around 0 89.3%
sub-neg89.3%
+-commutative89.3%
neg-sub089.3%
associate-+l-89.3%
neg-sub089.3%
neg-mul-189.3%
associate-*r*89.3%
metadata-eval89.3%
sub-neg89.3%
metadata-eval89.3%
Simplified89.3%
if -7.40000000000000005e87 < z < 4.2000000000000002e85Initial program 100.0%
remove-double-neg100.0%
neg-mul-1100.0%
times-frac100.0%
metadata-eval100.0%
div-sub100.0%
distribute-frac-neg2100.0%
distribute-frac-neg100.0%
sub-neg100.0%
+-commutative100.0%
distribute-neg-out100.0%
remove-double-neg100.0%
sub-neg100.0%
*-commutative100.0%
neg-mul-1100.0%
times-frac100.0%
metadata-eval100.0%
*-inverses100.0%
metadata-eval100.0%
Simplified100.0%
Taylor expanded in z around 0 89.0%
*-commutative89.0%
Simplified89.0%
Final simplification89.1%
(FPCore (x y z) :precision binary64 (if (or (<= y -1.45e+174) (not (<= y 4.2e+64))) (* -4.0 (/ y z)) (* 4.0 (+ -0.5 (/ x z)))))
double code(double x, double y, double z) {
double tmp;
if ((y <= -1.45e+174) || !(y <= 4.2e+64)) {
tmp = -4.0 * (y / z);
} else {
tmp = 4.0 * (-0.5 + (x / 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 ((y <= (-1.45d+174)) .or. (.not. (y <= 4.2d+64))) then
tmp = (-4.0d0) * (y / z)
else
tmp = 4.0d0 * ((-0.5d0) + (x / z))
end if
code = tmp
end function
public static double code(double x, double y, double z) {
double tmp;
if ((y <= -1.45e+174) || !(y <= 4.2e+64)) {
tmp = -4.0 * (y / z);
} else {
tmp = 4.0 * (-0.5 + (x / z));
}
return tmp;
}
def code(x, y, z): tmp = 0 if (y <= -1.45e+174) or not (y <= 4.2e+64): tmp = -4.0 * (y / z) else: tmp = 4.0 * (-0.5 + (x / z)) return tmp
function code(x, y, z) tmp = 0.0 if ((y <= -1.45e+174) || !(y <= 4.2e+64)) tmp = Float64(-4.0 * Float64(y / z)); else tmp = Float64(4.0 * Float64(-0.5 + Float64(x / z))); end return tmp end
function tmp_2 = code(x, y, z) tmp = 0.0; if ((y <= -1.45e+174) || ~((y <= 4.2e+64))) tmp = -4.0 * (y / z); else tmp = 4.0 * (-0.5 + (x / z)); end tmp_2 = tmp; end
code[x_, y_, z_] := If[Or[LessEqual[y, -1.45e+174], N[Not[LessEqual[y, 4.2e+64]], $MachinePrecision]], N[(-4.0 * N[(y / z), $MachinePrecision]), $MachinePrecision], N[(4.0 * N[(-0.5 + N[(x / z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;y \leq -1.45 \cdot 10^{+174} \lor \neg \left(y \leq 4.2 \cdot 10^{+64}\right):\\
\;\;\;\;-4 \cdot \frac{y}{z}\\
\mathbf{else}:\\
\;\;\;\;4 \cdot \left(-0.5 + \frac{x}{z}\right)\\
\end{array}
\end{array}
if y < -1.45e174 or 4.2000000000000001e64 < y Initial program 100.0%
remove-double-neg100.0%
neg-mul-1100.0%
times-frac100.0%
metadata-eval100.0%
div-sub100.0%
distribute-frac-neg2100.0%
distribute-frac-neg100.0%
sub-neg100.0%
+-commutative100.0%
distribute-neg-out100.0%
remove-double-neg100.0%
sub-neg100.0%
*-commutative100.0%
neg-mul-1100.0%
times-frac100.0%
metadata-eval100.0%
*-inverses100.0%
metadata-eval100.0%
Simplified100.0%
Taylor expanded in y around inf 80.8%
*-commutative80.8%
Simplified80.8%
if -1.45e174 < y < 4.2000000000000001e64Initial program 99.4%
remove-double-neg99.4%
neg-mul-199.4%
times-frac100.0%
metadata-eval100.0%
div-sub100.0%
distribute-frac-neg2100.0%
distribute-frac-neg100.0%
sub-neg100.0%
+-commutative100.0%
distribute-neg-out100.0%
remove-double-neg100.0%
sub-neg100.0%
*-commutative100.0%
neg-mul-1100.0%
times-frac100.0%
metadata-eval100.0%
*-inverses100.0%
metadata-eval100.0%
Simplified100.0%
Taylor expanded in y around 0 81.3%
sub-neg81.3%
+-commutative81.3%
neg-sub081.3%
associate-+l-81.3%
neg-sub081.3%
neg-mul-181.3%
associate-*r*81.3%
metadata-eval81.3%
sub-neg81.3%
metadata-eval81.3%
Simplified81.3%
Final simplification81.1%
(FPCore (x y z) :precision binary64 (if (<= z -9.2e+59) (+ (* -4.0 (/ y z)) -2.0) (if (<= z 4.6e+83) (* -4.0 (/ (- y x) z)) (* 4.0 (+ -0.5 (/ x z))))))
double code(double x, double y, double z) {
double tmp;
if (z <= -9.2e+59) {
tmp = (-4.0 * (y / z)) + -2.0;
} else if (z <= 4.6e+83) {
tmp = -4.0 * ((y - x) / z);
} else {
tmp = 4.0 * (-0.5 + (x / 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 <= (-9.2d+59)) then
tmp = ((-4.0d0) * (y / z)) + (-2.0d0)
else if (z <= 4.6d+83) then
tmp = (-4.0d0) * ((y - x) / z)
else
tmp = 4.0d0 * ((-0.5d0) + (x / z))
end if
code = tmp
end function
public static double code(double x, double y, double z) {
double tmp;
if (z <= -9.2e+59) {
tmp = (-4.0 * (y / z)) + -2.0;
} else if (z <= 4.6e+83) {
tmp = -4.0 * ((y - x) / z);
} else {
tmp = 4.0 * (-0.5 + (x / z));
}
return tmp;
}
def code(x, y, z): tmp = 0 if z <= -9.2e+59: tmp = (-4.0 * (y / z)) + -2.0 elif z <= 4.6e+83: tmp = -4.0 * ((y - x) / z) else: tmp = 4.0 * (-0.5 + (x / z)) return tmp
function code(x, y, z) tmp = 0.0 if (z <= -9.2e+59) tmp = Float64(Float64(-4.0 * Float64(y / z)) + -2.0); elseif (z <= 4.6e+83) tmp = Float64(-4.0 * Float64(Float64(y - x) / z)); else tmp = Float64(4.0 * Float64(-0.5 + Float64(x / z))); end return tmp end
function tmp_2 = code(x, y, z) tmp = 0.0; if (z <= -9.2e+59) tmp = (-4.0 * (y / z)) + -2.0; elseif (z <= 4.6e+83) tmp = -4.0 * ((y - x) / z); else tmp = 4.0 * (-0.5 + (x / z)); end tmp_2 = tmp; end
code[x_, y_, z_] := If[LessEqual[z, -9.2e+59], N[(N[(-4.0 * N[(y / z), $MachinePrecision]), $MachinePrecision] + -2.0), $MachinePrecision], If[LessEqual[z, 4.6e+83], N[(-4.0 * N[(N[(y - x), $MachinePrecision] / z), $MachinePrecision]), $MachinePrecision], N[(4.0 * N[(-0.5 + N[(x / z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \leq -9.2 \cdot 10^{+59}:\\
\;\;\;\;-4 \cdot \frac{y}{z} + -2\\
\mathbf{elif}\;z \leq 4.6 \cdot 10^{+83}:\\
\;\;\;\;-4 \cdot \frac{y - x}{z}\\
\mathbf{else}:\\
\;\;\;\;4 \cdot \left(-0.5 + \frac{x}{z}\right)\\
\end{array}
\end{array}
if z < -9.20000000000000032e59Initial program 100.0%
remove-double-neg100.0%
neg-mul-1100.0%
times-frac100.0%
metadata-eval100.0%
div-sub100.0%
distribute-frac-neg2100.0%
distribute-frac-neg100.0%
sub-neg100.0%
+-commutative100.0%
distribute-neg-out100.0%
remove-double-neg100.0%
sub-neg100.0%
*-commutative100.0%
neg-mul-1100.0%
times-frac100.0%
metadata-eval100.0%
*-inverses100.0%
metadata-eval100.0%
Simplified100.0%
Taylor expanded in x around 0 91.3%
+-commutative91.3%
distribute-rgt-in91.3%
metadata-eval91.3%
Simplified91.3%
if -9.20000000000000032e59 < z < 4.5999999999999999e83Initial program 100.0%
remove-double-neg100.0%
neg-mul-1100.0%
times-frac100.0%
metadata-eval100.0%
div-sub100.0%
distribute-frac-neg2100.0%
distribute-frac-neg100.0%
sub-neg100.0%
+-commutative100.0%
distribute-neg-out100.0%
remove-double-neg100.0%
sub-neg100.0%
*-commutative100.0%
neg-mul-1100.0%
times-frac100.0%
metadata-eval100.0%
*-inverses100.0%
metadata-eval100.0%
Simplified100.0%
Taylor expanded in z around 0 89.3%
*-commutative89.3%
Simplified89.3%
if 4.5999999999999999e83 < z Initial program 98.0%
remove-double-neg98.0%
neg-mul-198.0%
times-frac100.0%
metadata-eval100.0%
div-sub100.0%
distribute-frac-neg2100.0%
distribute-frac-neg100.0%
sub-neg100.0%
+-commutative100.0%
distribute-neg-out100.0%
remove-double-neg100.0%
sub-neg100.0%
*-commutative100.0%
neg-mul-1100.0%
times-frac100.0%
metadata-eval100.0%
*-inverses100.0%
metadata-eval100.0%
Simplified100.0%
Taylor expanded in y around 0 90.2%
sub-neg90.2%
+-commutative90.2%
neg-sub090.2%
associate-+l-90.2%
neg-sub090.2%
neg-mul-190.2%
associate-*r*90.2%
metadata-eval90.2%
sub-neg90.2%
metadata-eval90.2%
Simplified90.2%
Final simplification89.8%
(FPCore (x y z) :precision binary64 (if (<= z -8.8e+88) -2.0 (if (<= z 2.9e+86) (* -4.0 (/ y z)) -2.0)))
double code(double x, double y, double z) {
double tmp;
if (z <= -8.8e+88) {
tmp = -2.0;
} else if (z <= 2.9e+86) {
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 <= (-8.8d+88)) then
tmp = -2.0d0
else if (z <= 2.9d+86) 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 <= -8.8e+88) {
tmp = -2.0;
} else if (z <= 2.9e+86) {
tmp = -4.0 * (y / z);
} else {
tmp = -2.0;
}
return tmp;
}
def code(x, y, z): tmp = 0 if z <= -8.8e+88: tmp = -2.0 elif z <= 2.9e+86: tmp = -4.0 * (y / z) else: tmp = -2.0 return tmp
function code(x, y, z) tmp = 0.0 if (z <= -8.8e+88) tmp = -2.0; elseif (z <= 2.9e+86) 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 <= -8.8e+88) tmp = -2.0; elseif (z <= 2.9e+86) tmp = -4.0 * (y / z); else tmp = -2.0; end tmp_2 = tmp; end
code[x_, y_, z_] := If[LessEqual[z, -8.8e+88], -2.0, If[LessEqual[z, 2.9e+86], N[(-4.0 * N[(y / z), $MachinePrecision]), $MachinePrecision], -2.0]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \leq -8.8 \cdot 10^{+88}:\\
\;\;\;\;-2\\
\mathbf{elif}\;z \leq 2.9 \cdot 10^{+86}:\\
\;\;\;\;-4 \cdot \frac{y}{z}\\
\mathbf{else}:\\
\;\;\;\;-2\\
\end{array}
\end{array}
if z < -8.80000000000000035e88 or 2.8999999999999999e86 < z Initial program 98.9%
remove-double-neg98.9%
neg-mul-198.9%
times-frac100.0%
metadata-eval100.0%
div-sub100.0%
distribute-frac-neg2100.0%
distribute-frac-neg100.0%
sub-neg100.0%
+-commutative100.0%
distribute-neg-out100.0%
remove-double-neg100.0%
sub-neg100.0%
*-commutative100.0%
neg-mul-1100.0%
times-frac100.0%
metadata-eval100.0%
*-inverses100.0%
metadata-eval100.0%
Simplified100.0%
Taylor expanded in z around inf 72.5%
if -8.80000000000000035e88 < z < 2.8999999999999999e86Initial program 100.0%
remove-double-neg100.0%
neg-mul-1100.0%
times-frac100.0%
metadata-eval100.0%
div-sub100.0%
distribute-frac-neg2100.0%
distribute-frac-neg100.0%
sub-neg100.0%
+-commutative100.0%
distribute-neg-out100.0%
remove-double-neg100.0%
sub-neg100.0%
*-commutative100.0%
neg-mul-1100.0%
times-frac100.0%
metadata-eval100.0%
*-inverses100.0%
metadata-eval100.0%
Simplified100.0%
Taylor expanded in y around inf 54.8%
*-commutative54.8%
Simplified54.8%
Final simplification60.9%
(FPCore (x y z) :precision binary64 (if (<= z -5.6e+88) -2.0 (if (<= z 1e+84) (* y (/ -4.0 z)) -2.0)))
double code(double x, double y, double z) {
double tmp;
if (z <= -5.6e+88) {
tmp = -2.0;
} else if (z <= 1e+84) {
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 <= (-5.6d+88)) then
tmp = -2.0d0
else if (z <= 1d+84) 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 <= -5.6e+88) {
tmp = -2.0;
} else if (z <= 1e+84) {
tmp = y * (-4.0 / z);
} else {
tmp = -2.0;
}
return tmp;
}
def code(x, y, z): tmp = 0 if z <= -5.6e+88: tmp = -2.0 elif z <= 1e+84: tmp = y * (-4.0 / z) else: tmp = -2.0 return tmp
function code(x, y, z) tmp = 0.0 if (z <= -5.6e+88) tmp = -2.0; elseif (z <= 1e+84) 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 <= -5.6e+88) tmp = -2.0; elseif (z <= 1e+84) tmp = y * (-4.0 / z); else tmp = -2.0; end tmp_2 = tmp; end
code[x_, y_, z_] := If[LessEqual[z, -5.6e+88], -2.0, If[LessEqual[z, 1e+84], N[(y * N[(-4.0 / z), $MachinePrecision]), $MachinePrecision], -2.0]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \leq -5.6 \cdot 10^{+88}:\\
\;\;\;\;-2\\
\mathbf{elif}\;z \leq 10^{+84}:\\
\;\;\;\;y \cdot \frac{-4}{z}\\
\mathbf{else}:\\
\;\;\;\;-2\\
\end{array}
\end{array}
if z < -5.59999999999999977e88 or 1.00000000000000006e84 < z Initial program 98.9%
remove-double-neg98.9%
neg-mul-198.9%
times-frac100.0%
metadata-eval100.0%
div-sub100.0%
distribute-frac-neg2100.0%
distribute-frac-neg100.0%
sub-neg100.0%
+-commutative100.0%
distribute-neg-out100.0%
remove-double-neg100.0%
sub-neg100.0%
*-commutative100.0%
neg-mul-1100.0%
times-frac100.0%
metadata-eval100.0%
*-inverses100.0%
metadata-eval100.0%
Simplified100.0%
Taylor expanded in z around inf 72.5%
if -5.59999999999999977e88 < z < 1.00000000000000006e84Initial program 100.0%
remove-double-neg100.0%
neg-mul-1100.0%
times-frac100.0%
metadata-eval100.0%
div-sub100.0%
distribute-frac-neg2100.0%
distribute-frac-neg100.0%
sub-neg100.0%
+-commutative100.0%
distribute-neg-out100.0%
remove-double-neg100.0%
sub-neg100.0%
*-commutative100.0%
neg-mul-1100.0%
times-frac100.0%
metadata-eval100.0%
*-inverses100.0%
metadata-eval100.0%
Simplified100.0%
Taylor expanded in y around inf 54.8%
*-commutative54.8%
Simplified54.8%
Taylor expanded in y around 0 54.8%
associate-*r/54.8%
*-commutative54.8%
associate-*r/54.6%
Simplified54.6%
(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.6%
remove-double-neg99.6%
neg-mul-199.6%
times-frac100.0%
metadata-eval100.0%
div-sub100.0%
distribute-frac-neg2100.0%
distribute-frac-neg100.0%
sub-neg100.0%
+-commutative100.0%
distribute-neg-out100.0%
remove-double-neg100.0%
sub-neg100.0%
*-commutative100.0%
neg-mul-1100.0%
times-frac100.0%
metadata-eval100.0%
*-inverses100.0%
metadata-eval100.0%
Simplified100.0%
Taylor expanded in z around inf 33.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 2024165
(FPCore (x y z)
:name "Data.Array.Repa.Algorithms.ColorRamp:rampColorHotToCold from repa-algorithms-3.4.0.1, B"
:precision binary64
:alt
(! :herbie-platform default (- (* 4 (/ x z)) (+ 2 (* 4 (/ y z)))))
(/ (* 4.0 (- (- x y) (* z 0.5))) z))