Skip to content

fix: Parse negative ASCII integer values correctly - #39

Merged
terraputix merged 1 commit into
open-meteo:mainfrom
pranavmangal:fix/negative-ascii-parsing
Sep 18, 2026
Merged

terraputix merged 1 commit into
open-meteo:mainfrom
pranavmangal:fix/negative-ascii-parsing

Conversation

@pranavmangal

Copy link
Copy Markdown
Contributor

The geocoding API was returning positive elevation values for places below sea level (e.g: Jericho with elevation -233m).

The issue seems to be the custom ASCII parsing:

In asciiToInt8, asciiToInt16 and asciiToInt32, the minus character (-, ASCII 45) was handled via ret = ret * -1. Because since ret is initialized to 0, when a leading - is encountered, 0 * -1 = 0, causing the negative sign to be lost during parsing.

Fixes #38

@terraputix

terraputix commented Sep 18, 2026 •

Copy link
Copy Markdown
Collaborator

Hi @pranavmangal, thanks for investigating and fixing this issue, looks fine from my side!
As these changes require the db to be rebuilt and as we are working on some related improvements, it will not be deployed right away and it might take a couple of days until these changes are live on geocoding-api.open-meteo.com.

@terraputix
terraputix merged commit 9ed1ffc into open-meteo:main Sep 18, 2026
1 check passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Incorrect elevation for places situated below sea level

2 participants