
(FPCore (x y z) :precision binary64 (+ 1.0 (/ (* 4.0 (- (+ x (* y 0.25)) z)) y)))
double code(double x, double y, double z) {
return 1.0 + ((4.0 * ((x + (y * 0.25)) - 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.25d0)) - z)) / y)
end function
public static double code(double x, double y, double z) {
return 1.0 + ((4.0 * ((x + (y * 0.25)) - z)) / y);
}
def code(x, y, z): return 1.0 + ((4.0 * ((x + (y * 0.25)) - z)) / y)
function code(x, y, z) return Float64(1.0 + Float64(Float64(4.0 * Float64(Float64(x + Float64(y * 0.25)) - z)) / y)) end
function tmp = code(x, y, z) tmp = 1.0 + ((4.0 * ((x + (y * 0.25)) - z)) / y); end
code[x_, y_, z_] := N[(1.0 + N[(N[(4.0 * N[(N[(x + N[(y * 0.25), $MachinePrecision]), $MachinePrecision] - z), $MachinePrecision]), $MachinePrecision] / y), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
1 + \frac{4 \cdot \left(\left(x + y \cdot 0.25\right) - z\right)}{y}
\end{array}
Sampling outcomes in binary64 precision:
Herbie found 12 alternatives:
| Alternative | Accuracy | Speedup |
|---|
(FPCore (x y z) :precision binary64 (+ 1.0 (/ (* 4.0 (- (+ x (* y 0.25)) z)) y)))
double code(double x, double y, double z) {
return 1.0 + ((4.0 * ((x + (y * 0.25)) - 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.25d0)) - z)) / y)
end function
public static double code(double x, double y, double z) {
return 1.0 + ((4.0 * ((x + (y * 0.25)) - z)) / y);
}
def code(x, y, z): return 1.0 + ((4.0 * ((x + (y * 0.25)) - z)) / y)
function code(x, y, z) return Float64(1.0 + Float64(Float64(4.0 * Float64(Float64(x + Float64(y * 0.25)) - z)) / y)) end
function tmp = code(x, y, z) tmp = 1.0 + ((4.0 * ((x + (y * 0.25)) - z)) / y); end
code[x_, y_, z_] := N[(1.0 + N[(N[(4.0 * N[(N[(x + N[(y * 0.25), $MachinePrecision]), $MachinePrecision] - z), $MachinePrecision]), $MachinePrecision] / y), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
1 + \frac{4 \cdot \left(\left(x + y \cdot 0.25\right) - z\right)}{y}
\end{array}
(FPCore (x y z) :precision binary64 (+ 1.0 (/ (* 4.0 (- (+ x (* y 0.25)) z)) y)))
double code(double x, double y, double z) {
return 1.0 + ((4.0 * ((x + (y * 0.25)) - 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.25d0)) - z)) / y)
end function
public static double code(double x, double y, double z) {
return 1.0 + ((4.0 * ((x + (y * 0.25)) - z)) / y);
}
def code(x, y, z): return 1.0 + ((4.0 * ((x + (y * 0.25)) - z)) / y)
function code(x, y, z) return Float64(1.0 + Float64(Float64(4.0 * Float64(Float64(x + Float64(y * 0.25)) - z)) / y)) end
function tmp = code(x, y, z) tmp = 1.0 + ((4.0 * ((x + (y * 0.25)) - z)) / y); end
code[x_, y_, z_] := N[(1.0 + N[(N[(4.0 * N[(N[(x + N[(y * 0.25), $MachinePrecision]), $MachinePrecision] - z), $MachinePrecision]), $MachinePrecision] / y), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
1 + \frac{4 \cdot \left(\left(x + y \cdot 0.25\right) - z\right)}{y}
\end{array}
Initial program 100.0%
(FPCore (x y z)
:precision binary64
(let* ((t_0 (/ (* 4.0 x) y)))
(if (<= x -8.6e+43)
t_0
(if (<= x -2.15e-284) (* (/ z y) -4.0) (if (<= x 2.6e+120) 2.0 t_0)))))
double code(double x, double y, double z) {
double t_0 = (4.0 * x) / y;
double tmp;
if (x <= -8.6e+43) {
tmp = t_0;
} else if (x <= -2.15e-284) {
tmp = (z / y) * -4.0;
} else if (x <= 2.6e+120) {
tmp = 2.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 <= (-8.6d+43)) then
tmp = t_0
else if (x <= (-2.15d-284)) then
tmp = (z / y) * (-4.0d0)
else if (x <= 2.6d+120) then
tmp = 2.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 <= -8.6e+43) {
tmp = t_0;
} else if (x <= -2.15e-284) {
tmp = (z / y) * -4.0;
} else if (x <= 2.6e+120) {
tmp = 2.0;
} else {
tmp = t_0;
}
return tmp;
}
def code(x, y, z): t_0 = (4.0 * x) / y tmp = 0 if x <= -8.6e+43: tmp = t_0 elif x <= -2.15e-284: tmp = (z / y) * -4.0 elif x <= 2.6e+120: tmp = 2.0 else: tmp = t_0 return tmp
function code(x, y, z) t_0 = Float64(Float64(4.0 * x) / y) tmp = 0.0 if (x <= -8.6e+43) tmp = t_0; elseif (x <= -2.15e-284) tmp = Float64(Float64(z / y) * -4.0); elseif (x <= 2.6e+120) tmp = 2.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 <= -8.6e+43) tmp = t_0; elseif (x <= -2.15e-284) tmp = (z / y) * -4.0; elseif (x <= 2.6e+120) tmp = 2.0; else tmp = t_0; end tmp_2 = tmp; end
code[x_, y_, z_] := Block[{t$95$0 = N[(N[(4.0 * x), $MachinePrecision] / y), $MachinePrecision]}, If[LessEqual[x, -8.6e+43], t$95$0, If[LessEqual[x, -2.15e-284], N[(N[(z / y), $MachinePrecision] * -4.0), $MachinePrecision], If[LessEqual[x, 2.6e+120], 2.0, t$95$0]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := \frac{4 \cdot x}{y}\\
\mathbf{if}\;x \leq -8.6 \cdot 10^{+43}:\\
\;\;\;\;t\_0\\
\mathbf{elif}\;x \leq -2.15 \cdot 10^{-284}:\\
\;\;\;\;\frac{z}{y} \cdot -4\\
\mathbf{elif}\;x \leq 2.6 \cdot 10^{+120}:\\
\;\;\;\;2\\
\mathbf{else}:\\
\;\;\;\;t\_0\\
\end{array}
\end{array}
if x < -8.6e43 or 2.5999999999999999e120 < x Initial program 99.9%
Taylor expanded in x around inf 72.1%
associate-*r/72.1%
Simplified72.1%
if -8.6e43 < x < -2.1500000000000001e-284Initial program 100.0%
Taylor expanded in z around inf 56.0%
*-commutative56.0%
Simplified56.0%
if -2.1500000000000001e-284 < x < 2.5999999999999999e120Initial program 100.0%
Taylor expanded in y around inf 55.1%
(FPCore (x y z)
:precision binary64
(let* ((t_0 (* x (/ 4.0 y))))
(if (<= x -1.15e+45)
t_0
(if (<= x -3.6e-284) (* (/ z y) -4.0) (if (<= x 2.3e+120) 2.0 t_0)))))
double code(double x, double y, double z) {
double t_0 = x * (4.0 / y);
double tmp;
if (x <= -1.15e+45) {
tmp = t_0;
} else if (x <= -3.6e-284) {
tmp = (z / y) * -4.0;
} else if (x <= 2.3e+120) {
tmp = 2.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 = x * (4.0d0 / y)
if (x <= (-1.15d+45)) then
tmp = t_0
else if (x <= (-3.6d-284)) then
tmp = (z / y) * (-4.0d0)
else if (x <= 2.3d+120) then
tmp = 2.0d0
else
tmp = t_0
end if
code = tmp
end function
public static double code(double x, double y, double z) {
double t_0 = x * (4.0 / y);
double tmp;
if (x <= -1.15e+45) {
tmp = t_0;
} else if (x <= -3.6e-284) {
tmp = (z / y) * -4.0;
} else if (x <= 2.3e+120) {
tmp = 2.0;
} else {
tmp = t_0;
}
return tmp;
}
def code(x, y, z): t_0 = x * (4.0 / y) tmp = 0 if x <= -1.15e+45: tmp = t_0 elif x <= -3.6e-284: tmp = (z / y) * -4.0 elif x <= 2.3e+120: tmp = 2.0 else: tmp = t_0 return tmp
function code(x, y, z) t_0 = Float64(x * Float64(4.0 / y)) tmp = 0.0 if (x <= -1.15e+45) tmp = t_0; elseif (x <= -3.6e-284) tmp = Float64(Float64(z / y) * -4.0); elseif (x <= 2.3e+120) tmp = 2.0; else tmp = t_0; end return tmp end
function tmp_2 = code(x, y, z) t_0 = x * (4.0 / y); tmp = 0.0; if (x <= -1.15e+45) tmp = t_0; elseif (x <= -3.6e-284) tmp = (z / y) * -4.0; elseif (x <= 2.3e+120) tmp = 2.0; else tmp = t_0; end tmp_2 = tmp; end
code[x_, y_, z_] := Block[{t$95$0 = N[(x * N[(4.0 / y), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[x, -1.15e+45], t$95$0, If[LessEqual[x, -3.6e-284], N[(N[(z / y), $MachinePrecision] * -4.0), $MachinePrecision], If[LessEqual[x, 2.3e+120], 2.0, t$95$0]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := x \cdot \frac{4}{y}\\
\mathbf{if}\;x \leq -1.15 \cdot 10^{+45}:\\
\;\;\;\;t\_0\\
\mathbf{elif}\;x \leq -3.6 \cdot 10^{-284}:\\
\;\;\;\;\frac{z}{y} \cdot -4\\
\mathbf{elif}\;x \leq 2.3 \cdot 10^{+120}:\\
\;\;\;\;2\\
\mathbf{else}:\\
\;\;\;\;t\_0\\
\end{array}
\end{array}
if x < -1.15000000000000006e45 or 2.29999999999999993e120 < x Initial program 99.9%
Taylor expanded in x around inf 72.1%
associate-*r/72.1%
associate-*l/71.8%
*-commutative71.8%
Simplified71.8%
if -1.15000000000000006e45 < x < -3.6000000000000002e-284Initial program 100.0%
Taylor expanded in z around inf 56.0%
*-commutative56.0%
Simplified56.0%
if -3.6000000000000002e-284 < x < 2.29999999999999993e120Initial program 100.0%
Taylor expanded in y around inf 55.1%
(FPCore (x y z)
:precision binary64
(let* ((t_0 (* x (/ 4.0 y))))
(if (<= x -5.2e+44)
t_0
(if (<= x -8.2e-286) (* z (/ -4.0 y)) (if (<= x 1.9e+120) 2.0 t_0)))))
double code(double x, double y, double z) {
double t_0 = x * (4.0 / y);
double tmp;
if (x <= -5.2e+44) {
tmp = t_0;
} else if (x <= -8.2e-286) {
tmp = z * (-4.0 / y);
} else if (x <= 1.9e+120) {
tmp = 2.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 = x * (4.0d0 / y)
if (x <= (-5.2d+44)) then
tmp = t_0
else if (x <= (-8.2d-286)) then
tmp = z * ((-4.0d0) / y)
else if (x <= 1.9d+120) then
tmp = 2.0d0
else
tmp = t_0
end if
code = tmp
end function
public static double code(double x, double y, double z) {
double t_0 = x * (4.0 / y);
double tmp;
if (x <= -5.2e+44) {
tmp = t_0;
} else if (x <= -8.2e-286) {
tmp = z * (-4.0 / y);
} else if (x <= 1.9e+120) {
tmp = 2.0;
} else {
tmp = t_0;
}
return tmp;
}
def code(x, y, z): t_0 = x * (4.0 / y) tmp = 0 if x <= -5.2e+44: tmp = t_0 elif x <= -8.2e-286: tmp = z * (-4.0 / y) elif x <= 1.9e+120: tmp = 2.0 else: tmp = t_0 return tmp
function code(x, y, z) t_0 = Float64(x * Float64(4.0 / y)) tmp = 0.0 if (x <= -5.2e+44) tmp = t_0; elseif (x <= -8.2e-286) tmp = Float64(z * Float64(-4.0 / y)); elseif (x <= 1.9e+120) tmp = 2.0; else tmp = t_0; end return tmp end
function tmp_2 = code(x, y, z) t_0 = x * (4.0 / y); tmp = 0.0; if (x <= -5.2e+44) tmp = t_0; elseif (x <= -8.2e-286) tmp = z * (-4.0 / y); elseif (x <= 1.9e+120) tmp = 2.0; else tmp = t_0; end tmp_2 = tmp; end
code[x_, y_, z_] := Block[{t$95$0 = N[(x * N[(4.0 / y), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[x, -5.2e+44], t$95$0, If[LessEqual[x, -8.2e-286], N[(z * N[(-4.0 / y), $MachinePrecision]), $MachinePrecision], If[LessEqual[x, 1.9e+120], 2.0, t$95$0]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := x \cdot \frac{4}{y}\\
\mathbf{if}\;x \leq -5.2 \cdot 10^{+44}:\\
\;\;\;\;t\_0\\
\mathbf{elif}\;x \leq -8.2 \cdot 10^{-286}:\\
\;\;\;\;z \cdot \frac{-4}{y}\\
\mathbf{elif}\;x \leq 1.9 \cdot 10^{+120}:\\
\;\;\;\;2\\
\mathbf{else}:\\
\;\;\;\;t\_0\\
\end{array}
\end{array}
if x < -5.1999999999999998e44 or 1.8999999999999999e120 < x Initial program 99.9%
Taylor expanded in x around inf 72.1%
associate-*r/72.1%
associate-*l/71.8%
*-commutative71.8%
Simplified71.8%
if -5.1999999999999998e44 < x < -8.2e-286Initial program 100.0%
Taylor expanded in z around inf 56.0%
associate-*r/56.0%
*-commutative56.0%
associate-/l*55.8%
Simplified55.8%
if -8.2e-286 < x < 1.8999999999999999e120Initial program 100.0%
Taylor expanded in y around inf 55.1%
(FPCore (x y z) :precision binary64 (if (or (<= y -3.8e+64) (not (<= y 1.05e+67))) (+ 2.0 (* 4.0 (/ x y))) (* 4.0 (/ (- x z) y))))
double code(double x, double y, double z) {
double tmp;
if ((y <= -3.8e+64) || !(y <= 1.05e+67)) {
tmp = 2.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 <= (-3.8d+64)) .or. (.not. (y <= 1.05d+67))) then
tmp = 2.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 <= -3.8e+64) || !(y <= 1.05e+67)) {
tmp = 2.0 + (4.0 * (x / y));
} else {
tmp = 4.0 * ((x - z) / y);
}
return tmp;
}
def code(x, y, z): tmp = 0 if (y <= -3.8e+64) or not (y <= 1.05e+67): tmp = 2.0 + (4.0 * (x / y)) else: tmp = 4.0 * ((x - z) / y) return tmp
function code(x, y, z) tmp = 0.0 if ((y <= -3.8e+64) || !(y <= 1.05e+67)) tmp = Float64(2.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 <= -3.8e+64) || ~((y <= 1.05e+67))) tmp = 2.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, -3.8e+64], N[Not[LessEqual[y, 1.05e+67]], $MachinePrecision]], N[(2.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 -3.8 \cdot 10^{+64} \lor \neg \left(y \leq 1.05 \cdot 10^{+67}\right):\\
\;\;\;\;2 + 4 \cdot \frac{x}{y}\\
\mathbf{else}:\\
\;\;\;\;4 \cdot \frac{x - z}{y}\\
\end{array}
\end{array}
if y < -3.8000000000000001e64 or 1.0500000000000001e67 < y Initial program 100.0%
+-commutative100.0%
associate-*l/99.8%
+-commutative99.8%
associate--l+99.8%
+-commutative99.8%
distribute-lft-in99.8%
associate-+l+99.8%
associate-*l/99.8%
*-commutative99.8%
associate-*l*99.8%
metadata-eval99.8%
*-rgt-identity99.8%
*-inverses99.8%
metadata-eval99.8%
Simplified99.8%
Taylor expanded in z around 0 84.6%
if -3.8000000000000001e64 < y < 1.0500000000000001e67Initial program 100.0%
Taylor expanded in y around 0 88.3%
Final simplification86.7%
(FPCore (x y z) :precision binary64 (if (<= x -1.6e+36) (* 4.0 (/ (- x z) y)) (if (<= x 3.1e+120) (+ 2.0 (* (/ z y) -4.0)) (+ 2.0 (* 4.0 (/ x y))))))
double code(double x, double y, double z) {
double tmp;
if (x <= -1.6e+36) {
tmp = 4.0 * ((x - z) / y);
} else if (x <= 3.1e+120) {
tmp = 2.0 + ((z / y) * -4.0);
} else {
tmp = 2.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 (x <= (-1.6d+36)) then
tmp = 4.0d0 * ((x - z) / y)
else if (x <= 3.1d+120) then
tmp = 2.0d0 + ((z / y) * (-4.0d0))
else
tmp = 2.0d0 + (4.0d0 * (x / y))
end if
code = tmp
end function
public static double code(double x, double y, double z) {
double tmp;
if (x <= -1.6e+36) {
tmp = 4.0 * ((x - z) / y);
} else if (x <= 3.1e+120) {
tmp = 2.0 + ((z / y) * -4.0);
} else {
tmp = 2.0 + (4.0 * (x / y));
}
return tmp;
}
def code(x, y, z): tmp = 0 if x <= -1.6e+36: tmp = 4.0 * ((x - z) / y) elif x <= 3.1e+120: tmp = 2.0 + ((z / y) * -4.0) else: tmp = 2.0 + (4.0 * (x / y)) return tmp
function code(x, y, z) tmp = 0.0 if (x <= -1.6e+36) tmp = Float64(4.0 * Float64(Float64(x - z) / y)); elseif (x <= 3.1e+120) tmp = Float64(2.0 + Float64(Float64(z / y) * -4.0)); else tmp = Float64(2.0 + Float64(4.0 * Float64(x / y))); end return tmp end
function tmp_2 = code(x, y, z) tmp = 0.0; if (x <= -1.6e+36) tmp = 4.0 * ((x - z) / y); elseif (x <= 3.1e+120) tmp = 2.0 + ((z / y) * -4.0); else tmp = 2.0 + (4.0 * (x / y)); end tmp_2 = tmp; end
code[x_, y_, z_] := If[LessEqual[x, -1.6e+36], N[(4.0 * N[(N[(x - z), $MachinePrecision] / y), $MachinePrecision]), $MachinePrecision], If[LessEqual[x, 3.1e+120], N[(2.0 + N[(N[(z / y), $MachinePrecision] * -4.0), $MachinePrecision]), $MachinePrecision], N[(2.0 + N[(4.0 * N[(x / y), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x \leq -1.6 \cdot 10^{+36}:\\
\;\;\;\;4 \cdot \frac{x - z}{y}\\
\mathbf{elif}\;x \leq 3.1 \cdot 10^{+120}:\\
\;\;\;\;2 + \frac{z}{y} \cdot -4\\
\mathbf{else}:\\
\;\;\;\;2 + 4 \cdot \frac{x}{y}\\
\end{array}
\end{array}
if x < -1.5999999999999999e36Initial program 99.9%
Taylor expanded in y around 0 83.9%
if -1.5999999999999999e36 < x < 3.09999999999999974e120Initial program 100.0%
+-commutative100.0%
associate-*l/99.8%
+-commutative99.8%
associate--l+99.8%
+-commutative99.8%
distribute-lft-in99.8%
associate-+l+99.8%
associate-*l/99.8%
*-commutative99.8%
associate-*l*99.8%
metadata-eval99.8%
*-rgt-identity99.8%
*-inverses99.8%
metadata-eval99.8%
Simplified99.8%
Taylor expanded in x around 0 92.1%
*-commutative92.1%
Simplified92.1%
if 3.09999999999999974e120 < x Initial program 100.0%
+-commutative100.0%
associate-*l/99.5%
+-commutative99.5%
associate--l+99.5%
+-commutative99.5%
distribute-lft-in99.6%
associate-+l+99.6%
associate-*l/99.6%
*-commutative99.6%
associate-*l*99.6%
metadata-eval99.6%
*-rgt-identity99.6%
*-inverses99.6%
metadata-eval99.6%
Simplified99.6%
Taylor expanded in z around 0 89.1%
(FPCore (x y z) :precision binary64 (if (<= y -1.32e+85) 2.0 (if (<= y 1.72e+162) (* 4.0 (/ (- x z) y)) 2.0)))
double code(double x, double y, double z) {
double tmp;
if (y <= -1.32e+85) {
tmp = 2.0;
} else if (y <= 1.72e+162) {
tmp = 4.0 * ((x - z) / y);
} else {
tmp = 2.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.32d+85)) then
tmp = 2.0d0
else if (y <= 1.72d+162) then
tmp = 4.0d0 * ((x - z) / y)
else
tmp = 2.0d0
end if
code = tmp
end function
public static double code(double x, double y, double z) {
double tmp;
if (y <= -1.32e+85) {
tmp = 2.0;
} else if (y <= 1.72e+162) {
tmp = 4.0 * ((x - z) / y);
} else {
tmp = 2.0;
}
return tmp;
}
def code(x, y, z): tmp = 0 if y <= -1.32e+85: tmp = 2.0 elif y <= 1.72e+162: tmp = 4.0 * ((x - z) / y) else: tmp = 2.0 return tmp
function code(x, y, z) tmp = 0.0 if (y <= -1.32e+85) tmp = 2.0; elseif (y <= 1.72e+162) tmp = Float64(4.0 * Float64(Float64(x - z) / y)); else tmp = 2.0; end return tmp end
function tmp_2 = code(x, y, z) tmp = 0.0; if (y <= -1.32e+85) tmp = 2.0; elseif (y <= 1.72e+162) tmp = 4.0 * ((x - z) / y); else tmp = 2.0; end tmp_2 = tmp; end
code[x_, y_, z_] := If[LessEqual[y, -1.32e+85], 2.0, If[LessEqual[y, 1.72e+162], N[(4.0 * N[(N[(x - z), $MachinePrecision] / y), $MachinePrecision]), $MachinePrecision], 2.0]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;y \leq -1.32 \cdot 10^{+85}:\\
\;\;\;\;2\\
\mathbf{elif}\;y \leq 1.72 \cdot 10^{+162}:\\
\;\;\;\;4 \cdot \frac{x - z}{y}\\
\mathbf{else}:\\
\;\;\;\;2\\
\end{array}
\end{array}
if y < -1.32000000000000007e85 or 1.72e162 < y Initial program 100.0%
Taylor expanded in y around inf 72.8%
if -1.32000000000000007e85 < y < 1.72e162Initial program 100.0%
Taylor expanded in y around 0 84.3%
(FPCore (x y z) :precision binary64 (if (or (<= x -1.14e+36) (not (<= x 1.85e+120))) (* x (/ 4.0 y)) 2.0))
double code(double x, double y, double z) {
double tmp;
if ((x <= -1.14e+36) || !(x <= 1.85e+120)) {
tmp = x * (4.0 / y);
} else {
tmp = 2.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 <= (-1.14d+36)) .or. (.not. (x <= 1.85d+120))) then
tmp = x * (4.0d0 / y)
else
tmp = 2.0d0
end if
code = tmp
end function
public static double code(double x, double y, double z) {
double tmp;
if ((x <= -1.14e+36) || !(x <= 1.85e+120)) {
tmp = x * (4.0 / y);
} else {
tmp = 2.0;
}
return tmp;
}
def code(x, y, z): tmp = 0 if (x <= -1.14e+36) or not (x <= 1.85e+120): tmp = x * (4.0 / y) else: tmp = 2.0 return tmp
function code(x, y, z) tmp = 0.0 if ((x <= -1.14e+36) || !(x <= 1.85e+120)) tmp = Float64(x * Float64(4.0 / y)); else tmp = 2.0; end return tmp end
function tmp_2 = code(x, y, z) tmp = 0.0; if ((x <= -1.14e+36) || ~((x <= 1.85e+120))) tmp = x * (4.0 / y); else tmp = 2.0; end tmp_2 = tmp; end
code[x_, y_, z_] := If[Or[LessEqual[x, -1.14e+36], N[Not[LessEqual[x, 1.85e+120]], $MachinePrecision]], N[(x * N[(4.0 / y), $MachinePrecision]), $MachinePrecision], 2.0]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x \leq -1.14 \cdot 10^{+36} \lor \neg \left(x \leq 1.85 \cdot 10^{+120}\right):\\
\;\;\;\;x \cdot \frac{4}{y}\\
\mathbf{else}:\\
\;\;\;\;2\\
\end{array}
\end{array}
if x < -1.13999999999999999e36 or 1.85000000000000012e120 < x Initial program 99.9%
Taylor expanded in x around inf 71.6%
associate-*r/71.6%
associate-*l/71.3%
*-commutative71.3%
Simplified71.3%
if -1.13999999999999999e36 < x < 1.85000000000000012e120Initial program 100.0%
Taylor expanded in y around inf 49.3%
Final simplification57.2%
(FPCore (x y z) :precision binary64 (+ (/ 1.0 (/ y (* 4.0 (- x z)))) 2.0))
double code(double x, double y, double z) {
return (1.0 / (y / (4.0 * (x - z)))) + 2.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 / (y / (4.0d0 * (x - z)))) + 2.0d0
end function
public static double code(double x, double y, double z) {
return (1.0 / (y / (4.0 * (x - z)))) + 2.0;
}
def code(x, y, z): return (1.0 / (y / (4.0 * (x - z)))) + 2.0
function code(x, y, z) return Float64(Float64(1.0 / Float64(y / Float64(4.0 * Float64(x - z)))) + 2.0) end
function tmp = code(x, y, z) tmp = (1.0 / (y / (4.0 * (x - z)))) + 2.0; end
code[x_, y_, z_] := N[(N[(1.0 / N[(y / N[(4.0 * N[(x - z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + 2.0), $MachinePrecision]
\begin{array}{l}
\\
\frac{1}{\frac{y}{4 \cdot \left(x - z\right)}} + 2
\end{array}
Initial program 100.0%
+-commutative100.0%
associate-*l/99.7%
+-commutative99.7%
associate--l+99.7%
+-commutative99.7%
distribute-lft-in99.7%
associate-+l+99.7%
associate-*l/99.7%
*-commutative99.7%
associate-*l*99.7%
metadata-eval99.7%
*-rgt-identity99.7%
*-inverses99.7%
metadata-eval99.7%
Simplified99.7%
associate-*l/100.0%
clear-num99.8%
Applied egg-rr99.8%
(FPCore (x y z) :precision binary64 (+ 2.0 (/ 1.0 (* y (/ 0.25 (- x z))))))
double code(double x, double y, double z) {
return 2.0 + (1.0 / (y * (0.25 / (x - z))));
}
real(8) function code(x, y, z)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
code = 2.0d0 + (1.0d0 / (y * (0.25d0 / (x - z))))
end function
public static double code(double x, double y, double z) {
return 2.0 + (1.0 / (y * (0.25 / (x - z))));
}
def code(x, y, z): return 2.0 + (1.0 / (y * (0.25 / (x - z))))
function code(x, y, z) return Float64(2.0 + Float64(1.0 / Float64(y * Float64(0.25 / Float64(x - z))))) end
function tmp = code(x, y, z) tmp = 2.0 + (1.0 / (y * (0.25 / (x - z)))); end
code[x_, y_, z_] := N[(2.0 + N[(1.0 / N[(y * N[(0.25 / N[(x - z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
2 + \frac{1}{y \cdot \frac{0.25}{x - z}}
\end{array}
Initial program 100.0%
+-commutative100.0%
associate-*l/99.7%
+-commutative99.7%
associate--l+99.7%
+-commutative99.7%
distribute-lft-in99.7%
associate-+l+99.7%
associate-*l/99.7%
*-commutative99.7%
associate-*l*99.7%
metadata-eval99.7%
*-rgt-identity99.7%
*-inverses99.7%
metadata-eval99.7%
Simplified99.7%
associate-*l/100.0%
clear-num99.8%
Applied egg-rr99.8%
clear-num99.9%
associate-/r/99.7%
associate-/r*99.7%
metadata-eval99.7%
Applied egg-rr99.7%
Final simplification99.7%
(FPCore (x y z) :precision binary64 (+ 2.0 (* (- x z) (/ 4.0 y))))
double code(double x, double y, double z) {
return 2.0 + ((x - z) * (4.0 / y));
}
real(8) function code(x, y, z)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
code = 2.0d0 + ((x - z) * (4.0d0 / y))
end function
public static double code(double x, double y, double z) {
return 2.0 + ((x - z) * (4.0 / y));
}
def code(x, y, z): return 2.0 + ((x - z) * (4.0 / y))
function code(x, y, z) return Float64(2.0 + Float64(Float64(x - z) * Float64(4.0 / y))) end
function tmp = code(x, y, z) tmp = 2.0 + ((x - z) * (4.0 / y)); end
code[x_, y_, z_] := N[(2.0 + N[(N[(x - z), $MachinePrecision] * N[(4.0 / y), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
2 + \left(x - z\right) \cdot \frac{4}{y}
\end{array}
Initial program 100.0%
+-commutative100.0%
associate-*l/99.7%
+-commutative99.7%
associate--l+99.7%
+-commutative99.7%
distribute-lft-in99.7%
associate-+l+99.7%
associate-*l/99.7%
*-commutative99.7%
associate-*l*99.7%
metadata-eval99.7%
*-rgt-identity99.7%
*-inverses99.7%
metadata-eval99.7%
Simplified99.7%
Final simplification99.7%
(FPCore (x y z) :precision binary64 2.0)
double code(double x, double y, double z) {
return 2.0;
}
real(8) function code(x, y, z)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
code = 2.0d0
end function
public static double code(double x, double y, double z) {
return 2.0;
}
def code(x, y, z): return 2.0
function code(x, y, z) return 2.0 end
function tmp = code(x, y, z) tmp = 2.0; end
code[x_, y_, z_] := 2.0
\begin{array}{l}
\\
2
\end{array}
Initial program 100.0%
Taylor expanded in y around inf 36.2%
herbie shell --seed 2024144
(FPCore (x y z)
:name "Data.Array.Repa.Algorithms.ColorRamp:rampColorHotToCold from repa-algorithms-3.4.0.1, C"
:precision binary64
(+ 1.0 (/ (* 4.0 (- (+ x (* y 0.25)) z)) y)))