[Discussion] The number of stories calculation, use ceil() or floor() to get the integer from float

The question is how we treat the float number of stories as the best estimation integer.

When working on the height related issues/MRs, such as !28 (merged) , one situation we need to deal with is if the input value from OSM tag for stories is a float, building:levels = 1.3, we need to get the integer. In the previous height rule and !28 (merged), the method is to ceil(stories_float), so building:levels = 1.3 -> integer 2, ceil() is to "Rounds up to next integer".

But when check the code and definition in taxonomy-lib, such as the function get_number_of_stories(), I found the methods for getting the estimation is best_estimate = floor(num_stories), floor() is to "Rounds down to next integer". So for the same float, parsing building:levels = 1.3 to floor() will return -> integer 1.

The possible conditions that we need to think about are:

  1. Retrieve value from OSM tags, in the rabotnik-height-rule:
    • for the ground stories, we want to round up or round down?
    • for the underground stories, we want to round up or round down?
  2. Get and estimated the stories from a taxonomy definition in the taxonomy-lib:
    • when we have a range of ground stories, HBET:1-4, the best estimation of stories should be int(2) or int(3)? In the current TL is:
num_stories = (min_stories + max_stories) / 2
best_estimate = floor(num_stories)
  • when we have a range of underground stories, HBBET:1-4, the best estimation of stories should be what? Since @ds suggested to make underground = 0 as the valid one HBEX:0 (see comment here), so if we have HBBET:0-1 as a valid string, the floor() will give us 0, and ceil() will give use 1 as the best underground estimation.

We need to change the height rule and taxonomylib at the same time, so better to make an agreement here to move forward. Comments and opinions are needed!

\rfc @all

Edited by Chengzhi Rao