9

I want to print a float number, i am using the package FLOAT_IO.

Is there a way to control the number of digits after the dot and before it?

mskfisher
  • 3,291
  • 4
  • 35
  • 48
Doron Sinai
  • 1,166
  • 3
  • 12
  • 28

1 Answers1

8

The procedure Put in Ada.Float_Text_IO has three optional format-controlling parameters Fore, Aft, Exp that control the output. The meaning of these parameters is as follows:

  • Fore denotes the number of digits (including the possible negative sign and leading zeros) before the dot;
  • Aft denotes the number of digits after the dot (including any trailing zeros);
  • Exp denotes the number of digits of the exponent (if necessary).

For a more thorough description and the default values of the format-controlling parameters see the Ada 95 Reference Manual, section A.10.9.

Connor Smith
  • 15
  • 1
  • 7
Ondrej Tucny
  • 27,626
  • 6
  • 70
  • 90
  • Can you explain what fore, aft, exp, stands for? – Doron Sinai Dec 27 '10 at 10:54
  • The reference manual section Ondrej linked to explains what Fore, Aft, and Exp are for. – Marc C Dec 27 '10 at 13:25
  • 2
    Clarified a bit; however, it's a good idea to read the respective RM section to get familiar with the details. – Ondrej Tucny Dec 27 '10 at 13:48
  • 2
    @Doron Sinai - "fore" and "aft" are nautical terms for the front and back of the boat respectively. I guess this is one of those situations where not being a native English speaker can hurt you. "Exp" is just short for "Exponent". – T.E.D. Dec 27 '10 at 14:01