
(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 9 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 (fma 4.0 (+ 0.75 (/ (- x z) y)) 1.0))
double code(double x, double y, double z) {
return fma(4.0, (0.75 + ((x - z) / y)), 1.0);
}
function code(x, y, z) return fma(4.0, Float64(0.75 + Float64(Float64(x - z) / y)), 1.0) end
code[x_, y_, z_] := N[(4.0 * N[(0.75 + N[(N[(x - z), $MachinePrecision] / y), $MachinePrecision]), $MachinePrecision] + 1.0), $MachinePrecision]
\begin{array}{l}
\\
\mathsf{fma}\left(4, 0.75 + \frac{x - z}{y}, 1\right)
\end{array}
Initial program 99.9%
+-commutative99.9%
associate-/l*99.9%
fma-define99.9%
associate--l+99.9%
+-commutative99.9%
remove-double-neg99.9%
sub-neg99.9%
associate--r+99.9%
div-sub99.9%
sub-neg99.9%
associate-*l/100.0%
*-inverses100.0%
metadata-eval100.0%
distribute-frac-neg2100.0%
remove-double-neg100.0%
distribute-neg-out100.0%
+-commutative100.0%
sub-neg100.0%
distribute-frac-neg100.0%
distribute-frac-neg2100.0%
remove-double-neg100.0%
Simplified100.0%
(FPCore (x y z)
:precision binary64
(let* ((t_0 (* -4.0 (/ z y))))
(if (<= z -6.5e+74)
t_0
(if (<= z -1.05e-158) 4.0 (if (<= z 4.2e+30) (* 4.0 (/ x y)) t_0)))))
double code(double x, double y, double z) {
double t_0 = -4.0 * (z / y);
double tmp;
if (z <= -6.5e+74) {
tmp = t_0;
} else if (z <= -1.05e-158) {
tmp = 4.0;
} else if (z <= 4.2e+30) {
tmp = 4.0 * (x / y);
} else {
tmp = t_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) :: t_0
real(8) :: tmp
t_0 = (-4.0d0) * (z / y)
if (z <= (-6.5d+74)) then
tmp = t_0
else if (z <= (-1.05d-158)) then
tmp = 4.0d0
else if (z <= 4.2d+30) then
tmp = 4.0d0 * (x / y)
else
tmp = t_0
end if
code = tmp
end function
public static double code(double x, double y, double z) {
double t_0 = -4.0 * (z / y);
double tmp;
if (z <= -6.5e+74) {
tmp = t_0;
} else if (z <= -1.05e-158) {
tmp = 4.0;
} else if (z <= 4.2e+30) {
tmp = 4.0 * (x / y);
} else {
tmp = t_0;
}
return tmp;
}
def code(x, y, z): t_0 = -4.0 * (z / y) tmp = 0 if z <= -6.5e+74: tmp = t_0 elif z <= -1.05e-158: tmp = 4.0 elif z <= 4.2e+30: tmp = 4.0 * (x / y) else: tmp = t_0 return tmp
function code(x, y, z) t_0 = Float64(-4.0 * Float64(z / y)) tmp = 0.0 if (z <= -6.5e+74) tmp = t_0; elseif (z <= -1.05e-158) tmp = 4.0; elseif (z <= 4.2e+30) tmp = Float64(4.0 * Float64(x / y)); else tmp = t_0; end return tmp end
function tmp_2 = code(x, y, z) t_0 = -4.0 * (z / y); tmp = 0.0; if (z <= -6.5e+74) tmp = t_0; elseif (z <= -1.05e-158) tmp = 4.0; elseif (z <= 4.2e+30) tmp = 4.0 * (x / y); else tmp = t_0; end tmp_2 = tmp; end
code[x_, y_, z_] := Block[{t$95$0 = N[(-4.0 * N[(z / y), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[z, -6.5e+74], t$95$0, If[LessEqual[z, -1.05e-158], 4.0, If[LessEqual[z, 4.2e+30], N[(4.0 * N[(x / y), $MachinePrecision]), $MachinePrecision], t$95$0]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := -4 \cdot \frac{z}{y}\\
\mathbf{if}\;z \leq -6.5 \cdot 10^{+74}:\\
\;\;\;\;t\_0\\
\mathbf{elif}\;z \leq -1.05 \cdot 10^{-158}:\\
\;\;\;\;4\\
\mathbf{elif}\;z \leq 4.2 \cdot 10^{+30}:\\
\;\;\;\;4 \cdot \frac{x}{y}\\
\mathbf{else}:\\
\;\;\;\;t\_0\\
\end{array}
\end{array}
if z < -6.49999999999999962e74 or 4.2e30 < z Initial program 99.9%
Taylor expanded in z around inf 67.0%
*-commutative67.0%
Simplified67.0%
if -6.49999999999999962e74 < z < -1.04999999999999996e-158Initial program 100.0%
Taylor expanded in y around inf 50.4%
if -1.04999999999999996e-158 < z < 4.2e30Initial program 99.9%
Taylor expanded in x around inf 58.3%
Final simplification61.1%
(FPCore (x y z)
:precision binary64
(let* ((t_0 (* z (/ -4.0 y))))
(if (<= z -2.75e+76)
t_0
(if (<= z -3.6e-160) 4.0 (if (<= z 1.7e+30) (* 4.0 (/ x y)) t_0)))))
double code(double x, double y, double z) {
double t_0 = z * (-4.0 / y);
double tmp;
if (z <= -2.75e+76) {
tmp = t_0;
} else if (z <= -3.6e-160) {
tmp = 4.0;
} else if (z <= 1.7e+30) {
tmp = 4.0 * (x / y);
} else {
tmp = t_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) :: t_0
real(8) :: tmp
t_0 = z * ((-4.0d0) / y)
if (z <= (-2.75d+76)) then
tmp = t_0
else if (z <= (-3.6d-160)) then
tmp = 4.0d0
else if (z <= 1.7d+30) then
tmp = 4.0d0 * (x / y)
else
tmp = t_0
end if
code = tmp
end function
public static double code(double x, double y, double z) {
double t_0 = z * (-4.0 / y);
double tmp;
if (z <= -2.75e+76) {
tmp = t_0;
} else if (z <= -3.6e-160) {
tmp = 4.0;
} else if (z <= 1.7e+30) {
tmp = 4.0 * (x / y);
} else {
tmp = t_0;
}
return tmp;
}
def code(x, y, z): t_0 = z * (-4.0 / y) tmp = 0 if z <= -2.75e+76: tmp = t_0 elif z <= -3.6e-160: tmp = 4.0 elif z <= 1.7e+30: tmp = 4.0 * (x / y) else: tmp = t_0 return tmp
function code(x, y, z) t_0 = Float64(z * Float64(-4.0 / y)) tmp = 0.0 if (z <= -2.75e+76) tmp = t_0; elseif (z <= -3.6e-160) tmp = 4.0; elseif (z <= 1.7e+30) tmp = Float64(4.0 * Float64(x / y)); else tmp = t_0; end return tmp end
function tmp_2 = code(x, y, z) t_0 = z * (-4.0 / y); tmp = 0.0; if (z <= -2.75e+76) tmp = t_0; elseif (z <= -3.6e-160) tmp = 4.0; elseif (z <= 1.7e+30) tmp = 4.0 * (x / y); else tmp = t_0; end tmp_2 = tmp; end
code[x_, y_, z_] := Block[{t$95$0 = N[(z * N[(-4.0 / y), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[z, -2.75e+76], t$95$0, If[LessEqual[z, -3.6e-160], 4.0, If[LessEqual[z, 1.7e+30], N[(4.0 * N[(x / y), $MachinePrecision]), $MachinePrecision], t$95$0]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := z \cdot \frac{-4}{y}\\
\mathbf{if}\;z \leq -2.75 \cdot 10^{+76}:\\
\;\;\;\;t\_0\\
\mathbf{elif}\;z \leq -3.6 \cdot 10^{-160}:\\
\;\;\;\;4\\
\mathbf{elif}\;z \leq 1.7 \cdot 10^{+30}:\\
\;\;\;\;4 \cdot \frac{x}{y}\\
\mathbf{else}:\\
\;\;\;\;t\_0\\
\end{array}
\end{array}
if z < -2.75e76 or 1.7000000000000001e30 < z Initial program 99.9%
Taylor expanded in z around inf 67.0%
associate-*r/67.0%
*-commutative67.0%
associate-/l*66.8%
Simplified66.8%
if -2.75e76 < z < -3.5999999999999997e-160Initial program 100.0%
Taylor expanded in y around inf 50.4%
if -3.5999999999999997e-160 < z < 1.7000000000000001e30Initial program 99.9%
Taylor expanded in x around inf 58.3%
(FPCore (x y z) :precision binary64 (if (or (<= y -1.35e+66) (not (<= y 2.25e+14))) (+ 4.0 (* z (/ -4.0 y))) (* (- x z) (/ 4.0 y))))
double code(double x, double y, double z) {
double tmp;
if ((y <= -1.35e+66) || !(y <= 2.25e+14)) {
tmp = 4.0 + (z * (-4.0 / y));
} else {
tmp = (x - z) * (4.0 / 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 ((y <= (-1.35d+66)) .or. (.not. (y <= 2.25d+14))) then
tmp = 4.0d0 + (z * ((-4.0d0) / y))
else
tmp = (x - z) * (4.0d0 / y)
end if
code = tmp
end function
public static double code(double x, double y, double z) {
double tmp;
if ((y <= -1.35e+66) || !(y <= 2.25e+14)) {
tmp = 4.0 + (z * (-4.0 / y));
} else {
tmp = (x - z) * (4.0 / y);
}
return tmp;
}
def code(x, y, z): tmp = 0 if (y <= -1.35e+66) or not (y <= 2.25e+14): tmp = 4.0 + (z * (-4.0 / y)) else: tmp = (x - z) * (4.0 / y) return tmp
function code(x, y, z) tmp = 0.0 if ((y <= -1.35e+66) || !(y <= 2.25e+14)) tmp = Float64(4.0 + Float64(z * Float64(-4.0 / y))); else tmp = Float64(Float64(x - z) * Float64(4.0 / y)); end return tmp end
function tmp_2 = code(x, y, z) tmp = 0.0; if ((y <= -1.35e+66) || ~((y <= 2.25e+14))) tmp = 4.0 + (z * (-4.0 / y)); else tmp = (x - z) * (4.0 / y); end tmp_2 = tmp; end
code[x_, y_, z_] := If[Or[LessEqual[y, -1.35e+66], N[Not[LessEqual[y, 2.25e+14]], $MachinePrecision]], N[(4.0 + N[(z * N[(-4.0 / y), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(x - z), $MachinePrecision] * N[(4.0 / y), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;y \leq -1.35 \cdot 10^{+66} \lor \neg \left(y \leq 2.25 \cdot 10^{+14}\right):\\
\;\;\;\;4 + z \cdot \frac{-4}{y}\\
\mathbf{else}:\\
\;\;\;\;\left(x - z\right) \cdot \frac{4}{y}\\
\end{array}
\end{array}
if y < -1.35e66 or 2.25e14 < y Initial program 99.8%
+-commutative99.8%
associate-/l*99.8%
fma-define99.8%
associate--l+99.8%
+-commutative99.8%
remove-double-neg99.8%
sub-neg99.8%
associate--r+99.8%
div-sub99.9%
sub-neg99.9%
associate-*l/99.9%
*-inverses99.9%
metadata-eval99.9%
distribute-frac-neg299.9%
remove-double-neg99.9%
distribute-neg-out99.9%
+-commutative99.9%
sub-neg99.9%
distribute-frac-neg99.9%
distribute-frac-neg299.9%
remove-double-neg99.9%
Simplified99.9%
Taylor expanded in x around 0 83.3%
sub-neg83.3%
distribute-lft-in83.3%
metadata-eval83.3%
associate-+r+83.3%
metadata-eval83.3%
neg-mul-183.3%
associate-*r*83.3%
metadata-eval83.3%
associate-*r/83.3%
*-commutative83.3%
associate-/l*83.3%
Simplified83.3%
if -1.35e66 < y < 2.25e14Initial program 100.0%
Taylor expanded in y around 0 95.4%
*-lft-identity95.4%
associate-*l/95.1%
associate-*r*95.1%
associate-*r/95.1%
metadata-eval95.1%
Simplified95.1%
Final simplification90.2%
(FPCore (x y z) :precision binary64 (if (or (<= y -1.5e+66) (not (<= y 9e-21))) (+ 4.0 (* x (/ 4.0 y))) (* (- x z) (/ 4.0 y))))
double code(double x, double y, double z) {
double tmp;
if ((y <= -1.5e+66) || !(y <= 9e-21)) {
tmp = 4.0 + (x * (4.0 / y));
} else {
tmp = (x - z) * (4.0 / 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 ((y <= (-1.5d+66)) .or. (.not. (y <= 9d-21))) then
tmp = 4.0d0 + (x * (4.0d0 / y))
else
tmp = (x - z) * (4.0d0 / y)
end if
code = tmp
end function
public static double code(double x, double y, double z) {
double tmp;
if ((y <= -1.5e+66) || !(y <= 9e-21)) {
tmp = 4.0 + (x * (4.0 / y));
} else {
tmp = (x - z) * (4.0 / y);
}
return tmp;
}
def code(x, y, z): tmp = 0 if (y <= -1.5e+66) or not (y <= 9e-21): tmp = 4.0 + (x * (4.0 / y)) else: tmp = (x - z) * (4.0 / y) return tmp
function code(x, y, z) tmp = 0.0 if ((y <= -1.5e+66) || !(y <= 9e-21)) tmp = Float64(4.0 + Float64(x * Float64(4.0 / y))); else tmp = Float64(Float64(x - z) * Float64(4.0 / y)); end return tmp end
function tmp_2 = code(x, y, z) tmp = 0.0; if ((y <= -1.5e+66) || ~((y <= 9e-21))) tmp = 4.0 + (x * (4.0 / y)); else tmp = (x - z) * (4.0 / y); end tmp_2 = tmp; end
code[x_, y_, z_] := If[Or[LessEqual[y, -1.5e+66], N[Not[LessEqual[y, 9e-21]], $MachinePrecision]], N[(4.0 + N[(x * N[(4.0 / y), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(x - z), $MachinePrecision] * N[(4.0 / y), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;y \leq -1.5 \cdot 10^{+66} \lor \neg \left(y \leq 9 \cdot 10^{-21}\right):\\
\;\;\;\;4 + x \cdot \frac{4}{y}\\
\mathbf{else}:\\
\;\;\;\;\left(x - z\right) \cdot \frac{4}{y}\\
\end{array}
\end{array}
if y < -1.50000000000000001e66 or 8.99999999999999936e-21 < y Initial program 99.8%
+-commutative99.8%
associate-/l*99.8%
fma-define99.8%
associate--l+99.8%
+-commutative99.8%
remove-double-neg99.8%
sub-neg99.8%
associate--r+99.8%
div-sub99.9%
sub-neg99.9%
associate-*l/99.9%
*-inverses99.9%
metadata-eval99.9%
distribute-frac-neg299.9%
remove-double-neg99.9%
distribute-neg-out99.9%
+-commutative99.9%
sub-neg99.9%
distribute-frac-neg99.9%
distribute-frac-neg299.9%
remove-double-neg99.9%
Simplified99.9%
Taylor expanded in z around 0 80.8%
distribute-lft-in80.8%
metadata-eval80.8%
associate-+r+80.8%
metadata-eval80.8%
associate-*r/80.8%
*-commutative80.8%
associate-*r/80.7%
Simplified80.7%
if -1.50000000000000001e66 < y < 8.99999999999999936e-21Initial program 100.0%
Taylor expanded in y around 0 95.3%
*-lft-identity95.3%
associate-*l/95.0%
associate-*r*95.0%
associate-*r/95.0%
metadata-eval95.0%
Simplified95.0%
Final simplification88.9%
(FPCore (x y z) :precision binary64 (if (<= y -1.6e+108) 4.0 (if (<= y 3.6e+129) (* (- x z) (/ 4.0 y)) 4.0)))
double code(double x, double y, double z) {
double tmp;
if (y <= -1.6e+108) {
tmp = 4.0;
} else if (y <= 3.6e+129) {
tmp = (x - z) * (4.0 / y);
} 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 <= (-1.6d+108)) then
tmp = 4.0d0
else if (y <= 3.6d+129) then
tmp = (x - z) * (4.0d0 / y)
else
tmp = 4.0d0
end if
code = tmp
end function
public static double code(double x, double y, double z) {
double tmp;
if (y <= -1.6e+108) {
tmp = 4.0;
} else if (y <= 3.6e+129) {
tmp = (x - z) * (4.0 / y);
} else {
tmp = 4.0;
}
return tmp;
}
def code(x, y, z): tmp = 0 if y <= -1.6e+108: tmp = 4.0 elif y <= 3.6e+129: tmp = (x - z) * (4.0 / y) else: tmp = 4.0 return tmp
function code(x, y, z) tmp = 0.0 if (y <= -1.6e+108) tmp = 4.0; elseif (y <= 3.6e+129) tmp = Float64(Float64(x - z) * Float64(4.0 / y)); else tmp = 4.0; end return tmp end
function tmp_2 = code(x, y, z) tmp = 0.0; if (y <= -1.6e+108) tmp = 4.0; elseif (y <= 3.6e+129) tmp = (x - z) * (4.0 / y); else tmp = 4.0; end tmp_2 = tmp; end
code[x_, y_, z_] := If[LessEqual[y, -1.6e+108], 4.0, If[LessEqual[y, 3.6e+129], N[(N[(x - z), $MachinePrecision] * N[(4.0 / y), $MachinePrecision]), $MachinePrecision], 4.0]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;y \leq -1.6 \cdot 10^{+108}:\\
\;\;\;\;4\\
\mathbf{elif}\;y \leq 3.6 \cdot 10^{+129}:\\
\;\;\;\;\left(x - z\right) \cdot \frac{4}{y}\\
\mathbf{else}:\\
\;\;\;\;4\\
\end{array}
\end{array}
if y < -1.6e108 or 3.6000000000000001e129 < y Initial program 99.8%
Taylor expanded in y around inf 74.2%
if -1.6e108 < y < 3.6000000000000001e129Initial program 99.9%
Taylor expanded in y around 0 87.7%
*-lft-identity87.7%
associate-*l/87.4%
associate-*r*87.4%
associate-*r/87.4%
metadata-eval87.4%
Simplified87.4%
Final simplification83.6%
(FPCore (x y z) :precision binary64 (if (<= y -1.4e+57) 4.0 (if (<= y 2050000000000.0) (* 4.0 (/ x y)) 4.0)))
double code(double x, double y, double z) {
double tmp;
if (y <= -1.4e+57) {
tmp = 4.0;
} else if (y <= 2050000000000.0) {
tmp = 4.0 * (x / y);
} 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 <= (-1.4d+57)) then
tmp = 4.0d0
else if (y <= 2050000000000.0d0) then
tmp = 4.0d0 * (x / y)
else
tmp = 4.0d0
end if
code = tmp
end function
public static double code(double x, double y, double z) {
double tmp;
if (y <= -1.4e+57) {
tmp = 4.0;
} else if (y <= 2050000000000.0) {
tmp = 4.0 * (x / y);
} else {
tmp = 4.0;
}
return tmp;
}
def code(x, y, z): tmp = 0 if y <= -1.4e+57: tmp = 4.0 elif y <= 2050000000000.0: tmp = 4.0 * (x / y) else: tmp = 4.0 return tmp
function code(x, y, z) tmp = 0.0 if (y <= -1.4e+57) tmp = 4.0; elseif (y <= 2050000000000.0) tmp = Float64(4.0 * Float64(x / y)); else tmp = 4.0; end return tmp end
function tmp_2 = code(x, y, z) tmp = 0.0; if (y <= -1.4e+57) tmp = 4.0; elseif (y <= 2050000000000.0) tmp = 4.0 * (x / y); else tmp = 4.0; end tmp_2 = tmp; end
code[x_, y_, z_] := If[LessEqual[y, -1.4e+57], 4.0, If[LessEqual[y, 2050000000000.0], N[(4.0 * N[(x / y), $MachinePrecision]), $MachinePrecision], 4.0]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;y \leq -1.4 \cdot 10^{+57}:\\
\;\;\;\;4\\
\mathbf{elif}\;y \leq 2050000000000:\\
\;\;\;\;4 \cdot \frac{x}{y}\\
\mathbf{else}:\\
\;\;\;\;4\\
\end{array}
\end{array}
if y < -1.4e57 or 2.05e12 < y Initial program 99.8%
Taylor expanded in y around inf 61.8%
if -1.4e57 < y < 2.05e12Initial program 100.0%
Taylor expanded in x around inf 53.4%
(FPCore (x y z) :precision binary64 (+ 1.0 (/ (* 4.0 (- (+ x (* 0.75 y)) z)) y)))
double code(double x, double y, double z) {
return 1.0 + ((4.0 * ((x + (0.75 * y)) - 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 + (0.75d0 * y)) - z)) / y)
end function
public static double code(double x, double y, double z) {
return 1.0 + ((4.0 * ((x + (0.75 * y)) - z)) / y);
}
def code(x, y, z): return 1.0 + ((4.0 * ((x + (0.75 * y)) - z)) / y)
function code(x, y, z) return Float64(1.0 + Float64(Float64(4.0 * Float64(Float64(x + Float64(0.75 * y)) - z)) / y)) end
function tmp = code(x, y, z) tmp = 1.0 + ((4.0 * ((x + (0.75 * y)) - z)) / y); end
code[x_, y_, z_] := N[(1.0 + N[(N[(4.0 * N[(N[(x + N[(0.75 * y), $MachinePrecision]), $MachinePrecision] - z), $MachinePrecision]), $MachinePrecision] / y), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
1 + \frac{4 \cdot \left(\left(x + 0.75 \cdot y\right) - z\right)}{y}
\end{array}
Initial program 99.9%
Final simplification99.9%
(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%
Taylor expanded in y around inf 30.6%
herbie shell --seed 2024163
(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)))