-- Demonstrates a fixed point type. It stores 0.01 exactly. -- Let's work in the domain of dollars and cents with ada.text_io; use ada.text_io; -- Library for text output procedure one_v2 is -- Define a new type for Money. -- All values of type Money will have exactly 2 decimal places type Money is delta 0.01 digits 9; -- Since Money is a new type, we need to create a new I/O library for it package money_io is new ada.text_io.decimal_io(money); use money_io; -- Allow access to routines without using package name penny: money := 0.01; sum: money := 0.0; begin for i in 1 .. 100 loop sum := sum + penny; end loop; put("sum: "); money_io.put(sum); new_line; put("penny: "); money_io.put(penny); new_line; put("sum with nineteen decimal places: "); put(sum, fore => 1, aft => 9, exp => 0); new_line(2); put("penny with nineteen decimal places: "); put(penny, fore => 1, aft => 19, exp => 0); new_line; end one_v2;