From mboxrd@z Thu Jan 1 00:00:00 1970 X-Spam-Checker-Version: SpamAssassin 3.4.4 (2020-01-24) on polar.synack.me X-Spam-Level: X-Spam-Status: No, score=-1.3 required=5.0 tests=BAYES_00,INVALID_MSGID autolearn=no autolearn_force=no version=3.4.4 X-Google-Language: ENGLISH,ASCII-7-bit X-Google-Thread: 103376,f3f942ceb60412f0 X-Google-Attributes: gid103376,public From: "David C. Hoos, Sr." Subject: Re: Aft, Fore, and Exp Date: 1999/06/09 Message-ID: #1/1 X-Deja-AN: 487762586 Content-Transfer-Encoding: 7bit References: <4Lv73.14$ep6.23052@ratbert.tds.net> Content-Type: text/plain; charset="iso-8859-1" MIME-Version: 1.0 Newsgroups: comp.lang.ada X-MimeOLE: Produced By Microsoft MimeOLE V5.00.2314.1300 Date: 1999-06-09T00:00:00+00:00 List-Id: wrote in message news:4Lv73.14$ep6.23052@ratbert.tds.net... > Need help on how to use these. do they go in declaration?? example?? > what i have is my output coming out to 1.98000E+01 and i want it to show 19.8 > or 20 rounded off. how do i do this??? Here are some examples: with Ada.Float_Text_IO; with Ada.Text_IO; procedure Rounding is The_Value : Float := 19.849; begin Ada.Text_IO.Put_Line (Float'Image (The_Value)); Ada.Float_Text_IO.Put (The_Value); Ada.Text_IO.New_Line; Ada.Float_Text_IO.Put (Item => The_Value, Exp => 0, Fore => 3, Aft => 3); Ada.Text_IO.New_Line; Ada.Float_Text_IO.Put (Item => The_Value, Exp => 0, Fore => 3, Aft => 2); Ada.Text_IO.New_Line; Ada.Float_Text_IO.Put (Item => The_Value, Exp => 0, Fore => 3, Aft => 1); Ada.Text_IO.New_Line; Ada.Float_Text_IO.Put (Item => The_Value, Exp => 0, Fore => 3, Aft => 0); Ada.Text_IO.New_Line; Ada.Text_IO.Put_Line(Integer'Image (Integer (The_Value))); end Rounding; The output is: 1.98490E+01 1.98490E+01 19.849 19.85 19.8 19.8 20 Note that in accordance with the Ada Reference Manual A.10.9 (25), the result for Aft = 0 is the same as for Aft = 0 -- i.e., one digit follows the decimal point.