If a host falls between the values (e.g. 18GB as in your example) the number is rounded up. Meaning it will consume 2 HU. Detailed documentation also explaining this behaviour can be found here: https://www.dynatrace.com/support/help/reference/monitoring-consumption-calculation/
Above 16GB, it is rounded up. So everything above 16GB becomes 2 HU until 32GB. Above 32GB until 48GB it is 3 HU, etc. This applies for full stack mode.
For infrastructure mode, the 0.3 coefficient applies, but the consumed HU will never cross 1 HU. So for a host in infrastructure mode, you will not consume more than 1 HU.