
(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 8 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 (+ (* 4.0 (/ (- x z) y)) 2.0))
double code(double x, double y, double z) {
return (4.0 * ((x - z) / y)) + 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 = (4.0d0 * ((x - z) / y)) + 2.0d0
end function
public static double code(double x, double y, double z) {
return (4.0 * ((x - z) / y)) + 2.0;
}
def code(x, y, z): return (4.0 * ((x - z) / y)) + 2.0
function code(x, y, z) return Float64(Float64(4.0 * Float64(Float64(x - z) / y)) + 2.0) end
function tmp = code(x, y, z) tmp = (4.0 * ((x - z) / y)) + 2.0; end
code[x_, y_, z_] := N[(N[(4.0 * N[(N[(x - z), $MachinePrecision] / y), $MachinePrecision]), $MachinePrecision] + 2.0), $MachinePrecision]
\begin{array}{l}
\\
4 \cdot \frac{x - z}{y} + 2
\end{array}
Initial program 100.0%
associate-/l*99.7%
Simplified99.7%
Taylor expanded in y around 0 100.0%
+-commutative100.0%
Simplified100.0%
Final simplification100.0%
(FPCore (x y z)
:precision binary64
(if (or (<= x -5.8e+109)
(and (not (<= x -1.6e+42)) (or (<= x -0.0031) (not (<= x 7.5e-16)))))
(+ (* 4.0 (/ x y)) 1.0)
2.0))
double code(double x, double y, double z) {
double tmp;
if ((x <= -5.8e+109) || (!(x <= -1.6e+42) && ((x <= -0.0031) || !(x <= 7.5e-16)))) {
tmp = (4.0 * (x / y)) + 1.0;
} 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 <= (-5.8d+109)) .or. (.not. (x <= (-1.6d+42))) .and. (x <= (-0.0031d0)) .or. (.not. (x <= 7.5d-16))) then
tmp = (4.0d0 * (x / y)) + 1.0d0
else
tmp = 2.0d0
end if
code = tmp
end function
public static double code(double x, double y, double z) {
double tmp;
if ((x <= -5.8e+109) || (!(x <= -1.6e+42) && ((x <= -0.0031) || !(x <= 7.5e-16)))) {
tmp = (4.0 * (x / y)) + 1.0;
} else {
tmp = 2.0;
}
return tmp;
}
def code(x, y, z): tmp = 0 if (x <= -5.8e+109) or (not (x <= -1.6e+42) and ((x <= -0.0031) or not (x <= 7.5e-16))): tmp = (4.0 * (x / y)) + 1.0 else: tmp = 2.0 return tmp
function code(x, y, z) tmp = 0.0 if ((x <= -5.8e+109) || (!(x <= -1.6e+42) && ((x <= -0.0031) || !(x <= 7.5e-16)))) tmp = Float64(Float64(4.0 * Float64(x / y)) + 1.0); else tmp = 2.0; end return tmp end
function tmp_2 = code(x, y, z) tmp = 0.0; if ((x <= -5.8e+109) || (~((x <= -1.6e+42)) && ((x <= -0.0031) || ~((x <= 7.5e-16))))) tmp = (4.0 * (x / y)) + 1.0; else tmp = 2.0; end tmp_2 = tmp; end
code[x_, y_, z_] := If[Or[LessEqual[x, -5.8e+109], And[N[Not[LessEqual[x, -1.6e+42]], $MachinePrecision], Or[LessEqual[x, -0.0031], N[Not[LessEqual[x, 7.5e-16]], $MachinePrecision]]]], N[(N[(4.0 * N[(x / y), $MachinePrecision]), $MachinePrecision] + 1.0), $MachinePrecision], 2.0]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x \leq -5.8 \cdot 10^{+109} \lor \neg \left(x \leq -1.6 \cdot 10^{+42}\right) \land \left(x \leq -0.0031 \lor \neg \left(x \leq 7.5 \cdot 10^{-16}\right)\right):\\
\;\;\;\;4 \cdot \frac{x}{y} + 1\\
\mathbf{else}:\\
\;\;\;\;2\\
\end{array}
\end{array}
if x < -5.8e109 or -1.60000000000000001e42 < x < -0.00309999999999999989 or 7.5e-16 < x Initial program 100.0%
associate-/l*99.6%
Simplified99.6%
Taylor expanded in x around inf 70.1%
if -5.8e109 < x < -1.60000000000000001e42 or -0.00309999999999999989 < x < 7.5e-16Initial program 100.0%
associate-/l*99.8%
Simplified99.8%
Taylor expanded in y around inf 51.0%
Final simplification60.4%
(FPCore (x y z)
:precision binary64
(let* ((t_0 (+ (* 4.0 (/ x y)) 1.0)) (t_1 (+ 1.0 (* z (/ -4.0 y)))))
(if (<= z -1.9e+20)
t_1
(if (<= z 4.3e-246)
t_0
(if (<= z 4.1e-220) 2.0 (if (<= z 4.3e+110) t_0 t_1))))))
double code(double x, double y, double z) {
double t_0 = (4.0 * (x / y)) + 1.0;
double t_1 = 1.0 + (z * (-4.0 / y));
double tmp;
if (z <= -1.9e+20) {
tmp = t_1;
} else if (z <= 4.3e-246) {
tmp = t_0;
} else if (z <= 4.1e-220) {
tmp = 2.0;
} else if (z <= 4.3e+110) {
tmp = t_0;
} else {
tmp = t_1;
}
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) :: t_1
real(8) :: tmp
t_0 = (4.0d0 * (x / y)) + 1.0d0
t_1 = 1.0d0 + (z * ((-4.0d0) / y))
if (z <= (-1.9d+20)) then
tmp = t_1
else if (z <= 4.3d-246) then
tmp = t_0
else if (z <= 4.1d-220) then
tmp = 2.0d0
else if (z <= 4.3d+110) then
tmp = t_0
else
tmp = t_1
end if
code = tmp
end function
public static double code(double x, double y, double z) {
double t_0 = (4.0 * (x / y)) + 1.0;
double t_1 = 1.0 + (z * (-4.0 / y));
double tmp;
if (z <= -1.9e+20) {
tmp = t_1;
} else if (z <= 4.3e-246) {
tmp = t_0;
} else if (z <= 4.1e-220) {
tmp = 2.0;
} else if (z <= 4.3e+110) {
tmp = t_0;
} else {
tmp = t_1;
}
return tmp;
}
def code(x, y, z): t_0 = (4.0 * (x / y)) + 1.0 t_1 = 1.0 + (z * (-4.0 / y)) tmp = 0 if z <= -1.9e+20: tmp = t_1 elif z <= 4.3e-246: tmp = t_0 elif z <= 4.1e-220: tmp = 2.0 elif z <= 4.3e+110: tmp = t_0 else: tmp = t_1 return tmp
function code(x, y, z) t_0 = Float64(Float64(4.0 * Float64(x / y)) + 1.0) t_1 = Float64(1.0 + Float64(z * Float64(-4.0 / y))) tmp = 0.0 if (z <= -1.9e+20) tmp = t_1; elseif (z <= 4.3e-246) tmp = t_0; elseif (z <= 4.1e-220) tmp = 2.0; elseif (z <= 4.3e+110) tmp = t_0; else tmp = t_1; end return tmp end
function tmp_2 = code(x, y, z) t_0 = (4.0 * (x / y)) + 1.0; t_1 = 1.0 + (z * (-4.0 / y)); tmp = 0.0; if (z <= -1.9e+20) tmp = t_1; elseif (z <= 4.3e-246) tmp = t_0; elseif (z <= 4.1e-220) tmp = 2.0; elseif (z <= 4.3e+110) tmp = t_0; else tmp = t_1; end tmp_2 = tmp; end
code[x_, y_, z_] := Block[{t$95$0 = N[(N[(4.0 * N[(x / y), $MachinePrecision]), $MachinePrecision] + 1.0), $MachinePrecision]}, Block[{t$95$1 = N[(1.0 + N[(z * N[(-4.0 / y), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[z, -1.9e+20], t$95$1, If[LessEqual[z, 4.3e-246], t$95$0, If[LessEqual[z, 4.1e-220], 2.0, If[LessEqual[z, 4.3e+110], t$95$0, t$95$1]]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := 4 \cdot \frac{x}{y} + 1\\
t_1 := 1 + z \cdot \frac{-4}{y}\\
\mathbf{if}\;z \leq -1.9 \cdot 10^{+20}:\\
\;\;\;\;t_1\\
\mathbf{elif}\;z \leq 4.3 \cdot 10^{-246}:\\
\;\;\;\;t_0\\
\mathbf{elif}\;z \leq 4.1 \cdot 10^{-220}:\\
\;\;\;\;2\\
\mathbf{elif}\;z \leq 4.3 \cdot 10^{+110}:\\
\;\;\;\;t_0\\
\mathbf{else}:\\
\;\;\;\;t_1\\
\end{array}
\end{array}
if z < -1.9e20 or 4.30000000000000007e110 < z Initial program 100.0%
associate-/l*99.8%
Simplified99.8%
Taylor expanded in z around inf 72.7%
*-commutative72.7%
Simplified72.7%
Taylor expanded in z around 0 72.7%
associate-*r/72.7%
*-commutative72.7%
associate-*r/72.5%
Simplified72.5%
if -1.9e20 < z < 4.29999999999999992e-246 or 4.09999999999999991e-220 < z < 4.30000000000000007e110Initial program 100.0%
associate-/l*99.7%
Simplified99.7%
Taylor expanded in x around inf 64.9%
if 4.29999999999999992e-246 < z < 4.09999999999999991e-220Initial program 100.0%
associate-/l*100.0%
Simplified100.0%
Taylor expanded in y around inf 100.0%
Final simplification69.0%
(FPCore (x y z)
:precision binary64
(let* ((t_0 (+ (* 4.0 (/ x y)) 1.0)) (t_1 (+ 1.0 (* (/ z y) -4.0))))
(if (<= z -1.56e+16)
t_1
(if (<= z 9.5e-246)
t_0
(if (<= z 1.45e-219) 2.0 (if (<= z 5.4e+110) t_0 t_1))))))
double code(double x, double y, double z) {
double t_0 = (4.0 * (x / y)) + 1.0;
double t_1 = 1.0 + ((z / y) * -4.0);
double tmp;
if (z <= -1.56e+16) {
tmp = t_1;
} else if (z <= 9.5e-246) {
tmp = t_0;
} else if (z <= 1.45e-219) {
tmp = 2.0;
} else if (z <= 5.4e+110) {
tmp = t_0;
} else {
tmp = t_1;
}
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) :: t_1
real(8) :: tmp
t_0 = (4.0d0 * (x / y)) + 1.0d0
t_1 = 1.0d0 + ((z / y) * (-4.0d0))
if (z <= (-1.56d+16)) then
tmp = t_1
else if (z <= 9.5d-246) then
tmp = t_0
else if (z <= 1.45d-219) then
tmp = 2.0d0
else if (z <= 5.4d+110) then
tmp = t_0
else
tmp = t_1
end if
code = tmp
end function
public static double code(double x, double y, double z) {
double t_0 = (4.0 * (x / y)) + 1.0;
double t_1 = 1.0 + ((z / y) * -4.0);
double tmp;
if (z <= -1.56e+16) {
tmp = t_1;
} else if (z <= 9.5e-246) {
tmp = t_0;
} else if (z <= 1.45e-219) {
tmp = 2.0;
} else if (z <= 5.4e+110) {
tmp = t_0;
} else {
tmp = t_1;
}
return tmp;
}
def code(x, y, z): t_0 = (4.0 * (x / y)) + 1.0 t_1 = 1.0 + ((z / y) * -4.0) tmp = 0 if z <= -1.56e+16: tmp = t_1 elif z <= 9.5e-246: tmp = t_0 elif z <= 1.45e-219: tmp = 2.0 elif z <= 5.4e+110: tmp = t_0 else: tmp = t_1 return tmp
function code(x, y, z) t_0 = Float64(Float64(4.0 * Float64(x / y)) + 1.0) t_1 = Float64(1.0 + Float64(Float64(z / y) * -4.0)) tmp = 0.0 if (z <= -1.56e+16) tmp = t_1; elseif (z <= 9.5e-246) tmp = t_0; elseif (z <= 1.45e-219) tmp = 2.0; elseif (z <= 5.4e+110) tmp = t_0; else tmp = t_1; end return tmp end
function tmp_2 = code(x, y, z) t_0 = (4.0 * (x / y)) + 1.0; t_1 = 1.0 + ((z / y) * -4.0); tmp = 0.0; if (z <= -1.56e+16) tmp = t_1; elseif (z <= 9.5e-246) tmp = t_0; elseif (z <= 1.45e-219) tmp = 2.0; elseif (z <= 5.4e+110) tmp = t_0; else tmp = t_1; end tmp_2 = tmp; end
code[x_, y_, z_] := Block[{t$95$0 = N[(N[(4.0 * N[(x / y), $MachinePrecision]), $MachinePrecision] + 1.0), $MachinePrecision]}, Block[{t$95$1 = N[(1.0 + N[(N[(z / y), $MachinePrecision] * -4.0), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[z, -1.56e+16], t$95$1, If[LessEqual[z, 9.5e-246], t$95$0, If[LessEqual[z, 1.45e-219], 2.0, If[LessEqual[z, 5.4e+110], t$95$0, t$95$1]]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := 4 \cdot \frac{x}{y} + 1\\
t_1 := 1 + \frac{z}{y} \cdot -4\\
\mathbf{if}\;z \leq -1.56 \cdot 10^{+16}:\\
\;\;\;\;t_1\\
\mathbf{elif}\;z \leq 9.5 \cdot 10^{-246}:\\
\;\;\;\;t_0\\
\mathbf{elif}\;z \leq 1.45 \cdot 10^{-219}:\\
\;\;\;\;2\\
\mathbf{elif}\;z \leq 5.4 \cdot 10^{+110}:\\
\;\;\;\;t_0\\
\mathbf{else}:\\
\;\;\;\;t_1\\
\end{array}
\end{array}
if z < -1.56e16 or 5.40000000000000019e110 < z Initial program 100.0%
associate-/l*99.8%
Simplified99.8%
Taylor expanded in z around inf 72.7%
*-commutative72.7%
Simplified72.7%
if -1.56e16 < z < 9.5000000000000002e-246 or 1.44999999999999992e-219 < z < 5.40000000000000019e110Initial program 100.0%
associate-/l*99.7%
Simplified99.7%
Taylor expanded in x around inf 64.9%
if 9.5000000000000002e-246 < z < 1.44999999999999992e-219Initial program 100.0%
associate-/l*100.0%
Simplified100.0%
Taylor expanded in y around inf 100.0%
Final simplification69.0%
(FPCore (x y z) :precision binary64 (if (or (<= z -4.2e+98) (not (<= z 1.12e+114))) (+ 1.0 (* (/ z y) -4.0)) (+ 2.0 (* 4.0 (/ x y)))))
double code(double x, double y, double z) {
double tmp;
if ((z <= -4.2e+98) || !(z <= 1.12e+114)) {
tmp = 1.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 ((z <= (-4.2d+98)) .or. (.not. (z <= 1.12d+114))) then
tmp = 1.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 ((z <= -4.2e+98) || !(z <= 1.12e+114)) {
tmp = 1.0 + ((z / y) * -4.0);
} else {
tmp = 2.0 + (4.0 * (x / y));
}
return tmp;
}
def code(x, y, z): tmp = 0 if (z <= -4.2e+98) or not (z <= 1.12e+114): tmp = 1.0 + ((z / y) * -4.0) else: tmp = 2.0 + (4.0 * (x / y)) return tmp
function code(x, y, z) tmp = 0.0 if ((z <= -4.2e+98) || !(z <= 1.12e+114)) tmp = Float64(1.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 ((z <= -4.2e+98) || ~((z <= 1.12e+114))) tmp = 1.0 + ((z / y) * -4.0); else tmp = 2.0 + (4.0 * (x / y)); end tmp_2 = tmp; end
code[x_, y_, z_] := If[Or[LessEqual[z, -4.2e+98], N[Not[LessEqual[z, 1.12e+114]], $MachinePrecision]], N[(1.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}\;z \leq -4.2 \cdot 10^{+98} \lor \neg \left(z \leq 1.12 \cdot 10^{+114}\right):\\
\;\;\;\;1 + \frac{z}{y} \cdot -4\\
\mathbf{else}:\\
\;\;\;\;2 + 4 \cdot \frac{x}{y}\\
\end{array}
\end{array}
if z < -4.20000000000000008e98 or 1.11999999999999999e114 < z Initial program 100.0%
associate-/l*99.8%
Simplified99.8%
Taylor expanded in z around inf 75.9%
*-commutative75.9%
Simplified75.9%
if -4.20000000000000008e98 < z < 1.11999999999999999e114Initial program 100.0%
associate-/l*99.7%
Simplified99.7%
Taylor expanded in y around 0 100.0%
+-commutative100.0%
Simplified100.0%
Taylor expanded in x around inf 91.6%
Final simplification85.8%
(FPCore (x y z) :precision binary64 (if (or (<= z -5.2e+25) (not (<= z 4.6e+110))) (- 2.0 (* 4.0 (/ z y))) (+ 2.0 (* 4.0 (/ x y)))))
double code(double x, double y, double z) {
double tmp;
if ((z <= -5.2e+25) || !(z <= 4.6e+110)) {
tmp = 2.0 - (4.0 * (z / y));
} 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 ((z <= (-5.2d+25)) .or. (.not. (z <= 4.6d+110))) then
tmp = 2.0d0 - (4.0d0 * (z / y))
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 ((z <= -5.2e+25) || !(z <= 4.6e+110)) {
tmp = 2.0 - (4.0 * (z / y));
} else {
tmp = 2.0 + (4.0 * (x / y));
}
return tmp;
}
def code(x, y, z): tmp = 0 if (z <= -5.2e+25) or not (z <= 4.6e+110): tmp = 2.0 - (4.0 * (z / y)) else: tmp = 2.0 + (4.0 * (x / y)) return tmp
function code(x, y, z) tmp = 0.0 if ((z <= -5.2e+25) || !(z <= 4.6e+110)) tmp = Float64(2.0 - Float64(4.0 * Float64(z / y))); 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 ((z <= -5.2e+25) || ~((z <= 4.6e+110))) tmp = 2.0 - (4.0 * (z / y)); else tmp = 2.0 + (4.0 * (x / y)); end tmp_2 = tmp; end
code[x_, y_, z_] := If[Or[LessEqual[z, -5.2e+25], N[Not[LessEqual[z, 4.6e+110]], $MachinePrecision]], N[(2.0 - N[(4.0 * N[(z / y), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(2.0 + N[(4.0 * N[(x / y), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \leq -5.2 \cdot 10^{+25} \lor \neg \left(z \leq 4.6 \cdot 10^{+110}\right):\\
\;\;\;\;2 - 4 \cdot \frac{z}{y}\\
\mathbf{else}:\\
\;\;\;\;2 + 4 \cdot \frac{x}{y}\\
\end{array}
\end{array}
if z < -5.1999999999999997e25 or 4.6e110 < z Initial program 100.0%
associate-/l*99.8%
Simplified99.8%
Taylor expanded in y around 0 100.0%
+-commutative100.0%
Simplified100.0%
Taylor expanded in x around 0 89.5%
associate-*r/89.5%
neg-mul-189.5%
Simplified89.5%
if -5.1999999999999997e25 < z < 4.6e110Initial program 100.0%
associate-/l*99.7%
Simplified99.7%
Taylor expanded in y around 0 100.0%
+-commutative100.0%
Simplified100.0%
Taylor expanded in x around inf 93.5%
Final simplification91.8%
(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%
associate-*l/99.7%
+-commutative99.7%
associate--l+99.7%
distribute-lft-in99.8%
associate-+r+99.8%
Simplified99.8%
Final simplification99.8%
(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%
associate-/l*99.7%
Simplified99.7%
Taylor expanded in y around inf 30.5%
Final simplification30.5%
herbie shell --seed 2023279
(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)))