
(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 (/ z y))))
(if (<= y -1.15e+42)
4.0
(if (<= y -1.5e-286)
t_0
(if (<= y 1.35e-78) (* 4.0 (/ x y)) (if (<= y 1.2e+65) t_0 4.0))))))
double code(double x, double y, double z) {
double t_0 = -4.0 * (z / y);
double tmp;
if (y <= -1.15e+42) {
tmp = 4.0;
} else if (y <= -1.5e-286) {
tmp = t_0;
} else if (y <= 1.35e-78) {
tmp = 4.0 * (x / y);
} else if (y <= 1.2e+65) {
tmp = t_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) :: t_0
real(8) :: tmp
t_0 = (-4.0d0) * (z / y)
if (y <= (-1.15d+42)) then
tmp = 4.0d0
else if (y <= (-1.5d-286)) then
tmp = t_0
else if (y <= 1.35d-78) then
tmp = 4.0d0 * (x / y)
else if (y <= 1.2d+65) then
tmp = t_0
else
tmp = 4.0d0
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 (y <= -1.15e+42) {
tmp = 4.0;
} else if (y <= -1.5e-286) {
tmp = t_0;
} else if (y <= 1.35e-78) {
tmp = 4.0 * (x / y);
} else if (y <= 1.2e+65) {
tmp = t_0;
} else {
tmp = 4.0;
}
return tmp;
}
def code(x, y, z): t_0 = -4.0 * (z / y) tmp = 0 if y <= -1.15e+42: tmp = 4.0 elif y <= -1.5e-286: tmp = t_0 elif y <= 1.35e-78: tmp = 4.0 * (x / y) elif y <= 1.2e+65: tmp = t_0 else: tmp = 4.0 return tmp
function code(x, y, z) t_0 = Float64(-4.0 * Float64(z / y)) tmp = 0.0 if (y <= -1.15e+42) tmp = 4.0; elseif (y <= -1.5e-286) tmp = t_0; elseif (y <= 1.35e-78) tmp = Float64(4.0 * Float64(x / y)); elseif (y <= 1.2e+65) tmp = t_0; else tmp = 4.0; end return tmp end
function tmp_2 = code(x, y, z) t_0 = -4.0 * (z / y); tmp = 0.0; if (y <= -1.15e+42) tmp = 4.0; elseif (y <= -1.5e-286) tmp = t_0; elseif (y <= 1.35e-78) tmp = 4.0 * (x / y); elseif (y <= 1.2e+65) tmp = t_0; else tmp = 4.0; end tmp_2 = tmp; end
code[x_, y_, z_] := Block[{t$95$0 = N[(-4.0 * N[(z / y), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[y, -1.15e+42], 4.0, If[LessEqual[y, -1.5e-286], t$95$0, If[LessEqual[y, 1.35e-78], N[(4.0 * N[(x / y), $MachinePrecision]), $MachinePrecision], If[LessEqual[y, 1.2e+65], t$95$0, 4.0]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := -4 \cdot \frac{z}{y}\\
\mathbf{if}\;y \leq -1.15 \cdot 10^{+42}:\\
\;\;\;\;4\\
\mathbf{elif}\;y \leq -1.5 \cdot 10^{-286}:\\
\;\;\;\;t\_0\\
\mathbf{elif}\;y \leq 1.35 \cdot 10^{-78}:\\
\;\;\;\;4 \cdot \frac{x}{y}\\
\mathbf{elif}\;y \leq 1.2 \cdot 10^{+65}:\\
\;\;\;\;t\_0\\
\mathbf{else}:\\
\;\;\;\;4\\
\end{array}
\end{array}
if y < -1.15e42 or 1.2000000000000001e65 < y Initial program 99.8%
Taylor expanded in y around inf 71.5%
if -1.15e42 < y < -1.5e-286 or 1.34999999999999997e-78 < y < 1.2000000000000001e65Initial program 100.0%
Taylor expanded in z around inf 55.3%
*-commutative55.3%
Simplified55.3%
if -1.5e-286 < y < 1.34999999999999997e-78Initial program 99.9%
Taylor expanded in x around inf 63.9%
Final simplification64.4%
(FPCore (x y z)
:precision binary64
(let* ((t_0 (* z (/ -4.0 y))))
(if (<= y -2.5e+41)
4.0
(if (<= y -1.85e-289)
t_0
(if (<= y 8.7e-79) (* 4.0 (/ x y)) (if (<= y 1.25e+65) t_0 4.0))))))
double code(double x, double y, double z) {
double t_0 = z * (-4.0 / y);
double tmp;
if (y <= -2.5e+41) {
tmp = 4.0;
} else if (y <= -1.85e-289) {
tmp = t_0;
} else if (y <= 8.7e-79) {
tmp = 4.0 * (x / y);
} else if (y <= 1.25e+65) {
tmp = t_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) :: t_0
real(8) :: tmp
t_0 = z * ((-4.0d0) / y)
if (y <= (-2.5d+41)) then
tmp = 4.0d0
else if (y <= (-1.85d-289)) then
tmp = t_0
else if (y <= 8.7d-79) then
tmp = 4.0d0 * (x / y)
else if (y <= 1.25d+65) then
tmp = t_0
else
tmp = 4.0d0
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 (y <= -2.5e+41) {
tmp = 4.0;
} else if (y <= -1.85e-289) {
tmp = t_0;
} else if (y <= 8.7e-79) {
tmp = 4.0 * (x / y);
} else if (y <= 1.25e+65) {
tmp = t_0;
} else {
tmp = 4.0;
}
return tmp;
}
def code(x, y, z): t_0 = z * (-4.0 / y) tmp = 0 if y <= -2.5e+41: tmp = 4.0 elif y <= -1.85e-289: tmp = t_0 elif y <= 8.7e-79: tmp = 4.0 * (x / y) elif y <= 1.25e+65: tmp = t_0 else: tmp = 4.0 return tmp
function code(x, y, z) t_0 = Float64(z * Float64(-4.0 / y)) tmp = 0.0 if (y <= -2.5e+41) tmp = 4.0; elseif (y <= -1.85e-289) tmp = t_0; elseif (y <= 8.7e-79) tmp = Float64(4.0 * Float64(x / y)); elseif (y <= 1.25e+65) tmp = t_0; else tmp = 4.0; end return tmp end
function tmp_2 = code(x, y, z) t_0 = z * (-4.0 / y); tmp = 0.0; if (y <= -2.5e+41) tmp = 4.0; elseif (y <= -1.85e-289) tmp = t_0; elseif (y <= 8.7e-79) tmp = 4.0 * (x / y); elseif (y <= 1.25e+65) tmp = t_0; else tmp = 4.0; end tmp_2 = tmp; end
code[x_, y_, z_] := Block[{t$95$0 = N[(z * N[(-4.0 / y), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[y, -2.5e+41], 4.0, If[LessEqual[y, -1.85e-289], t$95$0, If[LessEqual[y, 8.7e-79], N[(4.0 * N[(x / y), $MachinePrecision]), $MachinePrecision], If[LessEqual[y, 1.25e+65], t$95$0, 4.0]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := z \cdot \frac{-4}{y}\\
\mathbf{if}\;y \leq -2.5 \cdot 10^{+41}:\\
\;\;\;\;4\\
\mathbf{elif}\;y \leq -1.85 \cdot 10^{-289}:\\
\;\;\;\;t\_0\\
\mathbf{elif}\;y \leq 8.7 \cdot 10^{-79}:\\
\;\;\;\;4 \cdot \frac{x}{y}\\
\mathbf{elif}\;y \leq 1.25 \cdot 10^{+65}:\\
\;\;\;\;t\_0\\
\mathbf{else}:\\
\;\;\;\;4\\
\end{array}
\end{array}
if y < -2.50000000000000011e41 or 1.24999999999999993e65 < y Initial program 99.8%
Taylor expanded in y around inf 71.5%
if -2.50000000000000011e41 < y < -1.84999999999999994e-289 or 8.7000000000000002e-79 < y < 1.24999999999999993e65Initial program 100.0%
Taylor expanded in z around inf 55.3%
associate-*r/55.3%
*-commutative55.3%
associate-/l*55.1%
Simplified55.1%
if -1.84999999999999994e-289 < y < 8.7000000000000002e-79Initial program 99.9%
Taylor expanded in x around inf 63.9%
(FPCore (x y z) :precision binary64 (if (or (<= y -7e+41) (not (<= y 3.2e+66))) (+ 4.0 (* 4.0 (/ x y))) (* 4.0 (/ (- x z) y))))
double code(double x, double y, double z) {
double tmp;
if ((y <= -7e+41) || !(y <= 3.2e+66)) {
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 <= (-7d+41)) .or. (.not. (y <= 3.2d+66))) 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 <= -7e+41) || !(y <= 3.2e+66)) {
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 <= -7e+41) or not (y <= 3.2e+66): 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 <= -7e+41) || !(y <= 3.2e+66)) 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 <= -7e+41) || ~((y <= 3.2e+66))) 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, -7e+41], N[Not[LessEqual[y, 3.2e+66]], $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 -7 \cdot 10^{+41} \lor \neg \left(y \leq 3.2 \cdot 10^{+66}\right):\\
\;\;\;\;4 + 4 \cdot \frac{x}{y}\\
\mathbf{else}:\\
\;\;\;\;4 \cdot \frac{x - z}{y}\\
\end{array}
\end{array}
if y < -6.9999999999999998e41 or 3.2e66 < y Initial program 99.8%
Taylor expanded in y around inf 100.0%
Taylor expanded in x around inf 86.9%
if -6.9999999999999998e41 < y < 3.2e66Initial program 100.0%
Taylor expanded in y around 0 91.0%
Final simplification89.2%
(FPCore (x y z) :precision binary64 (if (<= y -2.85e+22) (+ 4.0 (/ (* z -4.0) y)) (if (<= y 4.9e+67) (* 4.0 (/ (- x z) y)) (+ 4.0 (* 4.0 (/ x y))))))
double code(double x, double y, double z) {
double tmp;
if (y <= -2.85e+22) {
tmp = 4.0 + ((z * -4.0) / y);
} else if (y <= 4.9e+67) {
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.85d+22)) then
tmp = 4.0d0 + ((z * (-4.0d0)) / y)
else if (y <= 4.9d+67) 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.85e+22) {
tmp = 4.0 + ((z * -4.0) / y);
} else if (y <= 4.9e+67) {
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.85e+22: tmp = 4.0 + ((z * -4.0) / y) elif y <= 4.9e+67: 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.85e+22) tmp = Float64(4.0 + Float64(Float64(z * -4.0) / y)); elseif (y <= 4.9e+67) 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.85e+22) tmp = 4.0 + ((z * -4.0) / y); elseif (y <= 4.9e+67) 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.85e+22], N[(4.0 + N[(N[(z * -4.0), $MachinePrecision] / y), $MachinePrecision]), $MachinePrecision], If[LessEqual[y, 4.9e+67], 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.85 \cdot 10^{+22}:\\
\;\;\;\;4 + \frac{z \cdot -4}{y}\\
\mathbf{elif}\;y \leq 4.9 \cdot 10^{+67}:\\
\;\;\;\;4 \cdot \frac{x - z}{y}\\
\mathbf{else}:\\
\;\;\;\;4 + 4 \cdot \frac{x}{y}\\
\end{array}
\end{array}
if y < -2.8499999999999999e22Initial program 99.8%
Taylor expanded in y around inf 100.0%
Taylor expanded in x around 0 84.0%
+-commutative84.0%
associate-*r/84.0%
Simplified84.0%
if -2.8499999999999999e22 < y < 4.8999999999999999e67Initial program 100.0%
Taylor expanded in y around 0 92.6%
if 4.8999999999999999e67 < y Initial program 99.9%
Taylor expanded in y around inf 100.0%
Taylor expanded in x around inf 90.3%
Final simplification89.9%
(FPCore (x y z) :precision binary64 (if (<= y -5e+23) (+ 4.0 (* z (/ -4.0 y))) (if (<= y 1.3e+67) (* 4.0 (/ (- x z) y)) (+ 4.0 (* 4.0 (/ x y))))))
double code(double x, double y, double z) {
double tmp;
if (y <= -5e+23) {
tmp = 4.0 + (z * (-4.0 / y));
} else if (y <= 1.3e+67) {
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 <= (-5d+23)) then
tmp = 4.0d0 + (z * ((-4.0d0) / y))
else if (y <= 1.3d+67) 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 <= -5e+23) {
tmp = 4.0 + (z * (-4.0 / y));
} else if (y <= 1.3e+67) {
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 <= -5e+23: tmp = 4.0 + (z * (-4.0 / y)) elif y <= 1.3e+67: 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 <= -5e+23) tmp = Float64(4.0 + Float64(z * Float64(-4.0 / y))); elseif (y <= 1.3e+67) 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 <= -5e+23) tmp = 4.0 + (z * (-4.0 / y)); elseif (y <= 1.3e+67) 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, -5e+23], N[(4.0 + N[(z * N[(-4.0 / y), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[y, 1.3e+67], 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 -5 \cdot 10^{+23}:\\
\;\;\;\;4 + z \cdot \frac{-4}{y}\\
\mathbf{elif}\;y \leq 1.3 \cdot 10^{+67}:\\
\;\;\;\;4 \cdot \frac{x - z}{y}\\
\mathbf{else}:\\
\;\;\;\;4 + 4 \cdot \frac{x}{y}\\
\end{array}
\end{array}
if y < -4.9999999999999999e23Initial 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/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%
Taylor expanded in x around 0 84.0%
sub-neg84.0%
distribute-lft-in84.0%
metadata-eval84.0%
associate-+r+84.0%
metadata-eval84.0%
neg-mul-184.0%
associate-*r*84.0%
metadata-eval84.0%
associate-*r/84.0%
*-commutative84.0%
associate-/l*83.9%
Simplified83.9%
if -4.9999999999999999e23 < y < 1.3e67Initial program 100.0%
Taylor expanded in y around 0 92.6%
if 1.3e67 < y Initial program 99.9%
Taylor expanded in y around inf 100.0%
Taylor expanded in x around inf 90.3%
(FPCore (x y z) :precision binary64 (if (<= y -3.7e+143) 4.0 (if (<= y 4e+68) (* 4.0 (/ (- x z) y)) 4.0)))
double code(double x, double y, double z) {
double tmp;
if (y <= -3.7e+143) {
tmp = 4.0;
} else if (y <= 4e+68) {
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 <= (-3.7d+143)) then
tmp = 4.0d0
else if (y <= 4d+68) 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 <= -3.7e+143) {
tmp = 4.0;
} else if (y <= 4e+68) {
tmp = 4.0 * ((x - z) / y);
} else {
tmp = 4.0;
}
return tmp;
}
def code(x, y, z): tmp = 0 if y <= -3.7e+143: tmp = 4.0 elif y <= 4e+68: tmp = 4.0 * ((x - z) / y) else: tmp = 4.0 return tmp
function code(x, y, z) tmp = 0.0 if (y <= -3.7e+143) tmp = 4.0; elseif (y <= 4e+68) 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 <= -3.7e+143) tmp = 4.0; elseif (y <= 4e+68) tmp = 4.0 * ((x - z) / y); else tmp = 4.0; end tmp_2 = tmp; end
code[x_, y_, z_] := If[LessEqual[y, -3.7e+143], 4.0, If[LessEqual[y, 4e+68], N[(4.0 * N[(N[(x - z), $MachinePrecision] / y), $MachinePrecision]), $MachinePrecision], 4.0]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;y \leq -3.7 \cdot 10^{+143}:\\
\;\;\;\;4\\
\mathbf{elif}\;y \leq 4 \cdot 10^{+68}:\\
\;\;\;\;4 \cdot \frac{x - z}{y}\\
\mathbf{else}:\\
\;\;\;\;4\\
\end{array}
\end{array}
if y < -3.7000000000000002e143 or 3.99999999999999981e68 < y Initial program 99.8%
Taylor expanded in y around inf 76.6%
if -3.7000000000000002e143 < y < 3.99999999999999981e68Initial program 100.0%
Taylor expanded in y around 0 87.3%
(FPCore (x y z) :precision binary64 (if (<= y -5e+23) 4.0 (if (<= y 4.5e+63) (* 4.0 (/ x y)) 4.0)))
double code(double x, double y, double z) {
double tmp;
if (y <= -5e+23) {
tmp = 4.0;
} else if (y <= 4.5e+63) {
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 <= (-5d+23)) then
tmp = 4.0d0
else if (y <= 4.5d+63) 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 <= -5e+23) {
tmp = 4.0;
} else if (y <= 4.5e+63) {
tmp = 4.0 * (x / y);
} else {
tmp = 4.0;
}
return tmp;
}
def code(x, y, z): tmp = 0 if y <= -5e+23: tmp = 4.0 elif y <= 4.5e+63: tmp = 4.0 * (x / y) else: tmp = 4.0 return tmp
function code(x, y, z) tmp = 0.0 if (y <= -5e+23) tmp = 4.0; elseif (y <= 4.5e+63) 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 <= -5e+23) tmp = 4.0; elseif (y <= 4.5e+63) tmp = 4.0 * (x / y); else tmp = 4.0; end tmp_2 = tmp; end
code[x_, y_, z_] := If[LessEqual[y, -5e+23], 4.0, If[LessEqual[y, 4.5e+63], N[(4.0 * N[(x / y), $MachinePrecision]), $MachinePrecision], 4.0]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;y \leq -5 \cdot 10^{+23}:\\
\;\;\;\;4\\
\mathbf{elif}\;y \leq 4.5 \cdot 10^{+63}:\\
\;\;\;\;4 \cdot \frac{x}{y}\\
\mathbf{else}:\\
\;\;\;\;4\\
\end{array}
\end{array}
if y < -4.9999999999999999e23 or 4.50000000000000017e63 < y Initial program 99.9%
Taylor expanded in y around inf 68.8%
if -4.9999999999999999e23 < y < 4.50000000000000017e63Initial program 100.0%
Taylor expanded in x around inf 50.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 36.9%
herbie shell --seed 2024146
(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)))