In many quantum algorithms, including Hamiltonian simulation, efficient quantum circuit implementation of diagonal unitary matrices is an important issue. For small unitary diagonal matrices, a method based on Walsh operators is known and allows an exact implementation. Whereas, as the matrix size increases, the required resources increase linearly regarding the matrix size, so an efficient approximate implementation is indispensable. In this study, we specify the approximation using piecewise polynomials when the diagonal unitary matrix is generated by a known underlying function. It accelerates the implementation by an exponential factor compared to the exact one. In more detail, we modify a previous method, which we call PPP (phase gate for piecewise-defined polynomial), and propose a novel one called LIU (linearly interpolated unitary diagonal matrix). By introducing a coarse-graining parameter, calculated from the underlying function and the desired error bound, we evaluate the explicit gate counts for different methods as functions of some norms of the given function, the grid parameter, and the allowable error. It helps us to figure out the efficient quantum circuits in practical settings of different grid parameters and error bounds, in addition to an asymptotic speedup when the grid parameter goes to infinity. As an application, we apply our method to the first-quantized Hamiltonian simulation and estimate the quantum resources (gate count and ancillary qubits). It reveals that the error coming from the approximation of the potential function is not negligible compared to the error from the Trotter-Suzuki formula.