
(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 10 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 (+ 0.75 (/ (- x z) y)))))
double code(double x, double y, double z) {
return 1.0 + (4.0 * (0.75 + ((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 = 1.0d0 + (4.0d0 * (0.75d0 + ((x - z) / y)))
end function
public static double code(double x, double y, double z) {
return 1.0 + (4.0 * (0.75 + ((x - z) / y)));
}
def code(x, y, z): return 1.0 + (4.0 * (0.75 + ((x - z) / y)))
function code(x, y, z) return Float64(1.0 + Float64(4.0 * Float64(0.75 + Float64(Float64(x - z) / y)))) end
function tmp = code(x, y, z) tmp = 1.0 + (4.0 * (0.75 + ((x - z) / y))); end
code[x_, y_, z_] := N[(1.0 + N[(4.0 * N[(0.75 + N[(N[(x - z), $MachinePrecision] / y), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
1 + 4 \cdot \left(0.75 + \frac{x - z}{y}\right)
\end{array}
Initial program 99.2%
associate-/l*99.9%
associate--l+99.9%
Simplified99.9%
Taylor expanded in x around 0 97.7%
+-commutative97.7%
associate--l+97.7%
+-commutative97.7%
associate-+l-97.7%
div-sub100.0%
Simplified100.0%
Final simplification100.0%
(FPCore (x y z)
:precision binary64
(if (or (<= x -250.0)
(not (or (<= x 1.36e-31) (and (not (<= x 4.8e+30)) (<= x 2.8e+63)))))
(+ 4.0 (* 4.0 (/ x y)))
(+ 4.0 (* (/ z y) -4.0))))
double code(double x, double y, double z) {
double tmp;
if ((x <= -250.0) || !((x <= 1.36e-31) || (!(x <= 4.8e+30) && (x <= 2.8e+63)))) {
tmp = 4.0 + (4.0 * (x / 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 <= (-250.0d0)) .or. (.not. (x <= 1.36d-31) .or. (.not. (x <= 4.8d+30)) .and. (x <= 2.8d+63))) then
tmp = 4.0d0 + (4.0d0 * (x / 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 <= -250.0) || !((x <= 1.36e-31) || (!(x <= 4.8e+30) && (x <= 2.8e+63)))) {
tmp = 4.0 + (4.0 * (x / y));
} else {
tmp = 4.0 + ((z / y) * -4.0);
}
return tmp;
}
def code(x, y, z): tmp = 0 if (x <= -250.0) or not ((x <= 1.36e-31) or (not (x <= 4.8e+30) and (x <= 2.8e+63))): tmp = 4.0 + (4.0 * (x / y)) else: tmp = 4.0 + ((z / y) * -4.0) return tmp
function code(x, y, z) tmp = 0.0 if ((x <= -250.0) || !((x <= 1.36e-31) || (!(x <= 4.8e+30) && (x <= 2.8e+63)))) tmp = Float64(4.0 + Float64(4.0 * Float64(x / 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 <= -250.0) || ~(((x <= 1.36e-31) || (~((x <= 4.8e+30)) && (x <= 2.8e+63))))) tmp = 4.0 + (4.0 * (x / y)); else tmp = 4.0 + ((z / y) * -4.0); end tmp_2 = tmp; end
code[x_, y_, z_] := If[Or[LessEqual[x, -250.0], N[Not[Or[LessEqual[x, 1.36e-31], And[N[Not[LessEqual[x, 4.8e+30]], $MachinePrecision], LessEqual[x, 2.8e+63]]]], $MachinePrecision]], N[(4.0 + N[(4.0 * N[(x / y), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(4.0 + N[(N[(z / y), $MachinePrecision] * -4.0), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x \leq -250 \lor \neg \left(x \leq 1.36 \cdot 10^{-31} \lor \neg \left(x \leq 4.8 \cdot 10^{+30}\right) \land x \leq 2.8 \cdot 10^{+63}\right):\\
\;\;\;\;4 + 4 \cdot \frac{x}{y}\\
\mathbf{else}:\\
\;\;\;\;4 + \frac{z}{y} \cdot -4\\
\end{array}
\end{array}
if x < -250 or 1.35999999999999991e-31 < x < 4.7999999999999999e30 or 2.79999999999999987e63 < x Initial program 99.1%
associate-/l*99.9%
associate--l+99.9%
Simplified99.9%
Taylor expanded in x around 0 95.0%
+-commutative95.0%
associate--l+95.0%
+-commutative95.0%
associate-+l-95.0%
div-sub100.0%
Simplified100.0%
Taylor expanded in z around 0 91.1%
associate-*r/91.1%
neg-mul-191.1%
Simplified91.1%
Taylor expanded in x around 0 91.1%
if -250 < x < 1.35999999999999991e-31 or 4.7999999999999999e30 < x < 2.79999999999999987e63Initial program 99.2%
associate-/l*99.9%
associate--l+99.9%
Simplified99.9%
Taylor expanded in x around 0 97.0%
div-sub97.0%
associate-/l*97.1%
*-inverses97.1%
metadata-eval97.1%
Simplified97.1%
Taylor expanded in z around 0 97.1%
+-commutative97.1%
*-commutative97.1%
Simplified97.1%
Final simplification94.3%
(FPCore (x y z)
:precision binary64
(let* ((t_0 (* 4.0 (/ x y))))
(if (<= x -7.0)
t_0
(if (<= x -3.6e-226) 4.0 (if (<= x 2.8e+63) (* (/ 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 <= -7.0) {
tmp = t_0;
} else if (x <= -3.6e-226) {
tmp = 4.0;
} else if (x <= 2.8e+63) {
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 <= (-7.0d0)) then
tmp = t_0
else if (x <= (-3.6d-226)) then
tmp = 4.0d0
else if (x <= 2.8d+63) 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 <= -7.0) {
tmp = t_0;
} else if (x <= -3.6e-226) {
tmp = 4.0;
} else if (x <= 2.8e+63) {
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 <= -7.0: tmp = t_0 elif x <= -3.6e-226: tmp = 4.0 elif x <= 2.8e+63: 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 <= -7.0) tmp = t_0; elseif (x <= -3.6e-226) tmp = 4.0; elseif (x <= 2.8e+63) 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 <= -7.0) tmp = t_0; elseif (x <= -3.6e-226) tmp = 4.0; elseif (x <= 2.8e+63) 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, -7.0], t$95$0, If[LessEqual[x, -3.6e-226], 4.0, If[LessEqual[x, 2.8e+63], 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 -7:\\
\;\;\;\;t\_0\\
\mathbf{elif}\;x \leq -3.6 \cdot 10^{-226}:\\
\;\;\;\;4\\
\mathbf{elif}\;x \leq 2.8 \cdot 10^{+63}:\\
\;\;\;\;\frac{z}{y} \cdot -4\\
\mathbf{else}:\\
\;\;\;\;t\_0\\
\end{array}
\end{array}
if x < -7 or 2.79999999999999987e63 < x Initial program 99.0%
associate-/l*99.9%
associate--l+99.9%
Simplified99.9%
Taylor expanded in x around 0 94.3%
+-commutative94.3%
associate--l+94.3%
+-commutative94.3%
associate-+l-94.3%
div-sub100.0%
Simplified100.0%
Taylor expanded in z around 0 91.7%
associate-*r/91.7%
neg-mul-191.7%
Simplified91.7%
Taylor expanded in x around inf 71.3%
if -7 < x < -3.59999999999999994e-226Initial program 99.9%
associate-/l*99.9%
associate--l+99.9%
Simplified99.9%
Taylor expanded in x around 0 94.0%
div-sub94.0%
associate-/l*94.1%
*-inverses94.1%
metadata-eval94.1%
Simplified94.1%
Taylor expanded in z around 0 68.3%
if -3.59999999999999994e-226 < x < 2.79999999999999987e63Initial program 99.1%
associate-/l*99.9%
associate--l+99.9%
Simplified99.9%
Taylor expanded in z around inf 59.7%
neg-mul-159.7%
distribute-neg-frac259.7%
Simplified59.7%
Taylor expanded in z around inf 54.4%
*-commutative54.4%
Simplified54.4%
(FPCore (x y z)
:precision binary64
(let* ((t_0 (* 4.0 (/ x y))))
(if (<= x -250.0)
t_0
(if (<= x -7.2e-227) 4.0 (if (<= x 2.8e+63) (* 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 <= -250.0) {
tmp = t_0;
} else if (x <= -7.2e-227) {
tmp = 4.0;
} else if (x <= 2.8e+63) {
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 <= (-250.0d0)) then
tmp = t_0
else if (x <= (-7.2d-227)) then
tmp = 4.0d0
else if (x <= 2.8d+63) 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 <= -250.0) {
tmp = t_0;
} else if (x <= -7.2e-227) {
tmp = 4.0;
} else if (x <= 2.8e+63) {
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 <= -250.0: tmp = t_0 elif x <= -7.2e-227: tmp = 4.0 elif x <= 2.8e+63: 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 <= -250.0) tmp = t_0; elseif (x <= -7.2e-227) tmp = 4.0; elseif (x <= 2.8e+63) 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 <= -250.0) tmp = t_0; elseif (x <= -7.2e-227) tmp = 4.0; elseif (x <= 2.8e+63) 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, -250.0], t$95$0, If[LessEqual[x, -7.2e-227], 4.0, If[LessEqual[x, 2.8e+63], 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 -250:\\
\;\;\;\;t\_0\\
\mathbf{elif}\;x \leq -7.2 \cdot 10^{-227}:\\
\;\;\;\;4\\
\mathbf{elif}\;x \leq 2.8 \cdot 10^{+63}:\\
\;\;\;\;z \cdot \frac{-4}{y}\\
\mathbf{else}:\\
\;\;\;\;t\_0\\
\end{array}
\end{array}
if x < -250 or 2.79999999999999987e63 < x Initial program 99.0%
associate-/l*99.9%
associate--l+99.9%
Simplified99.9%
Taylor expanded in x around 0 94.3%
+-commutative94.3%
associate--l+94.3%
+-commutative94.3%
associate-+l-94.3%
div-sub100.0%
Simplified100.0%
Taylor expanded in z around 0 91.7%
associate-*r/91.7%
neg-mul-191.7%
Simplified91.7%
Taylor expanded in x around inf 71.3%
if -250 < x < -7.1999999999999999e-227Initial program 99.9%
associate-/l*99.9%
associate--l+99.9%
Simplified99.9%
Taylor expanded in x around 0 94.0%
div-sub94.0%
associate-/l*94.1%
*-inverses94.1%
metadata-eval94.1%
Simplified94.1%
Taylor expanded in z around 0 68.3%
if -7.1999999999999999e-227 < x < 2.79999999999999987e63Initial program 99.1%
associate-/l*99.9%
associate--l+99.9%
Simplified99.9%
Taylor expanded in z around inf 59.7%
neg-mul-159.7%
distribute-neg-frac259.7%
Simplified59.7%
Taylor expanded in z around inf 54.4%
associate-*r/53.5%
*-commutative53.5%
associate-/l*54.3%
Simplified54.3%
(FPCore (x y z) :precision binary64 (if (or (<= y -2.8e+33) (not (<= y 1.7e+38))) (+ 4.0 (* 4.0 (/ x y))) (+ 1.0 (* 4.0 (/ (- x z) y)))))
double code(double x, double y, double z) {
double tmp;
if ((y <= -2.8e+33) || !(y <= 1.7e+38)) {
tmp = 4.0 + (4.0 * (x / 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 <= (-2.8d+33)) .or. (.not. (y <= 1.7d+38))) then
tmp = 4.0d0 + (4.0d0 * (x / 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 <= -2.8e+33) || !(y <= 1.7e+38)) {
tmp = 4.0 + (4.0 * (x / y));
} else {
tmp = 1.0 + (4.0 * ((x - z) / y));
}
return tmp;
}
def code(x, y, z): tmp = 0 if (y <= -2.8e+33) or not (y <= 1.7e+38): tmp = 4.0 + (4.0 * (x / y)) else: tmp = 1.0 + (4.0 * ((x - z) / y)) return tmp
function code(x, y, z) tmp = 0.0 if ((y <= -2.8e+33) || !(y <= 1.7e+38)) tmp = Float64(4.0 + Float64(4.0 * Float64(x / y))); else tmp = Float64(1.0 + Float64(4.0 * Float64(Float64(x - z) / y))); end return tmp end
function tmp_2 = code(x, y, z) tmp = 0.0; if ((y <= -2.8e+33) || ~((y <= 1.7e+38))) tmp = 4.0 + (4.0 * (x / y)); else tmp = 1.0 + (4.0 * ((x - z) / y)); end tmp_2 = tmp; end
code[x_, y_, z_] := If[Or[LessEqual[y, -2.8e+33], N[Not[LessEqual[y, 1.7e+38]], $MachinePrecision]], N[(4.0 + N[(4.0 * N[(x / y), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(1.0 + N[(4.0 * N[(N[(x - z), $MachinePrecision] / y), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;y \leq -2.8 \cdot 10^{+33} \lor \neg \left(y \leq 1.7 \cdot 10^{+38}\right):\\
\;\;\;\;4 + 4 \cdot \frac{x}{y}\\
\mathbf{else}:\\
\;\;\;\;1 + 4 \cdot \frac{x - z}{y}\\
\end{array}
\end{array}
if y < -2.8000000000000001e33 or 1.69999999999999998e38 < y Initial program 98.2%
associate-/l*99.9%
associate--l+99.9%
Simplified99.9%
Taylor expanded in x around 0 100.0%
+-commutative100.0%
associate--l+100.0%
+-commutative100.0%
associate-+l-100.0%
div-sub100.0%
Simplified100.0%
Taylor expanded in z around 0 90.1%
associate-*r/90.1%
neg-mul-190.1%
Simplified90.1%
Taylor expanded in x around 0 90.1%
if -2.8000000000000001e33 < y < 1.69999999999999998e38Initial program 100.0%
associate-/l*100.0%
associate--l+100.0%
Simplified100.0%
Taylor expanded in y around 0 92.3%
Final simplification91.3%
(FPCore (x y z) :precision binary64 (if (or (<= y -1.8e+32) (not (<= y 4.3e+39))) (+ 4.0 (* 4.0 (/ x y))) (* 4.0 (/ (- x z) y))))
double code(double x, double y, double z) {
double tmp;
if ((y <= -1.8e+32) || !(y <= 4.3e+39)) {
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 <= (-1.8d+32)) .or. (.not. (y <= 4.3d+39))) 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 <= -1.8e+32) || !(y <= 4.3e+39)) {
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 <= -1.8e+32) or not (y <= 4.3e+39): 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 <= -1.8e+32) || !(y <= 4.3e+39)) 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 <= -1.8e+32) || ~((y <= 4.3e+39))) 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, -1.8e+32], N[Not[LessEqual[y, 4.3e+39]], $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 -1.8 \cdot 10^{+32} \lor \neg \left(y \leq 4.3 \cdot 10^{+39}\right):\\
\;\;\;\;4 + 4 \cdot \frac{x}{y}\\
\mathbf{else}:\\
\;\;\;\;4 \cdot \frac{x - z}{y}\\
\end{array}
\end{array}
if y < -1.7999999999999998e32 or 4.3e39 < y Initial program 98.2%
associate-/l*99.9%
associate--l+99.9%
Simplified99.9%
Taylor expanded in x around 0 100.0%
+-commutative100.0%
associate--l+100.0%
+-commutative100.0%
associate-+l-100.0%
div-sub100.0%
Simplified100.0%
Taylor expanded in z around 0 90.1%
associate-*r/90.1%
neg-mul-190.1%
Simplified90.1%
Taylor expanded in x around 0 90.1%
if -1.7999999999999998e32 < y < 4.3e39Initial program 100.0%
associate-/l*100.0%
associate--l+100.0%
Simplified100.0%
Taylor expanded in z around inf 96.0%
Taylor expanded in y around 0 88.4%
Taylor expanded in y around 0 87.2%
sub-neg87.2%
metadata-eval87.2%
distribute-rgt-in87.2%
neg-mul-187.2%
unsub-neg87.2%
associate-*l/85.8%
associate-/l*91.1%
*-inverses91.1%
*-rgt-identity91.1%
Simplified91.1%
Final simplification90.6%
(FPCore (x y z) :precision binary64 (if (<= y -1.05e+44) 4.0 (if (<= y 2.4e+40) (* 4.0 (/ (- x z) y)) 4.0)))
double code(double x, double y, double z) {
double tmp;
if (y <= -1.05e+44) {
tmp = 4.0;
} else if (y <= 2.4e+40) {
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 <= (-1.05d+44)) then
tmp = 4.0d0
else if (y <= 2.4d+40) 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 <= -1.05e+44) {
tmp = 4.0;
} else if (y <= 2.4e+40) {
tmp = 4.0 * ((x - z) / y);
} else {
tmp = 4.0;
}
return tmp;
}
def code(x, y, z): tmp = 0 if y <= -1.05e+44: tmp = 4.0 elif y <= 2.4e+40: tmp = 4.0 * ((x - z) / y) else: tmp = 4.0 return tmp
function code(x, y, z) tmp = 0.0 if (y <= -1.05e+44) tmp = 4.0; elseif (y <= 2.4e+40) 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 <= -1.05e+44) tmp = 4.0; elseif (y <= 2.4e+40) tmp = 4.0 * ((x - z) / y); else tmp = 4.0; end tmp_2 = tmp; end
code[x_, y_, z_] := If[LessEqual[y, -1.05e+44], 4.0, If[LessEqual[y, 2.4e+40], N[(4.0 * N[(N[(x - z), $MachinePrecision] / y), $MachinePrecision]), $MachinePrecision], 4.0]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;y \leq -1.05 \cdot 10^{+44}:\\
\;\;\;\;4\\
\mathbf{elif}\;y \leq 2.4 \cdot 10^{+40}:\\
\;\;\;\;4 \cdot \frac{x - z}{y}\\
\mathbf{else}:\\
\;\;\;\;4\\
\end{array}
\end{array}
if y < -1.04999999999999993e44 or 2.4e40 < y Initial program 98.2%
associate-/l*99.9%
associate--l+99.9%
Simplified99.9%
Taylor expanded in x around 0 79.0%
div-sub79.0%
associate-/l*79.1%
*-inverses79.1%
metadata-eval79.1%
Simplified79.1%
Taylor expanded in z around 0 69.0%
if -1.04999999999999993e44 < y < 2.4e40Initial program 100.0%
associate-/l*100.0%
associate--l+100.0%
Simplified100.0%
Taylor expanded in z around inf 96.1%
Taylor expanded in y around 0 88.2%
Taylor expanded in y around 0 87.0%
sub-neg87.0%
metadata-eval87.0%
distribute-rgt-in86.9%
neg-mul-186.9%
unsub-neg86.9%
associate-*l/85.6%
associate-/l*90.8%
*-inverses90.8%
*-rgt-identity90.8%
Simplified90.8%
(FPCore (x y z) :precision binary64 (if (or (<= x -2950.0) (not (<= x 1.55e-36))) (* 4.0 (/ x y)) 4.0))
double code(double x, double y, double z) {
double tmp;
if ((x <= -2950.0) || !(x <= 1.55e-36)) {
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 ((x <= (-2950.0d0)) .or. (.not. (x <= 1.55d-36))) 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 ((x <= -2950.0) || !(x <= 1.55e-36)) {
tmp = 4.0 * (x / y);
} else {
tmp = 4.0;
}
return tmp;
}
def code(x, y, z): tmp = 0 if (x <= -2950.0) or not (x <= 1.55e-36): tmp = 4.0 * (x / y) else: tmp = 4.0 return tmp
function code(x, y, z) tmp = 0.0 if ((x <= -2950.0) || !(x <= 1.55e-36)) 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 ((x <= -2950.0) || ~((x <= 1.55e-36))) tmp = 4.0 * (x / y); else tmp = 4.0; end tmp_2 = tmp; end
code[x_, y_, z_] := If[Or[LessEqual[x, -2950.0], N[Not[LessEqual[x, 1.55e-36]], $MachinePrecision]], N[(4.0 * N[(x / y), $MachinePrecision]), $MachinePrecision], 4.0]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x \leq -2950 \lor \neg \left(x \leq 1.55 \cdot 10^{-36}\right):\\
\;\;\;\;4 \cdot \frac{x}{y}\\
\mathbf{else}:\\
\;\;\;\;4\\
\end{array}
\end{array}
if x < -2950 or 1.5499999999999999e-36 < x Initial program 99.2%
associate-/l*100.0%
associate--l+100.0%
Simplified100.0%
Taylor expanded in x around 0 95.5%
+-commutative95.5%
associate--l+95.5%
+-commutative95.5%
associate-+l-95.5%
div-sub100.0%
Simplified100.0%
Taylor expanded in z around 0 86.1%
associate-*r/86.1%
neg-mul-186.1%
Simplified86.1%
Taylor expanded in x around inf 63.7%
if -2950 < x < 1.5499999999999999e-36Initial program 99.1%
associate-/l*99.9%
associate--l+99.9%
Simplified99.9%
Taylor expanded in x around 0 97.5%
div-sub97.5%
associate-/l*97.6%
*-inverses97.6%
metadata-eval97.6%
Simplified97.6%
Taylor expanded in z around 0 51.2%
Final simplification57.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.2%
associate-/l*99.9%
associate--l+99.9%
Simplified99.9%
Taylor expanded in x around 0 68.6%
div-sub68.6%
associate-/l*68.7%
*-inverses68.7%
metadata-eval68.7%
Simplified68.7%
Taylor expanded in z around 0 36.7%
(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.2%
associate-/l*99.9%
associate--l+99.9%
Simplified99.9%
Taylor expanded in z around inf 39.4%
neg-mul-139.4%
distribute-neg-frac239.4%
Simplified39.4%
Taylor expanded in z around 0 8.2%
herbie shell --seed 2024100
(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)))