
(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 (+ 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(4.0 * Float64(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[(4.0 * N[(N[(x - z), $MachinePrecision] / y), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
4 + 4 \cdot \frac{x - z}{y}
\end{array}
Initial program 99.9%
Taylor expanded in y around inf 100.0%
(FPCore (x y z)
:precision binary64
(let* ((t_0 (* 4.0 (/ x y))))
(if (<= x -1.15e+14)
t_0
(if (<= x 2.9e-79) 4.0 (if (<= x 3.6e+38) (* -4.0 (/ z y)) t_0)))))
double code(double x, double y, double z) {
double t_0 = 4.0 * (x / y);
double tmp;
if (x <= -1.15e+14) {
tmp = t_0;
} else if (x <= 2.9e-79) {
tmp = 4.0;
} else if (x <= 3.6e+38) {
tmp = -4.0 * (z / 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 * (x / y)
if (x <= (-1.15d+14)) then
tmp = t_0
else if (x <= 2.9d-79) then
tmp = 4.0d0
else if (x <= 3.6d+38) then
tmp = (-4.0d0) * (z / 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 * (x / y);
double tmp;
if (x <= -1.15e+14) {
tmp = t_0;
} else if (x <= 2.9e-79) {
tmp = 4.0;
} else if (x <= 3.6e+38) {
tmp = -4.0 * (z / y);
} else {
tmp = t_0;
}
return tmp;
}
def code(x, y, z): t_0 = 4.0 * (x / y) tmp = 0 if x <= -1.15e+14: tmp = t_0 elif x <= 2.9e-79: tmp = 4.0 elif x <= 3.6e+38: tmp = -4.0 * (z / y) else: tmp = t_0 return tmp
function code(x, y, z) t_0 = Float64(4.0 * Float64(x / y)) tmp = 0.0 if (x <= -1.15e+14) tmp = t_0; elseif (x <= 2.9e-79) tmp = 4.0; elseif (x <= 3.6e+38) tmp = Float64(-4.0 * Float64(z / y)); else tmp = t_0; end return tmp end
function tmp_2 = code(x, y, z) t_0 = 4.0 * (x / y); tmp = 0.0; if (x <= -1.15e+14) tmp = t_0; elseif (x <= 2.9e-79) tmp = 4.0; elseif (x <= 3.6e+38) tmp = -4.0 * (z / y); else tmp = t_0; end tmp_2 = tmp; end
code[x_, y_, z_] := Block[{t$95$0 = N[(4.0 * N[(x / y), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[x, -1.15e+14], t$95$0, If[LessEqual[x, 2.9e-79], 4.0, If[LessEqual[x, 3.6e+38], N[(-4.0 * N[(z / y), $MachinePrecision]), $MachinePrecision], t$95$0]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := 4 \cdot \frac{x}{y}\\
\mathbf{if}\;x \leq -1.15 \cdot 10^{+14}:\\
\;\;\;\;t\_0\\
\mathbf{elif}\;x \leq 2.9 \cdot 10^{-79}:\\
\;\;\;\;4\\
\mathbf{elif}\;x \leq 3.6 \cdot 10^{+38}:\\
\;\;\;\;-4 \cdot \frac{z}{y}\\
\mathbf{else}:\\
\;\;\;\;t\_0\\
\end{array}
\end{array}
if x < -1.15e14 or 3.59999999999999969e38 < x Initial program 99.9%
Taylor expanded in y around inf 100.0%
Taylor expanded in x around 0 96.6%
+-commutative96.6%
associate-*r/96.6%
associate-*l/96.4%
metadata-eval96.4%
distribute-lft-neg-in96.4%
associate-/l*96.4%
associate-*l/96.4%
distribute-rgt-neg-in96.4%
distribute-lft-in99.8%
sub-neg99.8%
*-commutative99.8%
+-commutative99.8%
fma-define99.8%
Simplified99.8%
Taylor expanded in x around inf 65.7%
if -1.15e14 < x < 2.9000000000000001e-79Initial program 99.9%
Taylor expanded in y around inf 56.5%
if 2.9000000000000001e-79 < x < 3.59999999999999969e38Initial program 99.9%
Taylor expanded in y around inf 100.0%
Taylor expanded in x around 0 100.0%
+-commutative100.0%
associate-*r/100.0%
associate-*l/100.0%
metadata-eval100.0%
distribute-lft-neg-in100.0%
associate-/l*100.0%
associate-*l/99.8%
distribute-rgt-neg-in99.8%
distribute-lft-in99.8%
sub-neg99.8%
*-commutative99.8%
+-commutative99.8%
fma-define99.8%
Simplified99.8%
Taylor expanded in z around inf 60.3%
(FPCore (x y z) :precision binary64 (if (or (<= y -6.2e+29) (not (<= y 360000000.0))) (+ 4.0 (* 4.0 (/ x y))) (* 4.0 (/ (- x z) y))))
double code(double x, double y, double z) {
double tmp;
if ((y <= -6.2e+29) || !(y <= 360000000.0)) {
tmp = 4.0 + (4.0 * (x / y));
} else {
tmp = 4.0 * ((x - 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 ((y <= (-6.2d+29)) .or. (.not. (y <= 360000000.0d0))) then
tmp = 4.0d0 + (4.0d0 * (x / y))
else
tmp = 4.0d0 * ((x - z) / y)
end if
code = tmp
end function
public static double code(double x, double y, double z) {
double tmp;
if ((y <= -6.2e+29) || !(y <= 360000000.0)) {
tmp = 4.0 + (4.0 * (x / y));
} else {
tmp = 4.0 * ((x - z) / y);
}
return tmp;
}
def code(x, y, z): tmp = 0 if (y <= -6.2e+29) or not (y <= 360000000.0): tmp = 4.0 + (4.0 * (x / y)) else: tmp = 4.0 * ((x - z) / y) return tmp
function code(x, y, z) tmp = 0.0 if ((y <= -6.2e+29) || !(y <= 360000000.0)) tmp = Float64(4.0 + Float64(4.0 * Float64(x / y))); else tmp = Float64(4.0 * Float64(Float64(x - z) / y)); end return tmp end
function tmp_2 = code(x, y, z) tmp = 0.0; if ((y <= -6.2e+29) || ~((y <= 360000000.0))) tmp = 4.0 + (4.0 * (x / y)); else tmp = 4.0 * ((x - z) / y); end tmp_2 = tmp; end
code[x_, y_, z_] := If[Or[LessEqual[y, -6.2e+29], N[Not[LessEqual[y, 360000000.0]], $MachinePrecision]], N[(4.0 + N[(4.0 * N[(x / y), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(4.0 * N[(N[(x - z), $MachinePrecision] / y), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;y \leq -6.2 \cdot 10^{+29} \lor \neg \left(y \leq 360000000\right):\\
\;\;\;\;4 + 4 \cdot \frac{x}{y}\\
\mathbf{else}:\\
\;\;\;\;4 \cdot \frac{x - z}{y}\\
\end{array}
\end{array}
if y < -6.1999999999999998e29 or 3.6e8 < y Initial program 99.8%
Taylor expanded in y around inf 100.0%
Taylor expanded in x around inf 84.1%
if -6.1999999999999998e29 < y < 3.6e8Initial program 100.0%
Taylor expanded in y around inf 100.0%
Taylor expanded in y around 0 95.7%
Final simplification89.9%
(FPCore (x y z) :precision binary64 (if (<= y -2.7e+48) (+ 4.0 (/ (* z -4.0) y)) (if (<= y 60000000000.0) (* 4.0 (/ (- x z) y)) (+ 4.0 (* 4.0 (/ x y))))))
double code(double x, double y, double z) {
double tmp;
if (y <= -2.7e+48) {
tmp = 4.0 + ((z * -4.0) / y);
} else if (y <= 60000000000.0) {
tmp = 4.0 * ((x - z) / y);
} else {
tmp = 4.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 (y <= (-2.7d+48)) then
tmp = 4.0d0 + ((z * (-4.0d0)) / y)
else if (y <= 60000000000.0d0) then
tmp = 4.0d0 * ((x - z) / y)
else
tmp = 4.0d0 + (4.0d0 * (x / y))
end if
code = tmp
end function
public static double code(double x, double y, double z) {
double tmp;
if (y <= -2.7e+48) {
tmp = 4.0 + ((z * -4.0) / y);
} else if (y <= 60000000000.0) {
tmp = 4.0 * ((x - z) / y);
} else {
tmp = 4.0 + (4.0 * (x / y));
}
return tmp;
}
def code(x, y, z): tmp = 0 if y <= -2.7e+48: tmp = 4.0 + ((z * -4.0) / y) elif y <= 60000000000.0: tmp = 4.0 * ((x - z) / y) else: tmp = 4.0 + (4.0 * (x / y)) return tmp
function code(x, y, z) tmp = 0.0 if (y <= -2.7e+48) tmp = Float64(4.0 + Float64(Float64(z * -4.0) / y)); elseif (y <= 60000000000.0) tmp = Float64(4.0 * Float64(Float64(x - z) / y)); else tmp = Float64(4.0 + Float64(4.0 * Float64(x / y))); end return tmp end
function tmp_2 = code(x, y, z) tmp = 0.0; if (y <= -2.7e+48) tmp = 4.0 + ((z * -4.0) / y); elseif (y <= 60000000000.0) tmp = 4.0 * ((x - z) / y); else tmp = 4.0 + (4.0 * (x / y)); end tmp_2 = tmp; end
code[x_, y_, z_] := If[LessEqual[y, -2.7e+48], N[(4.0 + N[(N[(z * -4.0), $MachinePrecision] / y), $MachinePrecision]), $MachinePrecision], If[LessEqual[y, 60000000000.0], N[(4.0 * N[(N[(x - z), $MachinePrecision] / y), $MachinePrecision]), $MachinePrecision], N[(4.0 + N[(4.0 * N[(x / y), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;y \leq -2.7 \cdot 10^{+48}:\\
\;\;\;\;4 + \frac{z \cdot -4}{y}\\
\mathbf{elif}\;y \leq 60000000000:\\
\;\;\;\;4 \cdot \frac{x - z}{y}\\
\mathbf{else}:\\
\;\;\;\;4 + 4 \cdot \frac{x}{y}\\
\end{array}
\end{array}
if y < -2.70000000000000004e48Initial 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.8%
sub-neg99.8%
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 86.7%
sub-neg86.7%
distribute-lft-in86.7%
metadata-eval86.7%
associate-+r+86.8%
metadata-eval86.8%
neg-mul-186.8%
associate-*r*86.8%
metadata-eval86.8%
*-commutative86.8%
associate-*l/86.8%
associate-/l*86.7%
Simplified86.7%
associate-*r/86.8%
Applied egg-rr86.8%
if -2.70000000000000004e48 < y < 6e10Initial program 100.0%
Taylor expanded in y around inf 100.0%
Taylor expanded in y around 0 94.4%
if 6e10 < y Initial program 99.9%
Taylor expanded in y around inf 100.0%
Taylor expanded in x around inf 85.3%
(FPCore (x y z) :precision binary64 (if (<= y -1.36e+51) (+ 4.0 (* z (/ -4.0 y))) (if (<= y 105000000.0) (* 4.0 (/ (- x z) y)) (+ 4.0 (* 4.0 (/ x y))))))
double code(double x, double y, double z) {
double tmp;
if (y <= -1.36e+51) {
tmp = 4.0 + (z * (-4.0 / y));
} else if (y <= 105000000.0) {
tmp = 4.0 * ((x - z) / y);
} else {
tmp = 4.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 (y <= (-1.36d+51)) then
tmp = 4.0d0 + (z * ((-4.0d0) / y))
else if (y <= 105000000.0d0) then
tmp = 4.0d0 * ((x - z) / y)
else
tmp = 4.0d0 + (4.0d0 * (x / y))
end if
code = tmp
end function
public static double code(double x, double y, double z) {
double tmp;
if (y <= -1.36e+51) {
tmp = 4.0 + (z * (-4.0 / y));
} else if (y <= 105000000.0) {
tmp = 4.0 * ((x - z) / y);
} else {
tmp = 4.0 + (4.0 * (x / y));
}
return tmp;
}
def code(x, y, z): tmp = 0 if y <= -1.36e+51: tmp = 4.0 + (z * (-4.0 / y)) elif y <= 105000000.0: tmp = 4.0 * ((x - z) / y) else: tmp = 4.0 + (4.0 * (x / y)) return tmp
function code(x, y, z) tmp = 0.0 if (y <= -1.36e+51) tmp = Float64(4.0 + Float64(z * Float64(-4.0 / y))); elseif (y <= 105000000.0) tmp = Float64(4.0 * Float64(Float64(x - z) / y)); else tmp = Float64(4.0 + Float64(4.0 * Float64(x / y))); end return tmp end
function tmp_2 = code(x, y, z) tmp = 0.0; if (y <= -1.36e+51) tmp = 4.0 + (z * (-4.0 / y)); elseif (y <= 105000000.0) tmp = 4.0 * ((x - z) / y); else tmp = 4.0 + (4.0 * (x / y)); end tmp_2 = tmp; end
code[x_, y_, z_] := If[LessEqual[y, -1.36e+51], N[(4.0 + N[(z * N[(-4.0 / y), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[y, 105000000.0], N[(4.0 * N[(N[(x - z), $MachinePrecision] / y), $MachinePrecision]), $MachinePrecision], N[(4.0 + N[(4.0 * N[(x / y), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;y \leq -1.36 \cdot 10^{+51}:\\
\;\;\;\;4 + z \cdot \frac{-4}{y}\\
\mathbf{elif}\;y \leq 105000000:\\
\;\;\;\;4 \cdot \frac{x - z}{y}\\
\mathbf{else}:\\
\;\;\;\;4 + 4 \cdot \frac{x}{y}\\
\end{array}
\end{array}
if y < -1.3599999999999999e51Initial 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.8%
sub-neg99.8%
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 86.7%
sub-neg86.7%
distribute-lft-in86.7%
metadata-eval86.7%
associate-+r+86.8%
metadata-eval86.8%
neg-mul-186.8%
associate-*r*86.8%
metadata-eval86.8%
*-commutative86.8%
associate-*l/86.8%
associate-/l*86.7%
Simplified86.7%
if -1.3599999999999999e51 < y < 1.05e8Initial program 100.0%
Taylor expanded in y around inf 100.0%
Taylor expanded in y around 0 94.4%
if 1.05e8 < y Initial program 99.9%
Taylor expanded in y around inf 100.0%
Taylor expanded in x around inf 85.3%
(FPCore (x y z) :precision binary64 (if (<= y -9.2e+52) 4.0 (if (<= y 8.5e+175) (* 4.0 (/ (- x z) y)) 4.0)))
double code(double x, double y, double z) {
double tmp;
if (y <= -9.2e+52) {
tmp = 4.0;
} else if (y <= 8.5e+175) {
tmp = 4.0 * ((x - z) / 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 <= (-9.2d+52)) then
tmp = 4.0d0
else if (y <= 8.5d+175) then
tmp = 4.0d0 * ((x - z) / 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 <= -9.2e+52) {
tmp = 4.0;
} else if (y <= 8.5e+175) {
tmp = 4.0 * ((x - z) / y);
} else {
tmp = 4.0;
}
return tmp;
}
def code(x, y, z): tmp = 0 if y <= -9.2e+52: tmp = 4.0 elif y <= 8.5e+175: tmp = 4.0 * ((x - z) / y) else: tmp = 4.0 return tmp
function code(x, y, z) tmp = 0.0 if (y <= -9.2e+52) tmp = 4.0; elseif (y <= 8.5e+175) tmp = Float64(4.0 * Float64(Float64(x - z) / y)); else tmp = 4.0; end return tmp end
function tmp_2 = code(x, y, z) tmp = 0.0; if (y <= -9.2e+52) tmp = 4.0; elseif (y <= 8.5e+175) tmp = 4.0 * ((x - z) / y); else tmp = 4.0; end tmp_2 = tmp; end
code[x_, y_, z_] := If[LessEqual[y, -9.2e+52], 4.0, If[LessEqual[y, 8.5e+175], N[(4.0 * N[(N[(x - z), $MachinePrecision] / y), $MachinePrecision]), $MachinePrecision], 4.0]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;y \leq -9.2 \cdot 10^{+52}:\\
\;\;\;\;4\\
\mathbf{elif}\;y \leq 8.5 \cdot 10^{+175}:\\
\;\;\;\;4 \cdot \frac{x - z}{y}\\
\mathbf{else}:\\
\;\;\;\;4\\
\end{array}
\end{array}
if y < -9.1999999999999999e52 or 8.50000000000000034e175 < y Initial program 99.8%
Taylor expanded in y around inf 73.9%
if -9.1999999999999999e52 < y < 8.50000000000000034e175Initial program 100.0%
Taylor expanded in y around inf 100.0%
Taylor expanded in y around 0 84.2%
(FPCore (x y z) :precision binary64 (if (<= y -1.3e+34) 4.0 (if (<= y 36000000000.0) (* -4.0 (/ z y)) 4.0)))
double code(double x, double y, double z) {
double tmp;
if (y <= -1.3e+34) {
tmp = 4.0;
} else if (y <= 36000000000.0) {
tmp = -4.0 * (z / 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.3d+34)) then
tmp = 4.0d0
else if (y <= 36000000000.0d0) then
tmp = (-4.0d0) * (z / 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.3e+34) {
tmp = 4.0;
} else if (y <= 36000000000.0) {
tmp = -4.0 * (z / y);
} else {
tmp = 4.0;
}
return tmp;
}
def code(x, y, z): tmp = 0 if y <= -1.3e+34: tmp = 4.0 elif y <= 36000000000.0: tmp = -4.0 * (z / y) else: tmp = 4.0 return tmp
function code(x, y, z) tmp = 0.0 if (y <= -1.3e+34) tmp = 4.0; elseif (y <= 36000000000.0) tmp = Float64(-4.0 * Float64(z / y)); else tmp = 4.0; end return tmp end
function tmp_2 = code(x, y, z) tmp = 0.0; if (y <= -1.3e+34) tmp = 4.0; elseif (y <= 36000000000.0) tmp = -4.0 * (z / y); else tmp = 4.0; end tmp_2 = tmp; end
code[x_, y_, z_] := If[LessEqual[y, -1.3e+34], 4.0, If[LessEqual[y, 36000000000.0], N[(-4.0 * N[(z / y), $MachinePrecision]), $MachinePrecision], 4.0]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;y \leq -1.3 \cdot 10^{+34}:\\
\;\;\;\;4\\
\mathbf{elif}\;y \leq 36000000000:\\
\;\;\;\;-4 \cdot \frac{z}{y}\\
\mathbf{else}:\\
\;\;\;\;4\\
\end{array}
\end{array}
if y < -1.29999999999999999e34 or 3.6e10 < y Initial program 99.8%
Taylor expanded in y around inf 64.2%
if -1.29999999999999999e34 < y < 3.6e10Initial program 100.0%
Taylor expanded in y around inf 100.0%
Taylor expanded in x around 0 96.9%
+-commutative96.9%
associate-*r/96.9%
associate-*l/96.8%
metadata-eval96.8%
distribute-lft-neg-in96.8%
associate-/l*96.8%
associate-*l/96.6%
distribute-rgt-neg-in96.6%
distribute-lft-in99.8%
sub-neg99.8%
*-commutative99.8%
+-commutative99.8%
fma-define99.8%
Simplified99.8%
Taylor expanded in z around inf 50.6%
(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 35.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 99.9%
Taylor expanded in z around inf 38.4%
associate-*r/38.4%
*-commutative38.4%
Simplified38.4%
Taylor expanded in z around 0 8.0%
herbie shell --seed 2024114
(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)))