--  Money as ordinary fixed point (RM 3.5.9): amounts in cents, interest and shares that
--  truncate toward zero, and totals whose ranges are proved.
package Accounts is
   type Money is delta 0.01 range -1_000_000.0 .. 1_000_000.0;
   subtype Balance is Money range 0.0 .. 100_000.0;
   type Rate is delta 0.0001 range 0.0 .. 1.0;

   type Ledger is array (1 .. 6) of Balance;

   function Interest (B : Balance; R : Rate) return Balance
     with Post => Interest'Result <= B;

   function Share (B : Balance; Parts : Positive) return Balance
     with Pre => Parts <= 1000,
          Post => Share'Result <= B;

   function Total (L : Ledger) return Money
     with Post => Total'Result in 0.0 .. 600_000.0;

   function Whole_Units (M : Money) return Integer
     with Pre => M in -1000.0 .. 1000.0;
end Accounts;
