Volatile electrical energy prices are a challenge and an opportunity for small and medium-sized companies in energy-intensive industries. By using electrical energy storage and/or an adaptation of production processes, companies can significantly profit from time-depending energy prices and reduce their energy costs.We consider a time-discrete optimal control problem to reach a desired final state of the energy storage at a certain time step. Thereby, the energy input is discrete since only multiples of 100 kWh can be purchased at the EPEX SPOT market. We use available price estimates to minimize the total energy cost by a rounding based dynamic programming approach. With our model non-linear energy loss functions of the storage can be considered and we obtain a significant speed-up compared to the integer (linear) programming formulation.