The following code should be safe.
{% if number-of-images > 0 %} {% assign gap = number-of-paragraphs | divided_by: number-of-images | floor %} {% endi