
(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 9 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 (+ (/ (- x z) (* y 0.25)) 2.0))
double code(double x, double y, double z) {
return ((x - z) / (y * 0.25)) + 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 = ((x - z) / (y * 0.25d0)) + 2.0d0
end function
public static double code(double x, double y, double z) {
return ((x - z) / (y * 0.25)) + 2.0;
}
def code(x, y, z): return ((x - z) / (y * 0.25)) + 2.0
function code(x, y, z) return Float64(Float64(Float64(x - z) / Float64(y * 0.25)) + 2.0) end
function tmp = code(x, y, z) tmp = ((x - z) / (y * 0.25)) + 2.0; end
code[x_, y_, z_] := N[(N[(N[(x - z), $MachinePrecision] / N[(y * 0.25), $MachinePrecision]), $MachinePrecision] + 2.0), $MachinePrecision]
\begin{array}{l}
\\
\frac{x - z}{y \cdot 0.25} + 2
\end{array}
Initial program 100.0%
+-commutative100.0%
associate-*l/99.7%
+-commutative99.7%
associate--l+99.7%
+-commutative99.7%
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%
clear-num99.8%
div-inv99.8%
metadata-eval99.8%
associate-*l/100.0%
*-un-lft-identity100.0%
Applied egg-rr100.0%
(FPCore (x y z)
:precision binary64
(if (or (<= z -9.5e+66)
(and (not (<= z -7.4e-6)) (or (<= z -3.4e-10) (not (<= z 7.2e+28)))))
(+ 2.0 (* -4.0 (/ z y)))
(+ 2.0 (* 4.0 (/ x y)))))
double code(double x, double y, double z) {
double tmp;
if ((z <= -9.5e+66) || (!(z <= -7.4e-6) && ((z <= -3.4e-10) || !(z <= 7.2e+28)))) {
tmp = 2.0 + (-4.0 * (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 <= (-9.5d+66)) .or. (.not. (z <= (-7.4d-6))) .and. (z <= (-3.4d-10)) .or. (.not. (z <= 7.2d+28))) then
tmp = 2.0d0 + ((-4.0d0) * (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 <= -9.5e+66) || (!(z <= -7.4e-6) && ((z <= -3.4e-10) || !(z <= 7.2e+28)))) {
tmp = 2.0 + (-4.0 * (z / y));
} else {
tmp = 2.0 + (4.0 * (x / y));
}
return tmp;
}
def code(x, y, z): tmp = 0 if (z <= -9.5e+66) or (not (z <= -7.4e-6) and ((z <= -3.4e-10) or not (z <= 7.2e+28))): tmp = 2.0 + (-4.0 * (z / y)) else: tmp = 2.0 + (4.0 * (x / y)) return tmp
function code(x, y, z) tmp = 0.0 if ((z <= -9.5e+66) || (!(z <= -7.4e-6) && ((z <= -3.4e-10) || !(z <= 7.2e+28)))) tmp = Float64(2.0 + Float64(-4.0 * Float64(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 <= -9.5e+66) || (~((z <= -7.4e-6)) && ((z <= -3.4e-10) || ~((z <= 7.2e+28))))) tmp = 2.0 + (-4.0 * (z / y)); else tmp = 2.0 + (4.0 * (x / y)); end tmp_2 = tmp; end
code[x_, y_, z_] := If[Or[LessEqual[z, -9.5e+66], And[N[Not[LessEqual[z, -7.4e-6]], $MachinePrecision], Or[LessEqual[z, -3.4e-10], N[Not[LessEqual[z, 7.2e+28]], $MachinePrecision]]]], N[(2.0 + N[(-4.0 * N[(z / y), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(2.0 + N[(4.0 * N[(x / y), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \leq -9.5 \cdot 10^{+66} \lor \neg \left(z \leq -7.4 \cdot 10^{-6}\right) \land \left(z \leq -3.4 \cdot 10^{-10} \lor \neg \left(z \leq 7.2 \cdot 10^{+28}\right)\right):\\
\;\;\;\;2 + -4 \cdot \frac{z}{y}\\
\mathbf{else}:\\
\;\;\;\;2 + 4 \cdot \frac{x}{y}\\
\end{array}
\end{array}
if z < -9.50000000000000051e66 or -7.4000000000000003e-6 < z < -3.40000000000000015e-10 or 7.1999999999999999e28 < z Initial program 100.0%
+-commutative100.0%
associate-*l/99.7%
+-commutative99.7%
associate--l+99.7%
+-commutative99.7%
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%
clear-num99.8%
div-inv99.8%
metadata-eval99.8%
associate-*l/100.0%
*-un-lft-identity100.0%
Applied egg-rr100.0%
Taylor expanded in x around 0 85.5%
if -9.50000000000000051e66 < z < -7.4000000000000003e-6 or -3.40000000000000015e-10 < z < 7.1999999999999999e28Initial program 100.0%
+-commutative100.0%
associate-*l/99.7%
+-commutative99.7%
associate--l+99.7%
+-commutative99.7%
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%
clear-num99.8%
div-inv99.8%
metadata-eval99.8%
associate-*l/100.0%
*-un-lft-identity100.0%
Applied egg-rr100.0%
Taylor expanded in x around inf 88.7%
Final simplification87.3%
(FPCore (x y z)
:precision binary64
(if (<= y -1.55e+161)
2.0
(if (or (<= y -6.5e+83) (and (not (<= y -2.9e+59)) (<= y 1.05e-30)))
(+ (* -4.0 (/ z y)) 1.0)
2.0)))
double code(double x, double y, double z) {
double tmp;
if (y <= -1.55e+161) {
tmp = 2.0;
} else if ((y <= -6.5e+83) || (!(y <= -2.9e+59) && (y <= 1.05e-30))) {
tmp = (-4.0 * (z / y)) + 1.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 (y <= (-1.55d+161)) then
tmp = 2.0d0
else if ((y <= (-6.5d+83)) .or. (.not. (y <= (-2.9d+59))) .and. (y <= 1.05d-30)) then
tmp = ((-4.0d0) * (z / y)) + 1.0d0
else
tmp = 2.0d0
end if
code = tmp
end function
public static double code(double x, double y, double z) {
double tmp;
if (y <= -1.55e+161) {
tmp = 2.0;
} else if ((y <= -6.5e+83) || (!(y <= -2.9e+59) && (y <= 1.05e-30))) {
tmp = (-4.0 * (z / y)) + 1.0;
} else {
tmp = 2.0;
}
return tmp;
}
def code(x, y, z): tmp = 0 if y <= -1.55e+161: tmp = 2.0 elif (y <= -6.5e+83) or (not (y <= -2.9e+59) and (y <= 1.05e-30)): tmp = (-4.0 * (z / y)) + 1.0 else: tmp = 2.0 return tmp
function code(x, y, z) tmp = 0.0 if (y <= -1.55e+161) tmp = 2.0; elseif ((y <= -6.5e+83) || (!(y <= -2.9e+59) && (y <= 1.05e-30))) tmp = Float64(Float64(-4.0 * Float64(z / y)) + 1.0); else tmp = 2.0; end return tmp end
function tmp_2 = code(x, y, z) tmp = 0.0; if (y <= -1.55e+161) tmp = 2.0; elseif ((y <= -6.5e+83) || (~((y <= -2.9e+59)) && (y <= 1.05e-30))) tmp = (-4.0 * (z / y)) + 1.0; else tmp = 2.0; end tmp_2 = tmp; end
code[x_, y_, z_] := If[LessEqual[y, -1.55e+161], 2.0, If[Or[LessEqual[y, -6.5e+83], And[N[Not[LessEqual[y, -2.9e+59]], $MachinePrecision], LessEqual[y, 1.05e-30]]], N[(N[(-4.0 * N[(z / y), $MachinePrecision]), $MachinePrecision] + 1.0), $MachinePrecision], 2.0]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;y \leq -1.55 \cdot 10^{+161}:\\
\;\;\;\;2\\
\mathbf{elif}\;y \leq -6.5 \cdot 10^{+83} \lor \neg \left(y \leq -2.9 \cdot 10^{+59}\right) \land y \leq 1.05 \cdot 10^{-30}:\\
\;\;\;\;-4 \cdot \frac{z}{y} + 1\\
\mathbf{else}:\\
\;\;\;\;2\\
\end{array}
\end{array}
if y < -1.55000000000000003e161 or -6.5000000000000003e83 < y < -2.89999999999999991e59 or 1.0500000000000001e-30 < y Initial program 100.0%
Taylor expanded in y around inf 62.8%
if -1.55000000000000003e161 < y < -6.5000000000000003e83 or -2.89999999999999991e59 < y < 1.0500000000000001e-30Initial program 100.0%
Taylor expanded in z around inf 51.7%
*-commutative51.7%
Simplified51.7%
Final simplification56.2%
(FPCore (x y z)
:precision binary64
(if (<= y -1.4e+161)
2.0
(if (or (<= y -1.22e+87) (and (not (<= y -4.5e+60)) (<= y 1e-30)))
(+ 1.0 (* z (/ -4.0 y)))
2.0)))
double code(double x, double y, double z) {
double tmp;
if (y <= -1.4e+161) {
tmp = 2.0;
} else if ((y <= -1.22e+87) || (!(y <= -4.5e+60) && (y <= 1e-30))) {
tmp = 1.0 + (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 (y <= (-1.4d+161)) then
tmp = 2.0d0
else if ((y <= (-1.22d+87)) .or. (.not. (y <= (-4.5d+60))) .and. (y <= 1d-30)) then
tmp = 1.0d0 + (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 (y <= -1.4e+161) {
tmp = 2.0;
} else if ((y <= -1.22e+87) || (!(y <= -4.5e+60) && (y <= 1e-30))) {
tmp = 1.0 + (z * (-4.0 / y));
} else {
tmp = 2.0;
}
return tmp;
}
def code(x, y, z): tmp = 0 if y <= -1.4e+161: tmp = 2.0 elif (y <= -1.22e+87) or (not (y <= -4.5e+60) and (y <= 1e-30)): tmp = 1.0 + (z * (-4.0 / y)) else: tmp = 2.0 return tmp
function code(x, y, z) tmp = 0.0 if (y <= -1.4e+161) tmp = 2.0; elseif ((y <= -1.22e+87) || (!(y <= -4.5e+60) && (y <= 1e-30))) tmp = Float64(1.0 + 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 (y <= -1.4e+161) tmp = 2.0; elseif ((y <= -1.22e+87) || (~((y <= -4.5e+60)) && (y <= 1e-30))) tmp = 1.0 + (z * (-4.0 / y)); else tmp = 2.0; end tmp_2 = tmp; end
code[x_, y_, z_] := If[LessEqual[y, -1.4e+161], 2.0, If[Or[LessEqual[y, -1.22e+87], And[N[Not[LessEqual[y, -4.5e+60]], $MachinePrecision], LessEqual[y, 1e-30]]], N[(1.0 + N[(z * N[(-4.0 / y), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], 2.0]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;y \leq -1.4 \cdot 10^{+161}:\\
\;\;\;\;2\\
\mathbf{elif}\;y \leq -1.22 \cdot 10^{+87} \lor \neg \left(y \leq -4.5 \cdot 10^{+60}\right) \land y \leq 10^{-30}:\\
\;\;\;\;1 + z \cdot \frac{-4}{y}\\
\mathbf{else}:\\
\;\;\;\;2\\
\end{array}
\end{array}
if y < -1.4000000000000001e161 or -1.2200000000000001e87 < y < -4.50000000000000013e60 or 1e-30 < y Initial program 100.0%
Taylor expanded in y around inf 62.8%
if -1.4000000000000001e161 < y < -1.2200000000000001e87 or -4.50000000000000013e60 < y < 1e-30Initial program 100.0%
Taylor expanded in z around inf 51.7%
associate-*r/51.7%
metadata-eval51.7%
associate-*r*51.7%
neg-mul-151.7%
*-commutative51.7%
associate-*r/51.6%
distribute-lft-neg-out51.6%
distribute-rgt-neg-in51.6%
distribute-neg-frac51.6%
metadata-eval51.6%
Simplified51.6%
Final simplification56.1%
(FPCore (x y z) :precision binary64 (if (or (<= x -1.02e+234) (not (<= x 4.7e+87))) (+ 1.0 (/ (* x 4.0) y)) (+ 2.0 (* -4.0 (/ z y)))))
double code(double x, double y, double z) {
double tmp;
if ((x <= -1.02e+234) || !(x <= 4.7e+87)) {
tmp = 1.0 + ((x * 4.0) / y);
} else {
tmp = 2.0 + (-4.0 * (z / 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 ((x <= (-1.02d+234)) .or. (.not. (x <= 4.7d+87))) then
tmp = 1.0d0 + ((x * 4.0d0) / y)
else
tmp = 2.0d0 + ((-4.0d0) * (z / y))
end if
code = tmp
end function
public static double code(double x, double y, double z) {
double tmp;
if ((x <= -1.02e+234) || !(x <= 4.7e+87)) {
tmp = 1.0 + ((x * 4.0) / y);
} else {
tmp = 2.0 + (-4.0 * (z / y));
}
return tmp;
}
def code(x, y, z): tmp = 0 if (x <= -1.02e+234) or not (x <= 4.7e+87): tmp = 1.0 + ((x * 4.0) / y) else: tmp = 2.0 + (-4.0 * (z / y)) return tmp
function code(x, y, z) tmp = 0.0 if ((x <= -1.02e+234) || !(x <= 4.7e+87)) tmp = Float64(1.0 + Float64(Float64(x * 4.0) / y)); else tmp = Float64(2.0 + Float64(-4.0 * Float64(z / y))); end return tmp end
function tmp_2 = code(x, y, z) tmp = 0.0; if ((x <= -1.02e+234) || ~((x <= 4.7e+87))) tmp = 1.0 + ((x * 4.0) / y); else tmp = 2.0 + (-4.0 * (z / y)); end tmp_2 = tmp; end
code[x_, y_, z_] := If[Or[LessEqual[x, -1.02e+234], N[Not[LessEqual[x, 4.7e+87]], $MachinePrecision]], N[(1.0 + N[(N[(x * 4.0), $MachinePrecision] / y), $MachinePrecision]), $MachinePrecision], N[(2.0 + N[(-4.0 * N[(z / y), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x \leq -1.02 \cdot 10^{+234} \lor \neg \left(x \leq 4.7 \cdot 10^{+87}\right):\\
\;\;\;\;1 + \frac{x \cdot 4}{y}\\
\mathbf{else}:\\
\;\;\;\;2 + -4 \cdot \frac{z}{y}\\
\end{array}
\end{array}
if x < -1.02000000000000002e234 or 4.7000000000000004e87 < x Initial program 100.0%
Taylor expanded in x around inf 82.9%
*-commutative82.9%
associate-*l/82.9%
Simplified82.9%
if -1.02000000000000002e234 < x < 4.7000000000000004e87Initial program 100.0%
+-commutative100.0%
associate-*l/99.7%
+-commutative99.7%
associate--l+99.7%
+-commutative99.7%
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%
clear-num99.8%
div-inv99.8%
metadata-eval99.8%
associate-*l/100.0%
*-un-lft-identity100.0%
Applied egg-rr100.0%
Taylor expanded in x around 0 80.7%
Final simplification81.2%
(FPCore (x y z) :precision binary64 (if (or (<= x -1060000000000.0) (not (<= x 1.35e-22))) (+ 1.0 (/ (* x 4.0) y)) (+ (* -4.0 (/ z y)) 1.0)))
double code(double x, double y, double z) {
double tmp;
if ((x <= -1060000000000.0) || !(x <= 1.35e-22)) {
tmp = 1.0 + ((x * 4.0) / y);
} else {
tmp = (-4.0 * (z / y)) + 1.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 <= (-1060000000000.0d0)) .or. (.not. (x <= 1.35d-22))) then
tmp = 1.0d0 + ((x * 4.0d0) / y)
else
tmp = ((-4.0d0) * (z / y)) + 1.0d0
end if
code = tmp
end function
public static double code(double x, double y, double z) {
double tmp;
if ((x <= -1060000000000.0) || !(x <= 1.35e-22)) {
tmp = 1.0 + ((x * 4.0) / y);
} else {
tmp = (-4.0 * (z / y)) + 1.0;
}
return tmp;
}
def code(x, y, z): tmp = 0 if (x <= -1060000000000.0) or not (x <= 1.35e-22): tmp = 1.0 + ((x * 4.0) / y) else: tmp = (-4.0 * (z / y)) + 1.0 return tmp
function code(x, y, z) tmp = 0.0 if ((x <= -1060000000000.0) || !(x <= 1.35e-22)) tmp = Float64(1.0 + Float64(Float64(x * 4.0) / y)); else tmp = Float64(Float64(-4.0 * Float64(z / y)) + 1.0); end return tmp end
function tmp_2 = code(x, y, z) tmp = 0.0; if ((x <= -1060000000000.0) || ~((x <= 1.35e-22))) tmp = 1.0 + ((x * 4.0) / y); else tmp = (-4.0 * (z / y)) + 1.0; end tmp_2 = tmp; end
code[x_, y_, z_] := If[Or[LessEqual[x, -1060000000000.0], N[Not[LessEqual[x, 1.35e-22]], $MachinePrecision]], N[(1.0 + N[(N[(x * 4.0), $MachinePrecision] / y), $MachinePrecision]), $MachinePrecision], N[(N[(-4.0 * N[(z / y), $MachinePrecision]), $MachinePrecision] + 1.0), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x \leq -1060000000000 \lor \neg \left(x \leq 1.35 \cdot 10^{-22}\right):\\
\;\;\;\;1 + \frac{x \cdot 4}{y}\\
\mathbf{else}:\\
\;\;\;\;-4 \cdot \frac{z}{y} + 1\\
\end{array}
\end{array}
if x < -1.06e12 or 1.3500000000000001e-22 < x Initial program 100.0%
Taylor expanded in x around inf 62.2%
*-commutative62.2%
associate-*l/62.2%
Simplified62.2%
if -1.06e12 < x < 1.3500000000000001e-22Initial program 100.0%
Taylor expanded in z around inf 59.4%
*-commutative59.4%
Simplified59.4%
Final simplification60.8%
(FPCore (x y z) :precision binary64 (+ 2.0 (* (- x z) (/ 4.0 y))))
double code(double x, double y, double z) {
return 2.0 + ((x - z) * (4.0 / y));
}
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 + ((x - z) * (4.0d0 / y))
end function
public static double code(double x, double y, double z) {
return 2.0 + ((x - z) * (4.0 / y));
}
def code(x, y, z): return 2.0 + ((x - z) * (4.0 / y))
function code(x, y, z) return Float64(2.0 + Float64(Float64(x - z) * Float64(4.0 / y))) end
function tmp = code(x, y, z) tmp = 2.0 + ((x - z) * (4.0 / y)); end
code[x_, y_, z_] := N[(2.0 + N[(N[(x - z), $MachinePrecision] * N[(4.0 / y), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
2 + \left(x - z\right) \cdot \frac{4}{y}
\end{array}
Initial program 100.0%
+-commutative100.0%
associate-*l/99.7%
+-commutative99.7%
associate--l+99.7%
+-commutative99.7%
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%
Final simplification99.8%
(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 31.4%
(FPCore (x y z) :precision binary64 1.0)
double code(double x, double y, double z) {
return 1.0;
}
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
end function
public static double code(double x, double y, double z) {
return 1.0;
}
def code(x, y, z): return 1.0
function code(x, y, z) return 1.0 end
function tmp = code(x, y, z) tmp = 1.0; end
code[x_, y_, z_] := 1.0
\begin{array}{l}
\\
1
\end{array}
Initial program 100.0%
Taylor expanded in z around inf 42.7%
associate-*r/42.7%
metadata-eval42.7%
associate-*r*42.7%
neg-mul-142.7%
*-commutative42.7%
associate-*r/42.6%
distribute-lft-neg-out42.6%
distribute-rgt-neg-in42.6%
distribute-neg-frac42.6%
metadata-eval42.6%
Simplified42.6%
Taylor expanded in z around 0 8.2%
herbie shell --seed 2024107
(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)))