Reputation: 595
I'm having much trouble with operation which seems to be very simple. I'm willing to round quotient. I know that I : Integer := A/B
, (where A and B are Integers) return floor. But I want to get ceiling. I've been trying to play with 'Ceiling
'Round
'Rounding
but none of them seems to work (most of the times it didn't even compile). I'm hoping for a quick answer, with a elegant (is it possible to write it without dozen type conversions) solution ;D
Upvotes: 5
Views: 2635
Reputation: 25501
Normally I’d say
I : Integer := (A + (B - 1)) / B;
(typically come across when trying to work out how many storage units you need to accommodate a certain number of bits).
Upvotes: 8