An electronic device, comprising: a processor; and a first storage unit (112, 113, 120) storing programs to be executed by the processor, wherein the processor reads out the programs stored on the first storage unit (112, 113, 120) to execute: an error obtaining process of obtaining error in satellite positioning when satellite positioning is to be performed; and a control process (S22-S24) of, on the basis of the error obtained by the error obtaining process, performing either one of or both of a satellite-based altitude information obtaining process (S1-S3) and a sensor-based altitude information obtaining process (S11-S13), and causing altitude information obtained by the satellite-based altitude information obtaining process (S1-S3) and altitude information obtained by the sensor-based altitude information obtaining process (S11-S13) to be selectively output to a user or a component of the electronic device, characterized in that the satellite-based altitude information obtaining process (S1-S3) obtains the altitude information at a location of the electronic device by satellite positioning intermittently, and, between the satellite positioning intervals, the sensor-based altitude information obtaining process (S11-S13) obtains the altitude information at a location of the electronic device on the basis of atmospheric pressure data detected at the location; in the control process (S22-S24), the altitude information obtained by the satellite-based altitude information obtaining process (S1-S3) is caused to be output when the error obtained by the error obtaining process is less than or equal to a prescribed threshold value and then the altitude information obtained by the sensor-based altitude information obtaining process (S11-S13) is caused to be output for a prescribed period of time when the error obtained by the error obtaining process is greater than the prescribed threshold value. a processor; and a first storage unit (112, 113, 120) storing programs to be executed by the processor, wherein the processor reads out the programs stored on the first storage unit (112, 113, 120) to execute: an error obtaining process of obtaining error in satellite positioning when satellite positioning is to be performed; and a control process (S22-S24) of, on the basis of the error obtained by the error obtaining process, performing either one of or both of a satellite-based altitude information obtaining process (S1-S3) and a sensor-based altitude information obtaining process (S11-S13), and causing altitude information obtained by the satellite-based altitude information obtaining process (S1-S3) and altitude information obtained by the sensor-based altitude information obtaining process (S11-S13) to be selectively output to a user or a component of the electronic device, characterized in that the satellite-based altitude information obtaining process (S1-S3) obtains the altitude information at a location of the electronic device by satellite positioning intermittently, and, between the satellite positioning intervals, the sensor-based altitude information obtaining process (S11-S13) obtains the altitude information at a location of the electronic device on the basis of atmospheric pressure data detected at the location; an error obtaining process of obtaining error in satellite positioning when satellite positioning is to be performed; and a control process (S22-S24) of, on the basis of the error obtained by the error obtaining process, performing either one of or both of a satellite-based altitude information obtaining process (S1-S3) and a sensor-based altitude information obtaining process (S11-S13), and causing altitude information obtained by the satellite-based altitude information obtaining process (S1-S3) and altitude information obtained by the sensor-based altitude information obtaining process (S11-S13) to be selectively output to a user or a component of the electronic device, characterized in that the satellite-based altitude information obtaining process (S1-S3) obtains the altitude information at a location of the electronic device by satellite positioning intermittently, and, between the satellite positioning intervals, the sensor-based altitude information obtaining process (S11-S13) obtains the altitude information at a location of the electronic device on the basis of atmospheric pressure data detected at the location;