Skip to content

Rounding start values - #3488

Open
jort-wolda wants to merge 1 commit into
masterfrom
residences-long-floats
Open

jort-wolda wants to merge 1 commit into
masterfrom
residences-long-floats

Conversation

@jort-wolda

Copy link
Copy Markdown
Contributor

Context

The new residences can result in long floats when you do not change the shares of residences built per construction type:
image

While the shares can only be set using 1 decimal, the starting values are the result of queries calculating the value based on the dataset. These starting values actually have many more decimals in the back-end.

When you round these starting values to 1 decimal you potentially get this error when you changed the inputs and want to reset to the starting values:
image

This is a rounding error and etengine can't balance the sliders to be 100% because they are all defined based on their start-value query.

A solution that works is rounding to 2 decimals. Adding up the values shown in the front end still results in 100.1% but the back-end value with slightly more precision makes it close enough to 100% for etengine to not result in an error. The extremely long floats are thereby reduced to a maximum of 4 decimals.

Implemented changes

Rounded the input values to 2 decimals for:

  • households_share_of_apartments
  • households_share_of_detached
  • households_share_of_semi_detached
  • households_share_of_terraced

Related

Checklist

  • I have tested these changes
  • I have updated documentation as needed
  • I have tagged the relevant people for review

Rounding the start values of the shares of residences per construction type
@jort-wolda
jort-wolda requested a review from mabijkerk September 9, 2026 14:12
@jort-wolda
jort-wolda marked this pull request as ready for review September 9, 2026 14:12
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.

1 participant