
(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 0 100.0%
Final simplification100.0%
(FPCore (x y z)
:precision binary64
(if (<= y -5.3e+178)
4.0
(if (or (<= y 9.2e+59) (and (not (<= y 2.9e+93)) (<= y 1.9e+140)))
(* 4.0 (/ (- x z) y))
4.0)))
double code(double x, double y, double z) {
double tmp;
if (y <= -5.3e+178) {
tmp = 4.0;
} else if ((y <= 9.2e+59) || (!(y <= 2.9e+93) && (y <= 1.9e+140))) {
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 <= (-5.3d+178)) then
tmp = 4.0d0
else if ((y <= 9.2d+59) .or. (.not. (y <= 2.9d+93)) .and. (y <= 1.9d+140)) 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 <= -5.3e+178) {
tmp = 4.0;
} else if ((y <= 9.2e+59) || (!(y <= 2.9e+93) && (y <= 1.9e+140))) {
tmp = 4.0 * ((x - z) / y);
} else {
tmp = 4.0;
}
return tmp;
}
def code(x, y, z): tmp = 0 if y <= -5.3e+178: tmp = 4.0 elif (y <= 9.2e+59) or (not (y <= 2.9e+93) and (y <= 1.9e+140)): tmp = 4.0 * ((x - z) / y) else: tmp = 4.0 return tmp
function code(x, y, z) tmp = 0.0 if (y <= -5.3e+178) tmp = 4.0; elseif ((y <= 9.2e+59) || (!(y <= 2.9e+93) && (y <= 1.9e+140))) 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 <= -5.3e+178) tmp = 4.0; elseif ((y <= 9.2e+59) || (~((y <= 2.9e+93)) && (y <= 1.9e+140))) tmp = 4.0 * ((x - z) / y); else tmp = 4.0; end tmp_2 = tmp; end
code[x_, y_, z_] := If[LessEqual[y, -5.3e+178], 4.0, If[Or[LessEqual[y, 9.2e+59], And[N[Not[LessEqual[y, 2.9e+93]], $MachinePrecision], LessEqual[y, 1.9e+140]]], N[(4.0 * N[(N[(x - z), $MachinePrecision] / y), $MachinePrecision]), $MachinePrecision], 4.0]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;y \leq -5.3 \cdot 10^{+178}:\\
\;\;\;\;4\\
\mathbf{elif}\;y \leq 9.2 \cdot 10^{+59} \lor \neg \left(y \leq 2.9 \cdot 10^{+93}\right) \land y \leq 1.9 \cdot 10^{+140}:\\
\;\;\;\;4 \cdot \frac{x - z}{y}\\
\mathbf{else}:\\
\;\;\;\;4\\
\end{array}
\end{array}
if y < -5.29999999999999988e178 or 9.20000000000000032e59 < y < 2.8999999999999998e93 or 1.9e140 < y Initial program 99.8%
Taylor expanded in y around inf 84.9%
if -5.29999999999999988e178 < y < 9.20000000000000032e59 or 2.8999999999999998e93 < y < 1.9e140Initial program 100.0%
+-commutative100.0%
flip-+47.5%
Applied egg-rr47.1%
Taylor expanded in y around 0 80.6%
Final simplification81.7%
(FPCore (x y z)
:precision binary64
(let* ((t_0 (* 4.0 (/ x y))))
(if (<= x -9.5e-29)
t_0
(if (<= x 2600.0) 4.0 (if (<= x 1.9e+66) (* (/ z y) -4.0) t_0)))))
double code(double x, double y, double z) {
double t_0 = 4.0 * (x / y);
double tmp;
if (x <= -9.5e-29) {
tmp = t_0;
} else if (x <= 2600.0) {
tmp = 4.0;
} else if (x <= 1.9e+66) {
tmp = (z / y) * -4.0;
} 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 <= (-9.5d-29)) then
tmp = t_0
else if (x <= 2600.0d0) then
tmp = 4.0d0
else if (x <= 1.9d+66) then
tmp = (z / y) * (-4.0d0)
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 <= -9.5e-29) {
tmp = t_0;
} else if (x <= 2600.0) {
tmp = 4.0;
} else if (x <= 1.9e+66) {
tmp = (z / y) * -4.0;
} else {
tmp = t_0;
}
return tmp;
}
def code(x, y, z): t_0 = 4.0 * (x / y) tmp = 0 if x <= -9.5e-29: tmp = t_0 elif x <= 2600.0: tmp = 4.0 elif x <= 1.9e+66: tmp = (z / y) * -4.0 else: tmp = t_0 return tmp
function code(x, y, z) t_0 = Float64(4.0 * Float64(x / y)) tmp = 0.0 if (x <= -9.5e-29) tmp = t_0; elseif (x <= 2600.0) tmp = 4.0; elseif (x <= 1.9e+66) tmp = Float64(Float64(z / y) * -4.0); 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 <= -9.5e-29) tmp = t_0; elseif (x <= 2600.0) tmp = 4.0; elseif (x <= 1.9e+66) tmp = (z / y) * -4.0; 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, -9.5e-29], t$95$0, If[LessEqual[x, 2600.0], 4.0, If[LessEqual[x, 1.9e+66], N[(N[(z / y), $MachinePrecision] * -4.0), $MachinePrecision], t$95$0]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := 4 \cdot \frac{x}{y}\\
\mathbf{if}\;x \leq -9.5 \cdot 10^{-29}:\\
\;\;\;\;t_0\\
\mathbf{elif}\;x \leq 2600:\\
\;\;\;\;4\\
\mathbf{elif}\;x \leq 1.9 \cdot 10^{+66}:\\
\;\;\;\;\frac{z}{y} \cdot -4\\
\mathbf{else}:\\
\;\;\;\;t_0\\
\end{array}
\end{array}
if x < -9.50000000000000023e-29 or 1.9000000000000001e66 < x Initial program 100.0%
+-commutative100.0%
flip-+47.4%
Applied egg-rr47.0%
Taylor expanded in z around inf 75.7%
Taylor expanded in x around inf 66.5%
if -9.50000000000000023e-29 < x < 2600Initial program 99.9%
Taylor expanded in y around inf 56.2%
if 2600 < x < 1.9000000000000001e66Initial program 99.9%
+-commutative99.9%
flip-+46.6%
Applied egg-rr46.5%
Taylor expanded in z around inf 99.6%
Taylor expanded in z around inf 68.8%
Final simplification62.0%
(FPCore (x y z)
:precision binary64
(let* ((t_0 (* 4.0 (/ x y))))
(if (<= x -3.1e-29)
t_0
(if (<= x 420.0) 4.0 (if (<= x 7.4e+68) (* z (/ -4.0 y)) t_0)))))
double code(double x, double y, double z) {
double t_0 = 4.0 * (x / y);
double tmp;
if (x <= -3.1e-29) {
tmp = t_0;
} else if (x <= 420.0) {
tmp = 4.0;
} else if (x <= 7.4e+68) {
tmp = z * (-4.0 / 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 <= (-3.1d-29)) then
tmp = t_0
else if (x <= 420.0d0) then
tmp = 4.0d0
else if (x <= 7.4d+68) then
tmp = z * ((-4.0d0) / 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 <= -3.1e-29) {
tmp = t_0;
} else if (x <= 420.0) {
tmp = 4.0;
} else if (x <= 7.4e+68) {
tmp = z * (-4.0 / y);
} else {
tmp = t_0;
}
return tmp;
}
def code(x, y, z): t_0 = 4.0 * (x / y) tmp = 0 if x <= -3.1e-29: tmp = t_0 elif x <= 420.0: tmp = 4.0 elif x <= 7.4e+68: tmp = z * (-4.0 / 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 <= -3.1e-29) tmp = t_0; elseif (x <= 420.0) tmp = 4.0; elseif (x <= 7.4e+68) tmp = Float64(z * Float64(-4.0 / 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 <= -3.1e-29) tmp = t_0; elseif (x <= 420.0) tmp = 4.0; elseif (x <= 7.4e+68) tmp = z * (-4.0 / 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, -3.1e-29], t$95$0, If[LessEqual[x, 420.0], 4.0, If[LessEqual[x, 7.4e+68], N[(z * N[(-4.0 / y), $MachinePrecision]), $MachinePrecision], t$95$0]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := 4 \cdot \frac{x}{y}\\
\mathbf{if}\;x \leq -3.1 \cdot 10^{-29}:\\
\;\;\;\;t_0\\
\mathbf{elif}\;x \leq 420:\\
\;\;\;\;4\\
\mathbf{elif}\;x \leq 7.4 \cdot 10^{+68}:\\
\;\;\;\;z \cdot \frac{-4}{y}\\
\mathbf{else}:\\
\;\;\;\;t_0\\
\end{array}
\end{array}
if x < -3.10000000000000026e-29 or 7.39999999999999996e68 < x Initial program 100.0%
+-commutative100.0%
flip-+47.4%
Applied egg-rr47.0%
Taylor expanded in z around inf 75.7%
Taylor expanded in x around inf 66.5%
if -3.10000000000000026e-29 < x < 420Initial program 99.9%
Taylor expanded in y around inf 56.2%
if 420 < x < 7.39999999999999996e68Initial program 99.9%
+-commutative99.9%
flip-+46.6%
Applied egg-rr46.5%
Taylor expanded in z around inf 99.6%
Taylor expanded in z around inf 68.8%
associate-*r/68.8%
associate-/l*68.8%
associate-/r/68.9%
Simplified68.9%
Final simplification62.0%
(FPCore (x y z) :precision binary64 (if (or (<= x -6.5e-30) (not (<= x 2e+64))) (* 4.0 (/ (- x z) y)) (+ 4.0 (* (/ z y) -4.0))))
double code(double x, double y, double z) {
double tmp;
if ((x <= -6.5e-30) || !(x <= 2e+64)) {
tmp = 4.0 * ((x - z) / y);
} else {
tmp = 4.0 + ((z / y) * -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 ((x <= (-6.5d-30)) .or. (.not. (x <= 2d+64))) then
tmp = 4.0d0 * ((x - z) / y)
else
tmp = 4.0d0 + ((z / y) * (-4.0d0))
end if
code = tmp
end function
public static double code(double x, double y, double z) {
double tmp;
if ((x <= -6.5e-30) || !(x <= 2e+64)) {
tmp = 4.0 * ((x - z) / y);
} else {
tmp = 4.0 + ((z / y) * -4.0);
}
return tmp;
}
def code(x, y, z): tmp = 0 if (x <= -6.5e-30) or not (x <= 2e+64): tmp = 4.0 * ((x - z) / y) else: tmp = 4.0 + ((z / y) * -4.0) return tmp
function code(x, y, z) tmp = 0.0 if ((x <= -6.5e-30) || !(x <= 2e+64)) tmp = Float64(4.0 * Float64(Float64(x - z) / y)); else tmp = Float64(4.0 + Float64(Float64(z / y) * -4.0)); end return tmp end
function tmp_2 = code(x, y, z) tmp = 0.0; if ((x <= -6.5e-30) || ~((x <= 2e+64))) tmp = 4.0 * ((x - z) / y); else tmp = 4.0 + ((z / y) * -4.0); end tmp_2 = tmp; end
code[x_, y_, z_] := If[Or[LessEqual[x, -6.5e-30], N[Not[LessEqual[x, 2e+64]], $MachinePrecision]], N[(4.0 * N[(N[(x - z), $MachinePrecision] / y), $MachinePrecision]), $MachinePrecision], N[(4.0 + N[(N[(z / y), $MachinePrecision] * -4.0), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x \leq -6.5 \cdot 10^{-30} \lor \neg \left(x \leq 2 \cdot 10^{+64}\right):\\
\;\;\;\;4 \cdot \frac{x - z}{y}\\
\mathbf{else}:\\
\;\;\;\;4 + \frac{z}{y} \cdot -4\\
\end{array}
\end{array}
if x < -6.5000000000000005e-30 or 2.00000000000000004e64 < x Initial program 100.0%
+-commutative100.0%
flip-+47.9%
Applied egg-rr47.4%
Taylor expanded in y around 0 81.9%
if -6.5000000000000005e-30 < x < 2.00000000000000004e64Initial program 99.9%
associate-*l/99.8%
+-commutative99.8%
associate--l+99.8%
distribute-lft-in99.8%
associate-+r+99.8%
*-commutative99.8%
+-commutative99.8%
fma-def99.8%
associate-*r*99.8%
associate-*l/99.9%
associate-/l*99.9%
*-inverses99.9%
metadata-eval99.9%
metadata-eval99.9%
metadata-eval99.9%
Simplified99.9%
Taylor expanded in x around 0 92.4%
*-commutative92.4%
Simplified92.4%
Final simplification87.1%
(FPCore (x y z) :precision binary64 (if (<= z -2.6e+44) (+ 4.0 (* (/ z y) -4.0)) (if (<= z 1.9e+78) (+ 4.0 (/ (* 4.0 x) y)) (* 4.0 (/ (- x z) y)))))
double code(double x, double y, double z) {
double tmp;
if (z <= -2.6e+44) {
tmp = 4.0 + ((z / y) * -4.0);
} else if (z <= 1.9e+78) {
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 (z <= (-2.6d+44)) then
tmp = 4.0d0 + ((z / y) * (-4.0d0))
else if (z <= 1.9d+78) 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 (z <= -2.6e+44) {
tmp = 4.0 + ((z / y) * -4.0);
} else if (z <= 1.9e+78) {
tmp = 4.0 + ((4.0 * x) / y);
} else {
tmp = 4.0 * ((x - z) / y);
}
return tmp;
}
def code(x, y, z): tmp = 0 if z <= -2.6e+44: tmp = 4.0 + ((z / y) * -4.0) elif z <= 1.9e+78: 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 (z <= -2.6e+44) tmp = Float64(4.0 + Float64(Float64(z / y) * -4.0)); elseif (z <= 1.9e+78) tmp = Float64(4.0 + Float64(Float64(4.0 * 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 (z <= -2.6e+44) tmp = 4.0 + ((z / y) * -4.0); elseif (z <= 1.9e+78) tmp = 4.0 + ((4.0 * x) / y); else tmp = 4.0 * ((x - z) / y); end tmp_2 = tmp; end
code[x_, y_, z_] := If[LessEqual[z, -2.6e+44], N[(4.0 + N[(N[(z / y), $MachinePrecision] * -4.0), $MachinePrecision]), $MachinePrecision], If[LessEqual[z, 1.9e+78], N[(4.0 + N[(N[(4.0 * x), $MachinePrecision] / y), $MachinePrecision]), $MachinePrecision], N[(4.0 * N[(N[(x - z), $MachinePrecision] / y), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \leq -2.6 \cdot 10^{+44}:\\
\;\;\;\;4 + \frac{z}{y} \cdot -4\\
\mathbf{elif}\;z \leq 1.9 \cdot 10^{+78}:\\
\;\;\;\;4 + \frac{4 \cdot x}{y}\\
\mathbf{else}:\\
\;\;\;\;4 \cdot \frac{x - z}{y}\\
\end{array}
\end{array}
if z < -2.5999999999999999e44Initial program 100.0%
associate-*l/99.7%
+-commutative99.7%
associate--l+99.7%
distribute-lft-in99.7%
associate-+r+99.7%
*-commutative99.7%
+-commutative99.7%
fma-def99.7%
associate-*r*99.7%
associate-*l/99.8%
associate-/l*99.8%
*-inverses99.8%
metadata-eval99.8%
metadata-eval99.8%
metadata-eval99.8%
Simplified99.8%
Taylor expanded in x around 0 88.0%
*-commutative88.0%
Simplified88.0%
if -2.5999999999999999e44 < z < 1.9e78Initial program 99.9%
associate-*l/99.7%
+-commutative99.7%
associate--l+99.7%
distribute-lft-in99.7%
associate-+r+99.7%
*-commutative99.7%
+-commutative99.7%
fma-def99.7%
associate-*r*99.7%
associate-*l/99.8%
associate-/l*99.8%
*-inverses99.8%
metadata-eval99.8%
metadata-eval99.8%
metadata-eval99.8%
Simplified99.8%
Taylor expanded in z around 0 92.3%
associate-*r/92.3%
Simplified92.3%
if 1.9e78 < z Initial program 100.0%
+-commutative100.0%
flip-+30.6%
Applied egg-rr30.4%
Taylor expanded in y around 0 90.6%
Final simplification91.2%
(FPCore (x y z) :precision binary64 (if (or (<= z -1.95e+115) (not (<= z 3e+99))) (* (/ z y) -4.0) 4.0))
double code(double x, double y, double z) {
double tmp;
if ((z <= -1.95e+115) || !(z <= 3e+99)) {
tmp = (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.95d+115)) .or. (.not. (z <= 3d+99))) then
tmp = (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.95e+115) || !(z <= 3e+99)) {
tmp = (z / y) * -4.0;
} else {
tmp = 4.0;
}
return tmp;
}
def code(x, y, z): tmp = 0 if (z <= -1.95e+115) or not (z <= 3e+99): tmp = (z / y) * -4.0 else: tmp = 4.0 return tmp
function code(x, y, z) tmp = 0.0 if ((z <= -1.95e+115) || !(z <= 3e+99)) tmp = 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.95e+115) || ~((z <= 3e+99))) tmp = (z / y) * -4.0; else tmp = 4.0; end tmp_2 = tmp; end
code[x_, y_, z_] := If[Or[LessEqual[z, -1.95e+115], N[Not[LessEqual[z, 3e+99]], $MachinePrecision]], N[(N[(z / y), $MachinePrecision] * -4.0), $MachinePrecision], 4.0]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \leq -1.95 \cdot 10^{+115} \lor \neg \left(z \leq 3 \cdot 10^{+99}\right):\\
\;\;\;\;\frac{z}{y} \cdot -4\\
\mathbf{else}:\\
\;\;\;\;4\\
\end{array}
\end{array}
if z < -1.95000000000000003e115 or 3.00000000000000014e99 < z Initial program 100.0%
+-commutative100.0%
flip-+30.5%
Applied egg-rr30.3%
Taylor expanded in z around inf 84.4%
Taylor expanded in z around inf 79.3%
if -1.95000000000000003e115 < z < 3.00000000000000014e99Initial program 99.9%
Taylor expanded in y around inf 46.4%
Final simplification56.3%
(FPCore (x y z) :precision binary64 -3.0)
double code(double x, double y, double z) {
return -3.0;
}
real(8) function code(x, y, z)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
code = -3.0d0
end function
public static double code(double x, double y, double z) {
return -3.0;
}
def code(x, y, z): return -3.0
function code(x, y, z) return -3.0 end
function tmp = code(x, y, z) tmp = -3.0; end
code[x_, y_, z_] := -3.0
\begin{array}{l}
\\
-3
\end{array}
Initial program 99.9%
+-commutative99.9%
flip-+60.3%
Applied egg-rr59.8%
Taylor expanded in z around inf 87.7%
Taylor expanded in y around 0 52.4%
Taylor expanded in y around inf 2.5%
Final simplification2.5%
(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.7%
Final simplification35.7%
herbie shell --seed 2023185
(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)))