A non-transitory computer-readable medium storing a program that causes a computer to execute a process controlling a temperature of a semiconductor laser, the process comprising:
- detecting a temperature of a temperature control element by a sensor;
- controlling a supply current so that the temperature of the temperature control element is changed to a target temperature, the temperature control element controlling a temperature of the semiconductor laser by a temperature changing according to the supply current supplied to the temperature control element;
- and
- performing a control for maintaining a calculated value calculated by a digital filter at a threshold when it is detected that the calculated value reaches the threshold even when a difference between the target temperature and the temperature detected by the detecting is changed, the calculated value being the supply current according to a difference between the target temperature and the temperature detected by the detecting, the threshold being equal to or less than an output limit of the digital filter.