With many operations Prometheus will match the metrics using their labels. For your example of A & B, take a look at what combinations of labels exist - both could be single values or multiple values, both could have identical sets of labels or different ones. These will all alter the outcome.
For division by a fixed number there is no problem with label
matching, so for example A / 5 will return exactly as you'd
expect, being each of the values of A (which could be multiple
combinations of labels) divided by 5.