
(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 11 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 (+ 1.0 (+ (/ (* 4.0 (- x z)) y) 3.0)))
double code(double x, double y, double z) {
return 1.0 + (((4.0 * (x - z)) / y) + 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 = 1.0d0 + (((4.0d0 * (x - z)) / y) + 3.0d0)
end function
public static double code(double x, double y, double z) {
return 1.0 + (((4.0 * (x - z)) / y) + 3.0);
}
def code(x, y, z): return 1.0 + (((4.0 * (x - z)) / y) + 3.0)
function code(x, y, z) return Float64(1.0 + Float64(Float64(Float64(4.0 * Float64(x - z)) / y) + 3.0)) end
function tmp = code(x, y, z) tmp = 1.0 + (((4.0 * (x - z)) / y) + 3.0); end
code[x_, y_, z_] := N[(1.0 + N[(N[(N[(4.0 * N[(x - z), $MachinePrecision]), $MachinePrecision] / y), $MachinePrecision] + 3.0), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
1 + \left(\frac{4 \cdot \left(x - z\right)}{y} + 3\right)
\end{array}
Initial program 99.9%
Taylor expanded in y around inf 100.0%
+-commutative100.0%
associate-*r/100.0%
Simplified100.0%
(FPCore (x y z) :precision binary64 (if (or (<= y -9.8e+61) (not (<= y 1.4e+71))) (+ 1.0 (+ 3.0 (* -4.0 (/ z y)))) (+ 1.0 (/ (* 4.0 (- x z)) y))))
double code(double x, double y, double z) {
double tmp;
if ((y <= -9.8e+61) || !(y <= 1.4e+71)) {
tmp = 1.0 + (3.0 + (-4.0 * (z / y)));
} else {
tmp = 1.0 + ((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 <= (-9.8d+61)) .or. (.not. (y <= 1.4d+71))) then
tmp = 1.0d0 + (3.0d0 + ((-4.0d0) * (z / y)))
else
tmp = 1.0d0 + ((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 <= -9.8e+61) || !(y <= 1.4e+71)) {
tmp = 1.0 + (3.0 + (-4.0 * (z / y)));
} else {
tmp = 1.0 + ((4.0 * (x - z)) / y);
}
return tmp;
}
def code(x, y, z): tmp = 0 if (y <= -9.8e+61) or not (y <= 1.4e+71): tmp = 1.0 + (3.0 + (-4.0 * (z / y))) else: tmp = 1.0 + ((4.0 * (x - z)) / y) return tmp
function code(x, y, z) tmp = 0.0 if ((y <= -9.8e+61) || !(y <= 1.4e+71)) tmp = Float64(1.0 + Float64(3.0 + Float64(-4.0 * Float64(z / y)))); else tmp = Float64(1.0 + Float64(Float64(4.0 * Float64(x - z)) / y)); end return tmp end
function tmp_2 = code(x, y, z) tmp = 0.0; if ((y <= -9.8e+61) || ~((y <= 1.4e+71))) tmp = 1.0 + (3.0 + (-4.0 * (z / y))); else tmp = 1.0 + ((4.0 * (x - z)) / y); end tmp_2 = tmp; end
code[x_, y_, z_] := If[Or[LessEqual[y, -9.8e+61], N[Not[LessEqual[y, 1.4e+71]], $MachinePrecision]], N[(1.0 + N[(3.0 + N[(-4.0 * N[(z / y), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(1.0 + N[(N[(4.0 * N[(x - z), $MachinePrecision]), $MachinePrecision] / y), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;y \leq -9.8 \cdot 10^{+61} \lor \neg \left(y \leq 1.4 \cdot 10^{+71}\right):\\
\;\;\;\;1 + \left(3 + -4 \cdot \frac{z}{y}\right)\\
\mathbf{else}:\\
\;\;\;\;1 + \frac{4 \cdot \left(x - z\right)}{y}\\
\end{array}
\end{array}
if y < -9.8000000000000005e61 or 1.40000000000000001e71 < y Initial program 99.9%
Taylor expanded in y around inf 100.0%
+-commutative100.0%
associate-*r/100.0%
Simplified100.0%
Taylor expanded in x around 0 89.9%
if -9.8000000000000005e61 < y < 1.40000000000000001e71Initial program 100.0%
Taylor expanded in x around inf 91.4%
Final simplification90.7%
(FPCore (x y z) :precision binary64 (if (or (<= x -4.6e+46) (not (<= x 1.35e-104))) (* (+ x y) (/ 4.0 y)) (+ 1.0 (+ 3.0 (* -4.0 (/ z y))))))
double code(double x, double y, double z) {
double tmp;
if ((x <= -4.6e+46) || !(x <= 1.35e-104)) {
tmp = (x + y) * (4.0 / y);
} else {
tmp = 1.0 + (3.0 + (-4.0 * (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 ((x <= (-4.6d+46)) .or. (.not. (x <= 1.35d-104))) then
tmp = (x + y) * (4.0d0 / y)
else
tmp = 1.0d0 + (3.0d0 + ((-4.0d0) * (z / y)))
end if
code = tmp
end function
public static double code(double x, double y, double z) {
double tmp;
if ((x <= -4.6e+46) || !(x <= 1.35e-104)) {
tmp = (x + y) * (4.0 / y);
} else {
tmp = 1.0 + (3.0 + (-4.0 * (z / y)));
}
return tmp;
}
def code(x, y, z): tmp = 0 if (x <= -4.6e+46) or not (x <= 1.35e-104): tmp = (x + y) * (4.0 / y) else: tmp = 1.0 + (3.0 + (-4.0 * (z / y))) return tmp
function code(x, y, z) tmp = 0.0 if ((x <= -4.6e+46) || !(x <= 1.35e-104)) tmp = Float64(Float64(x + y) * Float64(4.0 / y)); else tmp = Float64(1.0 + Float64(3.0 + Float64(-4.0 * Float64(z / y)))); end return tmp end
function tmp_2 = code(x, y, z) tmp = 0.0; if ((x <= -4.6e+46) || ~((x <= 1.35e-104))) tmp = (x + y) * (4.0 / y); else tmp = 1.0 + (3.0 + (-4.0 * (z / y))); end tmp_2 = tmp; end
code[x_, y_, z_] := If[Or[LessEqual[x, -4.6e+46], N[Not[LessEqual[x, 1.35e-104]], $MachinePrecision]], N[(N[(x + y), $MachinePrecision] * N[(4.0 / y), $MachinePrecision]), $MachinePrecision], N[(1.0 + N[(3.0 + N[(-4.0 * N[(z / y), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x \leq -4.6 \cdot 10^{+46} \lor \neg \left(x \leq 1.35 \cdot 10^{-104}\right):\\
\;\;\;\;\left(x + y\right) \cdot \frac{4}{y}\\
\mathbf{else}:\\
\;\;\;\;1 + \left(3 + -4 \cdot \frac{z}{y}\right)\\
\end{array}
\end{array}
if x < -4.6000000000000001e46 or 1.3499999999999999e-104 < x Initial program 100.0%
Taylor expanded in y around inf 100.0%
+-commutative100.0%
associate-*r/100.0%
Simplified100.0%
Taylor expanded in x around inf 83.9%
*-commutative83.9%
associate-*l/83.9%
associate-*r/83.8%
Simplified83.8%
Taylor expanded in y around 0 83.9%
distribute-lft-out83.9%
*-commutative83.9%
associate-/l*83.8%
Simplified83.8%
if -4.6000000000000001e46 < x < 1.3499999999999999e-104Initial program 99.9%
Taylor expanded in y around inf 100.0%
+-commutative100.0%
associate-*r/100.0%
Simplified100.0%
Taylor expanded in x around 0 94.6%
Final simplification89.0%
(FPCore (x y z) :precision binary64 (if (or (<= x -2e+47) (not (<= x 1.35e-104))) (* (+ x y) (/ 4.0 y)) (+ 1.0 (+ 3.0 (* z (/ -4.0 y))))))
double code(double x, double y, double z) {
double tmp;
if ((x <= -2e+47) || !(x <= 1.35e-104)) {
tmp = (x + y) * (4.0 / y);
} else {
tmp = 1.0 + (3.0 + (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 ((x <= (-2d+47)) .or. (.not. (x <= 1.35d-104))) then
tmp = (x + y) * (4.0d0 / y)
else
tmp = 1.0d0 + (3.0d0 + (z * ((-4.0d0) / y)))
end if
code = tmp
end function
public static double code(double x, double y, double z) {
double tmp;
if ((x <= -2e+47) || !(x <= 1.35e-104)) {
tmp = (x + y) * (4.0 / y);
} else {
tmp = 1.0 + (3.0 + (z * (-4.0 / y)));
}
return tmp;
}
def code(x, y, z): tmp = 0 if (x <= -2e+47) or not (x <= 1.35e-104): tmp = (x + y) * (4.0 / y) else: tmp = 1.0 + (3.0 + (z * (-4.0 / y))) return tmp
function code(x, y, z) tmp = 0.0 if ((x <= -2e+47) || !(x <= 1.35e-104)) tmp = Float64(Float64(x + y) * Float64(4.0 / y)); else tmp = Float64(1.0 + Float64(3.0 + Float64(z * Float64(-4.0 / y)))); end return tmp end
function tmp_2 = code(x, y, z) tmp = 0.0; if ((x <= -2e+47) || ~((x <= 1.35e-104))) tmp = (x + y) * (4.0 / y); else tmp = 1.0 + (3.0 + (z * (-4.0 / y))); end tmp_2 = tmp; end
code[x_, y_, z_] := If[Or[LessEqual[x, -2e+47], N[Not[LessEqual[x, 1.35e-104]], $MachinePrecision]], N[(N[(x + y), $MachinePrecision] * N[(4.0 / y), $MachinePrecision]), $MachinePrecision], N[(1.0 + N[(3.0 + N[(z * N[(-4.0 / y), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x \leq -2 \cdot 10^{+47} \lor \neg \left(x \leq 1.35 \cdot 10^{-104}\right):\\
\;\;\;\;\left(x + y\right) \cdot \frac{4}{y}\\
\mathbf{else}:\\
\;\;\;\;1 + \left(3 + z \cdot \frac{-4}{y}\right)\\
\end{array}
\end{array}
if x < -2.0000000000000001e47 or 1.3499999999999999e-104 < x Initial program 100.0%
Taylor expanded in y around inf 100.0%
+-commutative100.0%
associate-*r/100.0%
Simplified100.0%
Taylor expanded in x around inf 83.9%
*-commutative83.9%
associate-*l/83.9%
associate-*r/83.8%
Simplified83.8%
Taylor expanded in y around 0 83.9%
distribute-lft-out83.9%
*-commutative83.9%
associate-/l*83.8%
Simplified83.8%
if -2.0000000000000001e47 < x < 1.3499999999999999e-104Initial program 99.9%
Taylor expanded in x around 0 94.5%
div-sub94.5%
associate-/l*94.6%
*-inverses94.6%
metadata-eval94.6%
sub-neg94.6%
distribute-lft-in94.6%
metadata-eval94.6%
distribute-rgt-neg-in94.6%
*-lft-identity94.6%
associate-*l/94.4%
associate-*l*94.4%
*-commutative94.4%
distribute-rgt-neg-in94.4%
associate-*r/94.4%
metadata-eval94.4%
distribute-neg-frac94.4%
metadata-eval94.4%
Simplified94.4%
Final simplification88.9%
(FPCore (x y z)
:precision binary64
(if (<= x -2.5e+46)
(* (+ x y) (/ 4.0 y))
(if (<= x 1.75e-106)
(+ 1.0 (+ 3.0 (* -4.0 (/ z y))))
(+ 1.0 (+ 3.0 (* x (/ 4.0 y)))))))
double code(double x, double y, double z) {
double tmp;
if (x <= -2.5e+46) {
tmp = (x + y) * (4.0 / y);
} else if (x <= 1.75e-106) {
tmp = 1.0 + (3.0 + (-4.0 * (z / y)));
} else {
tmp = 1.0 + (3.0 + (x * (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 (x <= (-2.5d+46)) then
tmp = (x + y) * (4.0d0 / y)
else if (x <= 1.75d-106) then
tmp = 1.0d0 + (3.0d0 + ((-4.0d0) * (z / y)))
else
tmp = 1.0d0 + (3.0d0 + (x * (4.0d0 / y)))
end if
code = tmp
end function
public static double code(double x, double y, double z) {
double tmp;
if (x <= -2.5e+46) {
tmp = (x + y) * (4.0 / y);
} else if (x <= 1.75e-106) {
tmp = 1.0 + (3.0 + (-4.0 * (z / y)));
} else {
tmp = 1.0 + (3.0 + (x * (4.0 / y)));
}
return tmp;
}
def code(x, y, z): tmp = 0 if x <= -2.5e+46: tmp = (x + y) * (4.0 / y) elif x <= 1.75e-106: tmp = 1.0 + (3.0 + (-4.0 * (z / y))) else: tmp = 1.0 + (3.0 + (x * (4.0 / y))) return tmp
function code(x, y, z) tmp = 0.0 if (x <= -2.5e+46) tmp = Float64(Float64(x + y) * Float64(4.0 / y)); elseif (x <= 1.75e-106) tmp = Float64(1.0 + Float64(3.0 + Float64(-4.0 * Float64(z / y)))); else tmp = Float64(1.0 + Float64(3.0 + Float64(x * Float64(4.0 / y)))); end return tmp end
function tmp_2 = code(x, y, z) tmp = 0.0; if (x <= -2.5e+46) tmp = (x + y) * (4.0 / y); elseif (x <= 1.75e-106) tmp = 1.0 + (3.0 + (-4.0 * (z / y))); else tmp = 1.0 + (3.0 + (x * (4.0 / y))); end tmp_2 = tmp; end
code[x_, y_, z_] := If[LessEqual[x, -2.5e+46], N[(N[(x + y), $MachinePrecision] * N[(4.0 / y), $MachinePrecision]), $MachinePrecision], If[LessEqual[x, 1.75e-106], N[(1.0 + N[(3.0 + N[(-4.0 * N[(z / y), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(1.0 + N[(3.0 + N[(x * N[(4.0 / y), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x \leq -2.5 \cdot 10^{+46}:\\
\;\;\;\;\left(x + y\right) \cdot \frac{4}{y}\\
\mathbf{elif}\;x \leq 1.75 \cdot 10^{-106}:\\
\;\;\;\;1 + \left(3 + -4 \cdot \frac{z}{y}\right)\\
\mathbf{else}:\\
\;\;\;\;1 + \left(3 + x \cdot \frac{4}{y}\right)\\
\end{array}
\end{array}
if x < -2.5000000000000001e46Initial program 100.0%
Taylor expanded in y around inf 100.0%
+-commutative100.0%
associate-*r/100.0%
Simplified100.0%
Taylor expanded in x around inf 84.2%
*-commutative84.2%
associate-*l/84.2%
associate-*r/84.1%
Simplified84.1%
Taylor expanded in y around 0 84.2%
distribute-lft-out84.2%
*-commutative84.2%
associate-/l*84.1%
Simplified84.1%
if -2.5000000000000001e46 < x < 1.75e-106Initial program 99.9%
Taylor expanded in y around inf 100.0%
+-commutative100.0%
associate-*r/100.0%
Simplified100.0%
Taylor expanded in x around 0 94.5%
if 1.75e-106 < x Initial program 100.0%
Taylor expanded in y around inf 100.0%
+-commutative100.0%
associate-*r/100.0%
Simplified100.0%
Taylor expanded in x around inf 84.1%
*-commutative84.1%
associate-*l/84.1%
associate-*r/84.0%
Simplified84.0%
Final simplification89.0%
(FPCore (x y z) :precision binary64 (if (or (<= z -1.75e+244) (not (<= z 6.6e+209))) (+ 1.0 (/ (* z -4.0) y)) (* (+ x y) (/ 4.0 y))))
double code(double x, double y, double z) {
double tmp;
if ((z <= -1.75e+244) || !(z <= 6.6e+209)) {
tmp = 1.0 + ((z * -4.0) / y);
} else {
tmp = (x + y) * (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 ((z <= (-1.75d+244)) .or. (.not. (z <= 6.6d+209))) then
tmp = 1.0d0 + ((z * (-4.0d0)) / y)
else
tmp = (x + y) * (4.0d0 / y)
end if
code = tmp
end function
public static double code(double x, double y, double z) {
double tmp;
if ((z <= -1.75e+244) || !(z <= 6.6e+209)) {
tmp = 1.0 + ((z * -4.0) / y);
} else {
tmp = (x + y) * (4.0 / y);
}
return tmp;
}
def code(x, y, z): tmp = 0 if (z <= -1.75e+244) or not (z <= 6.6e+209): tmp = 1.0 + ((z * -4.0) / y) else: tmp = (x + y) * (4.0 / y) return tmp
function code(x, y, z) tmp = 0.0 if ((z <= -1.75e+244) || !(z <= 6.6e+209)) tmp = Float64(1.0 + Float64(Float64(z * -4.0) / y)); else tmp = Float64(Float64(x + y) * Float64(4.0 / y)); end return tmp end
function tmp_2 = code(x, y, z) tmp = 0.0; if ((z <= -1.75e+244) || ~((z <= 6.6e+209))) tmp = 1.0 + ((z * -4.0) / y); else tmp = (x + y) * (4.0 / y); end tmp_2 = tmp; end
code[x_, y_, z_] := If[Or[LessEqual[z, -1.75e+244], N[Not[LessEqual[z, 6.6e+209]], $MachinePrecision]], N[(1.0 + N[(N[(z * -4.0), $MachinePrecision] / y), $MachinePrecision]), $MachinePrecision], N[(N[(x + y), $MachinePrecision] * N[(4.0 / y), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \leq -1.75 \cdot 10^{+244} \lor \neg \left(z \leq 6.6 \cdot 10^{+209}\right):\\
\;\;\;\;1 + \frac{z \cdot -4}{y}\\
\mathbf{else}:\\
\;\;\;\;\left(x + y\right) \cdot \frac{4}{y}\\
\end{array}
\end{array}
if z < -1.74999999999999987e244 or 6.59999999999999961e209 < z Initial program 100.0%
Taylor expanded in z around inf 85.3%
*-commutative85.3%
associate-*l/85.3%
Simplified85.3%
if -1.74999999999999987e244 < z < 6.59999999999999961e209Initial program 99.9%
Taylor expanded in y around inf 100.0%
+-commutative100.0%
associate-*r/100.0%
Simplified100.0%
Taylor expanded in x around inf 77.4%
*-commutative77.4%
associate-*l/77.4%
associate-*r/76.9%
Simplified76.9%
Taylor expanded in y around 0 76.9%
distribute-lft-out76.9%
*-commutative76.9%
associate-/l*76.8%
Simplified76.8%
Final simplification78.1%
(FPCore (x y z) :precision binary64 (if (or (<= z -1.75e+244) (not (<= z 6.1e+209))) (+ 1.0 (* z (/ -4.0 y))) (* (+ x y) (/ 4.0 y))))
double code(double x, double y, double z) {
double tmp;
if ((z <= -1.75e+244) || !(z <= 6.1e+209)) {
tmp = 1.0 + (z * (-4.0 / y));
} else {
tmp = (x + y) * (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 ((z <= (-1.75d+244)) .or. (.not. (z <= 6.1d+209))) then
tmp = 1.0d0 + (z * ((-4.0d0) / y))
else
tmp = (x + y) * (4.0d0 / y)
end if
code = tmp
end function
public static double code(double x, double y, double z) {
double tmp;
if ((z <= -1.75e+244) || !(z <= 6.1e+209)) {
tmp = 1.0 + (z * (-4.0 / y));
} else {
tmp = (x + y) * (4.0 / y);
}
return tmp;
}
def code(x, y, z): tmp = 0 if (z <= -1.75e+244) or not (z <= 6.1e+209): tmp = 1.0 + (z * (-4.0 / y)) else: tmp = (x + y) * (4.0 / y) return tmp
function code(x, y, z) tmp = 0.0 if ((z <= -1.75e+244) || !(z <= 6.1e+209)) tmp = Float64(1.0 + Float64(z * Float64(-4.0 / y))); else tmp = Float64(Float64(x + y) * Float64(4.0 / y)); end return tmp end
function tmp_2 = code(x, y, z) tmp = 0.0; if ((z <= -1.75e+244) || ~((z <= 6.1e+209))) tmp = 1.0 + (z * (-4.0 / y)); else tmp = (x + y) * (4.0 / y); end tmp_2 = tmp; end
code[x_, y_, z_] := If[Or[LessEqual[z, -1.75e+244], N[Not[LessEqual[z, 6.1e+209]], $MachinePrecision]], N[(1.0 + N[(z * N[(-4.0 / y), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(x + y), $MachinePrecision] * N[(4.0 / y), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \leq -1.75 \cdot 10^{+244} \lor \neg \left(z \leq 6.1 \cdot 10^{+209}\right):\\
\;\;\;\;1 + z \cdot \frac{-4}{y}\\
\mathbf{else}:\\
\;\;\;\;\left(x + y\right) \cdot \frac{4}{y}\\
\end{array}
\end{array}
if z < -1.74999999999999987e244 or 6.1000000000000003e209 < z Initial program 100.0%
Taylor expanded in z around inf 85.3%
metadata-eval85.3%
distribute-lft-neg-in85.3%
*-lft-identity85.3%
associate-*l/85.1%
associate-*l*85.1%
*-commutative85.1%
distribute-rgt-neg-in85.1%
associate-*r/85.1%
metadata-eval85.1%
distribute-neg-frac85.1%
metadata-eval85.1%
Simplified85.1%
if -1.74999999999999987e244 < z < 6.1000000000000003e209Initial program 99.9%
Taylor expanded in y around inf 100.0%
+-commutative100.0%
associate-*r/100.0%
Simplified100.0%
Taylor expanded in x around inf 77.4%
*-commutative77.4%
associate-*l/77.4%
associate-*r/76.9%
Simplified76.9%
Taylor expanded in y around 0 76.9%
distribute-lft-out76.9%
*-commutative76.9%
associate-/l*76.8%
Simplified76.8%
Final simplification78.1%
(FPCore (x y z) :precision binary64 (if (<= y -4.75e+58) 4.0 (if (<= y 2.4e+91) (* 4.0 (/ x y)) 4.0)))
double code(double x, double y, double z) {
double tmp;
if (y <= -4.75e+58) {
tmp = 4.0;
} else if (y <= 2.4e+91) {
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 <= (-4.75d+58)) then
tmp = 4.0d0
else if (y <= 2.4d+91) 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 <= -4.75e+58) {
tmp = 4.0;
} else if (y <= 2.4e+91) {
tmp = 4.0 * (x / y);
} else {
tmp = 4.0;
}
return tmp;
}
def code(x, y, z): tmp = 0 if y <= -4.75e+58: tmp = 4.0 elif y <= 2.4e+91: tmp = 4.0 * (x / y) else: tmp = 4.0 return tmp
function code(x, y, z) tmp = 0.0 if (y <= -4.75e+58) tmp = 4.0; elseif (y <= 2.4e+91) 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 <= -4.75e+58) tmp = 4.0; elseif (y <= 2.4e+91) tmp = 4.0 * (x / y); else tmp = 4.0; end tmp_2 = tmp; end
code[x_, y_, z_] := If[LessEqual[y, -4.75e+58], 4.0, If[LessEqual[y, 2.4e+91], N[(4.0 * N[(x / y), $MachinePrecision]), $MachinePrecision], 4.0]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;y \leq -4.75 \cdot 10^{+58}:\\
\;\;\;\;4\\
\mathbf{elif}\;y \leq 2.4 \cdot 10^{+91}:\\
\;\;\;\;4 \cdot \frac{x}{y}\\
\mathbf{else}:\\
\;\;\;\;4\\
\end{array}
\end{array}
if y < -4.7500000000000001e58 or 2.39999999999999983e91 < y Initial program 99.9%
Taylor expanded in y around inf 100.0%
+-commutative100.0%
associate-*r/100.0%
Simplified100.0%
Taylor expanded in x around inf 83.5%
*-commutative83.5%
associate-*l/83.5%
associate-*r/83.4%
Simplified83.4%
Taylor expanded in x around 0 74.6%
if -4.7500000000000001e58 < y < 2.39999999999999983e91Initial program 100.0%
Taylor expanded in y around inf 100.0%
+-commutative100.0%
associate-*r/100.0%
Simplified100.0%
Taylor expanded in x around inf 58.5%
*-commutative58.5%
associate-*l/58.5%
associate-*r/57.8%
Simplified57.8%
Taylor expanded in x around inf 49.0%
(FPCore (x y z) :precision binary64 (* (+ x y) (/ 4.0 y)))
double code(double x, double y, double z) {
return (x + y) * (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 = (x + y) * (4.0d0 / y)
end function
public static double code(double x, double y, double z) {
return (x + y) * (4.0 / y);
}
def code(x, y, z): return (x + y) * (4.0 / y)
function code(x, y, z) return Float64(Float64(x + y) * Float64(4.0 / y)) end
function tmp = code(x, y, z) tmp = (x + y) * (4.0 / y); end
code[x_, y_, z_] := N[(N[(x + y), $MachinePrecision] * N[(4.0 / y), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
\left(x + y\right) \cdot \frac{4}{y}
\end{array}
Initial program 99.9%
Taylor expanded in y around inf 100.0%
+-commutative100.0%
associate-*r/100.0%
Simplified100.0%
Taylor expanded in x around inf 68.5%
*-commutative68.5%
associate-*l/68.5%
associate-*r/68.0%
Simplified68.0%
Taylor expanded in y around 0 68.1%
distribute-lft-out68.1%
*-commutative68.1%
associate-/l*67.9%
Simplified67.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 100.0%
+-commutative100.0%
associate-*r/100.0%
Simplified100.0%
Taylor expanded in x around inf 68.5%
*-commutative68.5%
associate-*l/68.5%
associate-*r/68.0%
Simplified68.0%
Taylor expanded in x around 0 36.8%
(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.7%
metadata-eval38.7%
distribute-lft-neg-in38.7%
*-lft-identity38.7%
associate-*l/38.6%
associate-*l*38.6%
*-commutative38.6%
distribute-rgt-neg-in38.6%
associate-*r/38.6%
metadata-eval38.6%
distribute-neg-frac38.6%
metadata-eval38.6%
Simplified38.6%
Taylor expanded in z around 0 8.1%
herbie shell --seed 2024106
(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)))