
(FPCore (x y z) :precision binary64 (+ 1.0 (/ (* 4.0 (- (+ x (* y 0.75)) z)) y)))
double code(double x, double y, double z) {
return 1.0 + ((4.0 * ((x + (y * 0.75)) - 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.75d0)) - z)) / y)
end function
public static double code(double x, double y, double z) {
return 1.0 + ((4.0 * ((x + (y * 0.75)) - z)) / y);
}
def code(x, y, z): return 1.0 + ((4.0 * ((x + (y * 0.75)) - z)) / y)
function code(x, y, z) return Float64(1.0 + Float64(Float64(4.0 * Float64(Float64(x + Float64(y * 0.75)) - z)) / y)) end
function tmp = code(x, y, z) tmp = 1.0 + ((4.0 * ((x + (y * 0.75)) - z)) / y); end
code[x_, y_, z_] := N[(1.0 + N[(N[(4.0 * N[(N[(x + N[(y * 0.75), $MachinePrecision]), $MachinePrecision] - z), $MachinePrecision]), $MachinePrecision] / y), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
1 + \frac{4 \cdot \left(\left(x + y \cdot 0.75\right) - z\right)}{y}
\end{array}
Sampling outcomes in binary64 precision:
Herbie found 7 alternatives:
| Alternative | Accuracy | Speedup |
|---|
(FPCore (x y z) :precision binary64 (+ 1.0 (/ (* 4.0 (- (+ x (* y 0.75)) z)) y)))
double code(double x, double y, double z) {
return 1.0 + ((4.0 * ((x + (y * 0.75)) - 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.75d0)) - z)) / y)
end function
public static double code(double x, double y, double z) {
return 1.0 + ((4.0 * ((x + (y * 0.75)) - z)) / y);
}
def code(x, y, z): return 1.0 + ((4.0 * ((x + (y * 0.75)) - z)) / y)
function code(x, y, z) return Float64(1.0 + Float64(Float64(4.0 * Float64(Float64(x + Float64(y * 0.75)) - z)) / y)) end
function tmp = code(x, y, z) tmp = 1.0 + ((4.0 * ((x + (y * 0.75)) - z)) / y); end
code[x_, y_, z_] := N[(1.0 + N[(N[(4.0 * N[(N[(x + N[(y * 0.75), $MachinePrecision]), $MachinePrecision] - z), $MachinePrecision]), $MachinePrecision] / y), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
1 + \frac{4 \cdot \left(\left(x + y \cdot 0.75\right) - z\right)}{y}
\end{array}
(FPCore (x y z) :precision binary64 (+ 4.0 (/ (* 4.0 (- x z)) y)))
double code(double x, double y, double z) {
return 4.0 + ((4.0 * (x - 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 = 4.0d0 + ((4.0d0 * (x - z)) / y)
end function
public static double code(double x, double y, double z) {
return 4.0 + ((4.0 * (x - z)) / y);
}
def code(x, y, z): return 4.0 + ((4.0 * (x - z)) / y)
function code(x, y, z) return Float64(4.0 + Float64(Float64(4.0 * Float64(x - z)) / y)) end
function tmp = code(x, y, z) tmp = 4.0 + ((4.0 * (x - z)) / y); end
code[x_, y_, z_] := N[(4.0 + N[(N[(4.0 * N[(x - z), $MachinePrecision]), $MachinePrecision] / y), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
4 + \frac{4 \cdot \left(x - z\right)}{y}
\end{array}
Initial program 99.9%
associate-*l/99.8%
+-commutative99.8%
fma-def99.7%
Simplified99.7%
Taylor expanded in y around 0 100.0%
associate-*r/100.0%
Simplified100.0%
Final simplification100.0%
(FPCore (x y z)
:precision binary64
(let* ((t_0 (+ 1.0 (* (/ z y) -4.0))) (t_1 (+ 1.0 (/ 4.0 (/ y x)))))
(if (<= x -6e+18)
t_1
(if (<= x -7e-260)
4.0
(if (<= x 8e-288)
t_0
(if (<= x 1.2e-208)
4.0
(if (<= x 6.5e-58) t_0 (if (<= x 2e+27) 4.0 t_1))))))))
double code(double x, double y, double z) {
double t_0 = 1.0 + ((z / y) * -4.0);
double t_1 = 1.0 + (4.0 / (y / x));
double tmp;
if (x <= -6e+18) {
tmp = t_1;
} else if (x <= -7e-260) {
tmp = 4.0;
} else if (x <= 8e-288) {
tmp = t_0;
} else if (x <= 1.2e-208) {
tmp = 4.0;
} else if (x <= 6.5e-58) {
tmp = t_0;
} else if (x <= 2e+27) {
tmp = 4.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 = 1.0d0 + ((z / y) * (-4.0d0))
t_1 = 1.0d0 + (4.0d0 / (y / x))
if (x <= (-6d+18)) then
tmp = t_1
else if (x <= (-7d-260)) then
tmp = 4.0d0
else if (x <= 8d-288) then
tmp = t_0
else if (x <= 1.2d-208) then
tmp = 4.0d0
else if (x <= 6.5d-58) then
tmp = t_0
else if (x <= 2d+27) then
tmp = 4.0d0
else
tmp = t_1
end if
code = tmp
end function
public static double code(double x, double y, double z) {
double t_0 = 1.0 + ((z / y) * -4.0);
double t_1 = 1.0 + (4.0 / (y / x));
double tmp;
if (x <= -6e+18) {
tmp = t_1;
} else if (x <= -7e-260) {
tmp = 4.0;
} else if (x <= 8e-288) {
tmp = t_0;
} else if (x <= 1.2e-208) {
tmp = 4.0;
} else if (x <= 6.5e-58) {
tmp = t_0;
} else if (x <= 2e+27) {
tmp = 4.0;
} else {
tmp = t_1;
}
return tmp;
}
def code(x, y, z): t_0 = 1.0 + ((z / y) * -4.0) t_1 = 1.0 + (4.0 / (y / x)) tmp = 0 if x <= -6e+18: tmp = t_1 elif x <= -7e-260: tmp = 4.0 elif x <= 8e-288: tmp = t_0 elif x <= 1.2e-208: tmp = 4.0 elif x <= 6.5e-58: tmp = t_0 elif x <= 2e+27: tmp = 4.0 else: tmp = t_1 return tmp
function code(x, y, z) t_0 = Float64(1.0 + Float64(Float64(z / y) * -4.0)) t_1 = Float64(1.0 + Float64(4.0 / Float64(y / x))) tmp = 0.0 if (x <= -6e+18) tmp = t_1; elseif (x <= -7e-260) tmp = 4.0; elseif (x <= 8e-288) tmp = t_0; elseif (x <= 1.2e-208) tmp = 4.0; elseif (x <= 6.5e-58) tmp = t_0; elseif (x <= 2e+27) tmp = 4.0; else tmp = t_1; end return tmp end
function tmp_2 = code(x, y, z) t_0 = 1.0 + ((z / y) * -4.0); t_1 = 1.0 + (4.0 / (y / x)); tmp = 0.0; if (x <= -6e+18) tmp = t_1; elseif (x <= -7e-260) tmp = 4.0; elseif (x <= 8e-288) tmp = t_0; elseif (x <= 1.2e-208) tmp = 4.0; elseif (x <= 6.5e-58) tmp = t_0; elseif (x <= 2e+27) tmp = 4.0; else tmp = t_1; end tmp_2 = tmp; end
code[x_, y_, z_] := Block[{t$95$0 = N[(1.0 + N[(N[(z / y), $MachinePrecision] * -4.0), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$1 = N[(1.0 + N[(4.0 / N[(y / x), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[x, -6e+18], t$95$1, If[LessEqual[x, -7e-260], 4.0, If[LessEqual[x, 8e-288], t$95$0, If[LessEqual[x, 1.2e-208], 4.0, If[LessEqual[x, 6.5e-58], t$95$0, If[LessEqual[x, 2e+27], 4.0, t$95$1]]]]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := 1 + \frac{z}{y} \cdot -4\\
t_1 := 1 + \frac{4}{\frac{y}{x}}\\
\mathbf{if}\;x \leq -6 \cdot 10^{+18}:\\
\;\;\;\;t_1\\
\mathbf{elif}\;x \leq -7 \cdot 10^{-260}:\\
\;\;\;\;4\\
\mathbf{elif}\;x \leq 8 \cdot 10^{-288}:\\
\;\;\;\;t_0\\
\mathbf{elif}\;x \leq 1.2 \cdot 10^{-208}:\\
\;\;\;\;4\\
\mathbf{elif}\;x \leq 6.5 \cdot 10^{-58}:\\
\;\;\;\;t_0\\
\mathbf{elif}\;x \leq 2 \cdot 10^{+27}:\\
\;\;\;\;4\\
\mathbf{else}:\\
\;\;\;\;t_1\\
\end{array}
\end{array}
if x < -6e18 or 2e27 < x Initial program 99.9%
associate-*l/99.7%
+-commutative99.7%
fma-def99.7%
Simplified99.7%
fma-udef99.7%
+-commutative99.7%
associate-/r/99.6%
+-commutative99.6%
associate-+r-99.6%
fma-udef99.6%
Applied egg-rr99.6%
Taylor expanded in x around inf 68.3%
if -6e18 < x < -6.9999999999999999e-260 or 8.00000000000000046e-288 < x < 1.1999999999999999e-208 or 6.49999999999999964e-58 < x < 2e27Initial program 100.0%
associate-*l/99.8%
+-commutative99.8%
fma-def99.7%
Simplified99.7%
Taylor expanded in y around inf 61.4%
if -6.9999999999999999e-260 < x < 8.00000000000000046e-288 or 1.1999999999999999e-208 < x < 6.49999999999999964e-58Initial program 99.9%
associate-*l/99.8%
+-commutative99.8%
fma-def99.8%
Simplified99.8%
Taylor expanded in z around inf 62.6%
*-commutative62.6%
Simplified62.6%
Final simplification64.9%
(FPCore (x y z)
:precision binary64
(let* ((t_0 (+ 1.0 (* (/ z y) -4.0))) (t_1 (+ 1.0 (/ (* 4.0 x) y))))
(if (<= x -1.75e+16)
t_1
(if (<= x -3e-260)
4.0
(if (<= x 2.5e-292)
t_0
(if (<= x 1.7e-208)
4.0
(if (<= x 8.8e-61) t_0 (if (<= x 1.95e+27) 4.0 t_1))))))))
double code(double x, double y, double z) {
double t_0 = 1.0 + ((z / y) * -4.0);
double t_1 = 1.0 + ((4.0 * x) / y);
double tmp;
if (x <= -1.75e+16) {
tmp = t_1;
} else if (x <= -3e-260) {
tmp = 4.0;
} else if (x <= 2.5e-292) {
tmp = t_0;
} else if (x <= 1.7e-208) {
tmp = 4.0;
} else if (x <= 8.8e-61) {
tmp = t_0;
} else if (x <= 1.95e+27) {
tmp = 4.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 = 1.0d0 + ((z / y) * (-4.0d0))
t_1 = 1.0d0 + ((4.0d0 * x) / y)
if (x <= (-1.75d+16)) then
tmp = t_1
else if (x <= (-3d-260)) then
tmp = 4.0d0
else if (x <= 2.5d-292) then
tmp = t_0
else if (x <= 1.7d-208) then
tmp = 4.0d0
else if (x <= 8.8d-61) then
tmp = t_0
else if (x <= 1.95d+27) then
tmp = 4.0d0
else
tmp = t_1
end if
code = tmp
end function
public static double code(double x, double y, double z) {
double t_0 = 1.0 + ((z / y) * -4.0);
double t_1 = 1.0 + ((4.0 * x) / y);
double tmp;
if (x <= -1.75e+16) {
tmp = t_1;
} else if (x <= -3e-260) {
tmp = 4.0;
} else if (x <= 2.5e-292) {
tmp = t_0;
} else if (x <= 1.7e-208) {
tmp = 4.0;
} else if (x <= 8.8e-61) {
tmp = t_0;
} else if (x <= 1.95e+27) {
tmp = 4.0;
} else {
tmp = t_1;
}
return tmp;
}
def code(x, y, z): t_0 = 1.0 + ((z / y) * -4.0) t_1 = 1.0 + ((4.0 * x) / y) tmp = 0 if x <= -1.75e+16: tmp = t_1 elif x <= -3e-260: tmp = 4.0 elif x <= 2.5e-292: tmp = t_0 elif x <= 1.7e-208: tmp = 4.0 elif x <= 8.8e-61: tmp = t_0 elif x <= 1.95e+27: tmp = 4.0 else: tmp = t_1 return tmp
function code(x, y, z) t_0 = Float64(1.0 + Float64(Float64(z / y) * -4.0)) t_1 = Float64(1.0 + Float64(Float64(4.0 * x) / y)) tmp = 0.0 if (x <= -1.75e+16) tmp = t_1; elseif (x <= -3e-260) tmp = 4.0; elseif (x <= 2.5e-292) tmp = t_0; elseif (x <= 1.7e-208) tmp = 4.0; elseif (x <= 8.8e-61) tmp = t_0; elseif (x <= 1.95e+27) tmp = 4.0; else tmp = t_1; end return tmp end
function tmp_2 = code(x, y, z) t_0 = 1.0 + ((z / y) * -4.0); t_1 = 1.0 + ((4.0 * x) / y); tmp = 0.0; if (x <= -1.75e+16) tmp = t_1; elseif (x <= -3e-260) tmp = 4.0; elseif (x <= 2.5e-292) tmp = t_0; elseif (x <= 1.7e-208) tmp = 4.0; elseif (x <= 8.8e-61) tmp = t_0; elseif (x <= 1.95e+27) tmp = 4.0; else tmp = t_1; end tmp_2 = tmp; end
code[x_, y_, z_] := Block[{t$95$0 = N[(1.0 + N[(N[(z / y), $MachinePrecision] * -4.0), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$1 = N[(1.0 + N[(N[(4.0 * x), $MachinePrecision] / y), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[x, -1.75e+16], t$95$1, If[LessEqual[x, -3e-260], 4.0, If[LessEqual[x, 2.5e-292], t$95$0, If[LessEqual[x, 1.7e-208], 4.0, If[LessEqual[x, 8.8e-61], t$95$0, If[LessEqual[x, 1.95e+27], 4.0, t$95$1]]]]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := 1 + \frac{z}{y} \cdot -4\\
t_1 := 1 + \frac{4 \cdot x}{y}\\
\mathbf{if}\;x \leq -1.75 \cdot 10^{+16}:\\
\;\;\;\;t_1\\
\mathbf{elif}\;x \leq -3 \cdot 10^{-260}:\\
\;\;\;\;4\\
\mathbf{elif}\;x \leq 2.5 \cdot 10^{-292}:\\
\;\;\;\;t_0\\
\mathbf{elif}\;x \leq 1.7 \cdot 10^{-208}:\\
\;\;\;\;4\\
\mathbf{elif}\;x \leq 8.8 \cdot 10^{-61}:\\
\;\;\;\;t_0\\
\mathbf{elif}\;x \leq 1.95 \cdot 10^{+27}:\\
\;\;\;\;4\\
\mathbf{else}:\\
\;\;\;\;t_1\\
\end{array}
\end{array}
if x < -1.75e16 or 1.9499999999999999e27 < x Initial program 99.9%
associate-*l/99.7%
+-commutative99.7%
fma-def99.7%
Simplified99.7%
Taylor expanded in x around inf 68.5%
associate-*r/68.5%
*-commutative68.5%
Simplified68.5%
if -1.75e16 < x < -3.0000000000000001e-260 or 2.49999999999999991e-292 < x < 1.7e-208 or 8.80000000000000035e-61 < x < 1.9499999999999999e27Initial program 100.0%
associate-*l/99.8%
+-commutative99.8%
fma-def99.7%
Simplified99.7%
Taylor expanded in y around inf 61.4%
if -3.0000000000000001e-260 < x < 2.49999999999999991e-292 or 1.7e-208 < x < 8.80000000000000035e-61Initial program 99.9%
associate-*l/99.8%
+-commutative99.8%
fma-def99.8%
Simplified99.8%
Taylor expanded in z around inf 62.6%
*-commutative62.6%
Simplified62.6%
Final simplification65.0%
(FPCore (x y z) :precision binary64 (if (<= y -6e+193) 4.0 (if (<= y 6e+130) (+ 1.0 (/ 4.0 (/ y (- x z)))) 4.0)))
double code(double x, double y, double z) {
double tmp;
if (y <= -6e+193) {
tmp = 4.0;
} else if (y <= 6e+130) {
tmp = 1.0 + (4.0 / (y / (x - z)));
} else {
tmp = 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 (y <= (-6d+193)) then
tmp = 4.0d0
else if (y <= 6d+130) then
tmp = 1.0d0 + (4.0d0 / (y / (x - z)))
else
tmp = 4.0d0
end if
code = tmp
end function
public static double code(double x, double y, double z) {
double tmp;
if (y <= -6e+193) {
tmp = 4.0;
} else if (y <= 6e+130) {
tmp = 1.0 + (4.0 / (y / (x - z)));
} else {
tmp = 4.0;
}
return tmp;
}
def code(x, y, z): tmp = 0 if y <= -6e+193: tmp = 4.0 elif y <= 6e+130: tmp = 1.0 + (4.0 / (y / (x - z))) else: tmp = 4.0 return tmp
function code(x, y, z) tmp = 0.0 if (y <= -6e+193) tmp = 4.0; elseif (y <= 6e+130) tmp = Float64(1.0 + Float64(4.0 / Float64(y / Float64(x - z)))); else tmp = 4.0; end return tmp end
function tmp_2 = code(x, y, z) tmp = 0.0; if (y <= -6e+193) tmp = 4.0; elseif (y <= 6e+130) tmp = 1.0 + (4.0 / (y / (x - z))); else tmp = 4.0; end tmp_2 = tmp; end
code[x_, y_, z_] := If[LessEqual[y, -6e+193], 4.0, If[LessEqual[y, 6e+130], N[(1.0 + N[(4.0 / N[(y / N[(x - z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], 4.0]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;y \leq -6 \cdot 10^{+193}:\\
\;\;\;\;4\\
\mathbf{elif}\;y \leq 6 \cdot 10^{+130}:\\
\;\;\;\;1 + \frac{4}{\frac{y}{x - z}}\\
\mathbf{else}:\\
\;\;\;\;4\\
\end{array}
\end{array}
if y < -6e193 or 5.9999999999999999e130 < y Initial program 99.8%
associate-*l/99.6%
+-commutative99.6%
fma-def99.6%
Simplified99.6%
Taylor expanded in y around inf 80.2%
if -6e193 < y < 5.9999999999999999e130Initial program 100.0%
associate-*l/99.8%
+-commutative99.8%
fma-def99.8%
Simplified99.8%
fma-udef99.8%
+-commutative99.8%
associate-/r/99.7%
+-commutative99.7%
associate-+r-99.7%
fma-udef99.7%
Applied egg-rr99.7%
Taylor expanded in y around 0 81.2%
Final simplification81.0%
(FPCore (x y z) :precision binary64 (if (or (<= z -1.15e+41) (not (<= z 0.00195))) (+ 1.0 (* (/ z y) -4.0)) 4.0))
double code(double x, double y, double z) {
double tmp;
if ((z <= -1.15e+41) || !(z <= 0.00195)) {
tmp = 1.0 + ((z / y) * -4.0);
} else {
tmp = 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 ((z <= (-1.15d+41)) .or. (.not. (z <= 0.00195d0))) then
tmp = 1.0d0 + ((z / y) * (-4.0d0))
else
tmp = 4.0d0
end if
code = tmp
end function
public static double code(double x, double y, double z) {
double tmp;
if ((z <= -1.15e+41) || !(z <= 0.00195)) {
tmp = 1.0 + ((z / y) * -4.0);
} else {
tmp = 4.0;
}
return tmp;
}
def code(x, y, z): tmp = 0 if (z <= -1.15e+41) or not (z <= 0.00195): tmp = 1.0 + ((z / y) * -4.0) else: tmp = 4.0 return tmp
function code(x, y, z) tmp = 0.0 if ((z <= -1.15e+41) || !(z <= 0.00195)) tmp = Float64(1.0 + Float64(Float64(z / y) * -4.0)); else tmp = 4.0; end return tmp end
function tmp_2 = code(x, y, z) tmp = 0.0; if ((z <= -1.15e+41) || ~((z <= 0.00195))) tmp = 1.0 + ((z / y) * -4.0); else tmp = 4.0; end tmp_2 = tmp; end
code[x_, y_, z_] := If[Or[LessEqual[z, -1.15e+41], N[Not[LessEqual[z, 0.00195]], $MachinePrecision]], N[(1.0 + N[(N[(z / y), $MachinePrecision] * -4.0), $MachinePrecision]), $MachinePrecision], 4.0]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \leq -1.15 \cdot 10^{+41} \lor \neg \left(z \leq 0.00195\right):\\
\;\;\;\;1 + \frac{z}{y} \cdot -4\\
\mathbf{else}:\\
\;\;\;\;4\\
\end{array}
\end{array}
if z < -1.1499999999999999e41 or 0.0019499999999999999 < z Initial program 99.9%
associate-*l/99.8%
+-commutative99.8%
fma-def99.8%
Simplified99.8%
Taylor expanded in z around inf 66.2%
*-commutative66.2%
Simplified66.2%
if -1.1499999999999999e41 < z < 0.0019499999999999999Initial program 99.9%
associate-*l/99.7%
+-commutative99.7%
fma-def99.7%
Simplified99.7%
Taylor expanded in y around inf 48.4%
Final simplification55.6%
(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 99.9%
associate-*l/99.8%
+-commutative99.8%
fma-def99.7%
Simplified99.7%
Taylor expanded in z around inf 36.2%
*-commutative36.2%
Simplified36.2%
Taylor expanded in z around 0 7.7%
Final simplification7.7%
(FPCore (x y z) :precision binary64 4.0)
double code(double x, double y, double z) {
return 4.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
end function
public static double code(double x, double y, double z) {
return 4.0;
}
def code(x, y, z): return 4.0
function code(x, y, z) return 4.0 end
function tmp = code(x, y, z) tmp = 4.0; end
code[x_, y_, z_] := 4.0
\begin{array}{l}
\\
4
\end{array}
Initial program 99.9%
associate-*l/99.8%
+-commutative99.8%
fma-def99.7%
Simplified99.7%
Taylor expanded in y around inf 35.7%
Final simplification35.7%
herbie shell --seed 2023311
(FPCore (x y z)
:name "Data.Array.Repa.Algorithms.ColorRamp:rampColorHotToCold from repa-algorithms-3.4.0.1, A"
:precision binary64
(+ 1.0 (/ (* 4.0 (- (+ x (* y 0.75)) z)) y)))