
(FPCore (x y z) :precision binary64 (+ 1.0 (/ (* 4.0 (- (+ x (* y 0.25)) z)) y)))
double code(double x, double y, double z) {
return 1.0 + ((4.0 * ((x + (y * 0.25)) - z)) / y);
}
real(8) function code(x, y, z)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
code = 1.0d0 + ((4.0d0 * ((x + (y * 0.25d0)) - z)) / y)
end function
public static double code(double x, double y, double z) {
return 1.0 + ((4.0 * ((x + (y * 0.25)) - z)) / y);
}
def code(x, y, z): return 1.0 + ((4.0 * ((x + (y * 0.25)) - z)) / y)
function code(x, y, z) return Float64(1.0 + Float64(Float64(4.0 * Float64(Float64(x + Float64(y * 0.25)) - z)) / y)) end
function tmp = code(x, y, z) tmp = 1.0 + ((4.0 * ((x + (y * 0.25)) - z)) / y); end
code[x_, y_, z_] := N[(1.0 + N[(N[(4.0 * N[(N[(x + N[(y * 0.25), $MachinePrecision]), $MachinePrecision] - z), $MachinePrecision]), $MachinePrecision] / y), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
1 + \frac{4 \cdot \left(\left(x + y \cdot 0.25\right) - z\right)}{y}
\end{array}
Sampling outcomes in binary64 precision:
Herbie found 10 alternatives:
| Alternative | Accuracy | Speedup |
|---|
(FPCore (x y z) :precision binary64 (+ 1.0 (/ (* 4.0 (- (+ x (* y 0.25)) z)) y)))
double code(double x, double y, double z) {
return 1.0 + ((4.0 * ((x + (y * 0.25)) - z)) / y);
}
real(8) function code(x, y, z)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
code = 1.0d0 + ((4.0d0 * ((x + (y * 0.25d0)) - z)) / y)
end function
public static double code(double x, double y, double z) {
return 1.0 + ((4.0 * ((x + (y * 0.25)) - z)) / y);
}
def code(x, y, z): return 1.0 + ((4.0 * ((x + (y * 0.25)) - z)) / y)
function code(x, y, z) return Float64(1.0 + Float64(Float64(4.0 * Float64(Float64(x + Float64(y * 0.25)) - z)) / y)) end
function tmp = code(x, y, z) tmp = 1.0 + ((4.0 * ((x + (y * 0.25)) - z)) / y); end
code[x_, y_, z_] := N[(1.0 + N[(N[(4.0 * N[(N[(x + N[(y * 0.25), $MachinePrecision]), $MachinePrecision] - z), $MachinePrecision]), $MachinePrecision] / y), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
1 + \frac{4 \cdot \left(\left(x + y \cdot 0.25\right) - z\right)}{y}
\end{array}
(FPCore (x y z) :precision binary64 (+ 1.0 (/ (* 4.0 (- (+ x (* y 0.25)) z)) y)))
double code(double x, double y, double z) {
return 1.0 + ((4.0 * ((x + (y * 0.25)) - z)) / y);
}
real(8) function code(x, y, z)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
code = 1.0d0 + ((4.0d0 * ((x + (y * 0.25d0)) - z)) / y)
end function
public static double code(double x, double y, double z) {
return 1.0 + ((4.0 * ((x + (y * 0.25)) - z)) / y);
}
def code(x, y, z): return 1.0 + ((4.0 * ((x + (y * 0.25)) - z)) / y)
function code(x, y, z) return Float64(1.0 + Float64(Float64(4.0 * Float64(Float64(x + Float64(y * 0.25)) - z)) / y)) end
function tmp = code(x, y, z) tmp = 1.0 + ((4.0 * ((x + (y * 0.25)) - z)) / y); end
code[x_, y_, z_] := N[(1.0 + N[(N[(4.0 * N[(N[(x + N[(y * 0.25), $MachinePrecision]), $MachinePrecision] - z), $MachinePrecision]), $MachinePrecision] / y), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
1 + \frac{4 \cdot \left(\left(x + y \cdot 0.25\right) - z\right)}{y}
\end{array}
Initial program 100.0%
(FPCore (x y z) :precision binary64 (if (or (<= x -1.2e-9) (not (<= x 1.25e+76))) (* 4.0 (/ (- x z) y)) (+ 2.0 (* (/ z y) -4.0))))
double code(double x, double y, double z) {
double tmp;
if ((x <= -1.2e-9) || !(x <= 1.25e+76)) {
tmp = 4.0 * ((x - z) / y);
} else {
tmp = 2.0 + ((z / y) * -4.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 <= (-1.2d-9)) .or. (.not. (x <= 1.25d+76))) then
tmp = 4.0d0 * ((x - z) / y)
else
tmp = 2.0d0 + ((z / y) * (-4.0d0))
end if
code = tmp
end function
public static double code(double x, double y, double z) {
double tmp;
if ((x <= -1.2e-9) || !(x <= 1.25e+76)) {
tmp = 4.0 * ((x - z) / y);
} else {
tmp = 2.0 + ((z / y) * -4.0);
}
return tmp;
}
def code(x, y, z): tmp = 0 if (x <= -1.2e-9) or not (x <= 1.25e+76): tmp = 4.0 * ((x - z) / y) else: tmp = 2.0 + ((z / y) * -4.0) return tmp
function code(x, y, z) tmp = 0.0 if ((x <= -1.2e-9) || !(x <= 1.25e+76)) tmp = Float64(4.0 * Float64(Float64(x - z) / y)); else tmp = Float64(2.0 + Float64(Float64(z / y) * -4.0)); end return tmp end
function tmp_2 = code(x, y, z) tmp = 0.0; if ((x <= -1.2e-9) || ~((x <= 1.25e+76))) tmp = 4.0 * ((x - z) / y); else tmp = 2.0 + ((z / y) * -4.0); end tmp_2 = tmp; end
code[x_, y_, z_] := If[Or[LessEqual[x, -1.2e-9], N[Not[LessEqual[x, 1.25e+76]], $MachinePrecision]], N[(4.0 * N[(N[(x - z), $MachinePrecision] / y), $MachinePrecision]), $MachinePrecision], N[(2.0 + N[(N[(z / y), $MachinePrecision] * -4.0), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x \leq -1.2 \cdot 10^{-9} \lor \neg \left(x \leq 1.25 \cdot 10^{+76}\right):\\
\;\;\;\;4 \cdot \frac{x - z}{y}\\
\mathbf{else}:\\
\;\;\;\;2 + \frac{z}{y} \cdot -4\\
\end{array}
\end{array}
if x < -1.2e-9 or 1.24999999999999998e76 < x Initial program 99.9%
Taylor expanded in y around 0 89.9%
if -1.2e-9 < x < 1.24999999999999998e76Initial program 100.0%
+-commutative100.0%
associate-*l/99.7%
+-commutative99.7%
associate--l+99.7%
+-commutative99.7%
distribute-lft-in99.7%
associate-+l+99.8%
associate-*l/99.8%
*-commutative99.8%
associate-*l*99.8%
metadata-eval99.8%
*-rgt-identity99.8%
*-inverses99.8%
metadata-eval99.8%
Simplified99.8%
Taylor expanded in x around 0 92.4%
*-commutative92.4%
Simplified92.4%
Final simplification91.2%
(FPCore (x y z) :precision binary64 (if (or (<= z -2.05e-23) (not (<= z 4.8e-112))) (* 4.0 (/ (- x z) y)) (+ 2.0 (* 4.0 (/ x y)))))
double code(double x, double y, double z) {
double tmp;
if ((z <= -2.05e-23) || !(z <= 4.8e-112)) {
tmp = 4.0 * ((x - z) / y);
} else {
tmp = 2.0 + (4.0 * (x / y));
}
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.05d-23)) .or. (.not. (z <= 4.8d-112))) then
tmp = 4.0d0 * ((x - z) / y)
else
tmp = 2.0d0 + (4.0d0 * (x / y))
end if
code = tmp
end function
public static double code(double x, double y, double z) {
double tmp;
if ((z <= -2.05e-23) || !(z <= 4.8e-112)) {
tmp = 4.0 * ((x - z) / y);
} else {
tmp = 2.0 + (4.0 * (x / y));
}
return tmp;
}
def code(x, y, z): tmp = 0 if (z <= -2.05e-23) or not (z <= 4.8e-112): tmp = 4.0 * ((x - z) / y) else: tmp = 2.0 + (4.0 * (x / y)) return tmp
function code(x, y, z) tmp = 0.0 if ((z <= -2.05e-23) || !(z <= 4.8e-112)) tmp = Float64(4.0 * Float64(Float64(x - z) / y)); else tmp = Float64(2.0 + Float64(4.0 * Float64(x / y))); end return tmp end
function tmp_2 = code(x, y, z) tmp = 0.0; if ((z <= -2.05e-23) || ~((z <= 4.8e-112))) tmp = 4.0 * ((x - z) / y); else tmp = 2.0 + (4.0 * (x / y)); end tmp_2 = tmp; end
code[x_, y_, z_] := If[Or[LessEqual[z, -2.05e-23], N[Not[LessEqual[z, 4.8e-112]], $MachinePrecision]], N[(4.0 * N[(N[(x - z), $MachinePrecision] / y), $MachinePrecision]), $MachinePrecision], N[(2.0 + N[(4.0 * N[(x / y), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \leq -2.05 \cdot 10^{-23} \lor \neg \left(z \leq 4.8 \cdot 10^{-112}\right):\\
\;\;\;\;4 \cdot \frac{x - z}{y}\\
\mathbf{else}:\\
\;\;\;\;2 + 4 \cdot \frac{x}{y}\\
\end{array}
\end{array}
if z < -2.05000000000000015e-23 or 4.8000000000000001e-112 < z Initial program 99.9%
Taylor expanded in y around 0 85.0%
if -2.05000000000000015e-23 < z < 4.8000000000000001e-112Initial program 100.0%
+-commutative100.0%
associate-*l/99.8%
+-commutative99.8%
associate--l+99.8%
+-commutative99.8%
distribute-lft-in99.8%
associate-+l+99.8%
associate-*l/99.8%
*-commutative99.8%
associate-*l*99.8%
metadata-eval99.8%
*-rgt-identity99.8%
*-inverses99.8%
metadata-eval99.8%
Simplified99.8%
Taylor expanded in z around 0 94.7%
Final simplification88.5%
(FPCore (x y z) :precision binary64 (if (<= y -5.6e+120) 2.0 (if (<= y 2.4e+206) (* 4.0 (/ (- x z) y)) 2.0)))
double code(double x, double y, double z) {
double tmp;
if (y <= -5.6e+120) {
tmp = 2.0;
} else if (y <= 2.4e+206) {
tmp = 4.0 * ((x - z) / y);
} 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 (y <= (-5.6d+120)) then
tmp = 2.0d0
else if (y <= 2.4d+206) then
tmp = 4.0d0 * ((x - z) / y)
else
tmp = 2.0d0
end if
code = tmp
end function
public static double code(double x, double y, double z) {
double tmp;
if (y <= -5.6e+120) {
tmp = 2.0;
} else if (y <= 2.4e+206) {
tmp = 4.0 * ((x - z) / y);
} else {
tmp = 2.0;
}
return tmp;
}
def code(x, y, z): tmp = 0 if y <= -5.6e+120: tmp = 2.0 elif y <= 2.4e+206: tmp = 4.0 * ((x - z) / y) else: tmp = 2.0 return tmp
function code(x, y, z) tmp = 0.0 if (y <= -5.6e+120) tmp = 2.0; elseif (y <= 2.4e+206) tmp = Float64(4.0 * Float64(Float64(x - z) / y)); else tmp = 2.0; end return tmp end
function tmp_2 = code(x, y, z) tmp = 0.0; if (y <= -5.6e+120) tmp = 2.0; elseif (y <= 2.4e+206) tmp = 4.0 * ((x - z) / y); else tmp = 2.0; end tmp_2 = tmp; end
code[x_, y_, z_] := If[LessEqual[y, -5.6e+120], 2.0, If[LessEqual[y, 2.4e+206], N[(4.0 * N[(N[(x - z), $MachinePrecision] / y), $MachinePrecision]), $MachinePrecision], 2.0]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;y \leq -5.6 \cdot 10^{+120}:\\
\;\;\;\;2\\
\mathbf{elif}\;y \leq 2.4 \cdot 10^{+206}:\\
\;\;\;\;4 \cdot \frac{x - z}{y}\\
\mathbf{else}:\\
\;\;\;\;2\\
\end{array}
\end{array}
if y < -5.6000000000000001e120 or 2.4e206 < y Initial program 99.9%
Taylor expanded in y around inf 73.0%
if -5.6000000000000001e120 < y < 2.4e206Initial program 100.0%
Taylor expanded in y around 0 83.3%
(FPCore (x y z) :precision binary64 (if (or (<= x -5.5e+34) (not (<= x 4.1e+129))) (/ (* 4.0 x) y) (* (/ z y) -4.0)))
double code(double x, double y, double z) {
double tmp;
if ((x <= -5.5e+34) || !(x <= 4.1e+129)) {
tmp = (4.0 * x) / y;
} else {
tmp = (z / y) * -4.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 <= (-5.5d+34)) .or. (.not. (x <= 4.1d+129))) then
tmp = (4.0d0 * x) / y
else
tmp = (z / y) * (-4.0d0)
end if
code = tmp
end function
public static double code(double x, double y, double z) {
double tmp;
if ((x <= -5.5e+34) || !(x <= 4.1e+129)) {
tmp = (4.0 * x) / y;
} else {
tmp = (z / y) * -4.0;
}
return tmp;
}
def code(x, y, z): tmp = 0 if (x <= -5.5e+34) or not (x <= 4.1e+129): tmp = (4.0 * x) / y else: tmp = (z / y) * -4.0 return tmp
function code(x, y, z) tmp = 0.0 if ((x <= -5.5e+34) || !(x <= 4.1e+129)) tmp = Float64(Float64(4.0 * x) / y); else tmp = Float64(Float64(z / y) * -4.0); end return tmp end
function tmp_2 = code(x, y, z) tmp = 0.0; if ((x <= -5.5e+34) || ~((x <= 4.1e+129))) tmp = (4.0 * x) / y; else tmp = (z / y) * -4.0; end tmp_2 = tmp; end
code[x_, y_, z_] := If[Or[LessEqual[x, -5.5e+34], N[Not[LessEqual[x, 4.1e+129]], $MachinePrecision]], N[(N[(4.0 * x), $MachinePrecision] / y), $MachinePrecision], N[(N[(z / y), $MachinePrecision] * -4.0), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x \leq -5.5 \cdot 10^{+34} \lor \neg \left(x \leq 4.1 \cdot 10^{+129}\right):\\
\;\;\;\;\frac{4 \cdot x}{y}\\
\mathbf{else}:\\
\;\;\;\;\frac{z}{y} \cdot -4\\
\end{array}
\end{array}
if x < -5.4999999999999996e34 or 4.1000000000000003e129 < x Initial program 100.0%
Taylor expanded in x around inf 77.8%
associate-*r/77.8%
Simplified77.8%
if -5.4999999999999996e34 < x < 4.1000000000000003e129Initial program 100.0%
Taylor expanded in z around inf 53.8%
*-commutative53.8%
Simplified53.8%
Final simplification63.1%
(FPCore (x y z) :precision binary64 (if (or (<= x -1.35e+35) (not (<= x 3.3e+128))) (/ 4.0 (/ y x)) (* (/ z y) -4.0)))
double code(double x, double y, double z) {
double tmp;
if ((x <= -1.35e+35) || !(x <= 3.3e+128)) {
tmp = 4.0 / (y / x);
} else {
tmp = (z / y) * -4.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 <= (-1.35d+35)) .or. (.not. (x <= 3.3d+128))) then
tmp = 4.0d0 / (y / x)
else
tmp = (z / y) * (-4.0d0)
end if
code = tmp
end function
public static double code(double x, double y, double z) {
double tmp;
if ((x <= -1.35e+35) || !(x <= 3.3e+128)) {
tmp = 4.0 / (y / x);
} else {
tmp = (z / y) * -4.0;
}
return tmp;
}
def code(x, y, z): tmp = 0 if (x <= -1.35e+35) or not (x <= 3.3e+128): tmp = 4.0 / (y / x) else: tmp = (z / y) * -4.0 return tmp
function code(x, y, z) tmp = 0.0 if ((x <= -1.35e+35) || !(x <= 3.3e+128)) tmp = Float64(4.0 / Float64(y / x)); else tmp = Float64(Float64(z / y) * -4.0); end return tmp end
function tmp_2 = code(x, y, z) tmp = 0.0; if ((x <= -1.35e+35) || ~((x <= 3.3e+128))) tmp = 4.0 / (y / x); else tmp = (z / y) * -4.0; end tmp_2 = tmp; end
code[x_, y_, z_] := If[Or[LessEqual[x, -1.35e+35], N[Not[LessEqual[x, 3.3e+128]], $MachinePrecision]], N[(4.0 / N[(y / x), $MachinePrecision]), $MachinePrecision], N[(N[(z / y), $MachinePrecision] * -4.0), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x \leq -1.35 \cdot 10^{+35} \lor \neg \left(x \leq 3.3 \cdot 10^{+128}\right):\\
\;\;\;\;\frac{4}{\frac{y}{x}}\\
\mathbf{else}:\\
\;\;\;\;\frac{z}{y} \cdot -4\\
\end{array}
\end{array}
if x < -1.35000000000000001e35 or 3.3000000000000001e128 < x Initial program 100.0%
Taylor expanded in y around 0 90.5%
clear-num90.4%
un-div-inv90.4%
Applied egg-rr90.4%
Taylor expanded in x around inf 77.8%
associate-*r/77.8%
associate-*l/77.6%
associate-/r/77.7%
Simplified77.7%
if -1.35000000000000001e35 < x < 3.3000000000000001e128Initial program 100.0%
Taylor expanded in z around inf 53.8%
*-commutative53.8%
Simplified53.8%
Final simplification63.0%
(FPCore (x y z) :precision binary64 (if (or (<= z -6.2e-19) (not (<= z 2.06e-112))) (* (/ z y) -4.0) 2.0))
double code(double x, double y, double z) {
double tmp;
if ((z <= -6.2e-19) || !(z <= 2.06e-112)) {
tmp = (z / y) * -4.0;
} 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 <= (-6.2d-19)) .or. (.not. (z <= 2.06d-112))) then
tmp = (z / y) * (-4.0d0)
else
tmp = 2.0d0
end if
code = tmp
end function
public static double code(double x, double y, double z) {
double tmp;
if ((z <= -6.2e-19) || !(z <= 2.06e-112)) {
tmp = (z / y) * -4.0;
} else {
tmp = 2.0;
}
return tmp;
}
def code(x, y, z): tmp = 0 if (z <= -6.2e-19) or not (z <= 2.06e-112): tmp = (z / y) * -4.0 else: tmp = 2.0 return tmp
function code(x, y, z) tmp = 0.0 if ((z <= -6.2e-19) || !(z <= 2.06e-112)) tmp = Float64(Float64(z / y) * -4.0); else tmp = 2.0; end return tmp end
function tmp_2 = code(x, y, z) tmp = 0.0; if ((z <= -6.2e-19) || ~((z <= 2.06e-112))) tmp = (z / y) * -4.0; else tmp = 2.0; end tmp_2 = tmp; end
code[x_, y_, z_] := If[Or[LessEqual[z, -6.2e-19], N[Not[LessEqual[z, 2.06e-112]], $MachinePrecision]], N[(N[(z / y), $MachinePrecision] * -4.0), $MachinePrecision], 2.0]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \leq -6.2 \cdot 10^{-19} \lor \neg \left(z \leq 2.06 \cdot 10^{-112}\right):\\
\;\;\;\;\frac{z}{y} \cdot -4\\
\mathbf{else}:\\
\;\;\;\;2\\
\end{array}
\end{array}
if z < -6.1999999999999998e-19 or 2.06000000000000004e-112 < z Initial program 99.9%
Taylor expanded in z around inf 59.2%
*-commutative59.2%
Simplified59.2%
if -6.1999999999999998e-19 < z < 2.06000000000000004e-112Initial program 100.0%
Taylor expanded in y around inf 48.0%
Final simplification55.2%
(FPCore (x y z) :precision binary64 (if (or (<= z -8e-19) (not (<= z 4.2e-112))) (* z (/ -4.0 y)) 2.0))
double code(double x, double y, double z) {
double tmp;
if ((z <= -8e-19) || !(z <= 4.2e-112)) {
tmp = z * (-4.0 / y);
} 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 <= (-8d-19)) .or. (.not. (z <= 4.2d-112))) then
tmp = z * ((-4.0d0) / y)
else
tmp = 2.0d0
end if
code = tmp
end function
public static double code(double x, double y, double z) {
double tmp;
if ((z <= -8e-19) || !(z <= 4.2e-112)) {
tmp = z * (-4.0 / y);
} else {
tmp = 2.0;
}
return tmp;
}
def code(x, y, z): tmp = 0 if (z <= -8e-19) or not (z <= 4.2e-112): tmp = z * (-4.0 / y) else: tmp = 2.0 return tmp
function code(x, y, z) tmp = 0.0 if ((z <= -8e-19) || !(z <= 4.2e-112)) tmp = Float64(z * Float64(-4.0 / y)); else tmp = 2.0; end return tmp end
function tmp_2 = code(x, y, z) tmp = 0.0; if ((z <= -8e-19) || ~((z <= 4.2e-112))) tmp = z * (-4.0 / y); else tmp = 2.0; end tmp_2 = tmp; end
code[x_, y_, z_] := If[Or[LessEqual[z, -8e-19], N[Not[LessEqual[z, 4.2e-112]], $MachinePrecision]], N[(z * N[(-4.0 / y), $MachinePrecision]), $MachinePrecision], 2.0]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \leq -8 \cdot 10^{-19} \lor \neg \left(z \leq 4.2 \cdot 10^{-112}\right):\\
\;\;\;\;z \cdot \frac{-4}{y}\\
\mathbf{else}:\\
\;\;\;\;2\\
\end{array}
\end{array}
if z < -7.9999999999999998e-19 or 4.2000000000000001e-112 < z Initial program 99.9%
Taylor expanded in z around inf 59.2%
associate-*r/59.2%
*-commutative59.2%
associate-/l*59.1%
Simplified59.1%
if -7.9999999999999998e-19 < z < 4.2000000000000001e-112Initial program 100.0%
Taylor expanded in y around inf 48.0%
Final simplification55.1%
(FPCore (x y z) :precision binary64 (+ (* (/ 4.0 y) (- x z)) 2.0))
double code(double x, double y, double z) {
return ((4.0 / y) * (x - 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 / y) * (x - z)) + 2.0d0
end function
public static double code(double x, double y, double z) {
return ((4.0 / y) * (x - z)) + 2.0;
}
def code(x, y, z): return ((4.0 / y) * (x - z)) + 2.0
function code(x, y, z) return Float64(Float64(Float64(4.0 / y) * Float64(x - z)) + 2.0) end
function tmp = code(x, y, z) tmp = ((4.0 / y) * (x - z)) + 2.0; end
code[x_, y_, z_] := N[(N[(N[(4.0 / y), $MachinePrecision] * N[(x - z), $MachinePrecision]), $MachinePrecision] + 2.0), $MachinePrecision]
\begin{array}{l}
\\
\frac{4}{y} \cdot \left(x - z\right) + 2
\end{array}
Initial program 100.0%
+-commutative100.0%
associate-*l/99.7%
+-commutative99.7%
associate--l+99.7%
+-commutative99.7%
distribute-lft-in99.7%
associate-+l+99.7%
associate-*l/99.7%
*-commutative99.7%
associate-*l*99.7%
metadata-eval99.7%
*-rgt-identity99.7%
*-inverses99.7%
metadata-eval99.7%
Simplified99.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 y around inf 27.2%
herbie shell --seed 2024132
(FPCore (x y z)
:name "Data.Array.Repa.Algorithms.ColorRamp:rampColorHotToCold from repa-algorithms-3.4.0.1, C"
:precision binary64
(+ 1.0 (/ (* 4.0 (- (+ x (* y 0.25)) z)) y)))