[ Home  |  FAQ-Related Q&As  |  General Q&As  |  Answered Questions ]

    Search the Q&A Archives

While 'withing' and 'using' both Text_IO and Float_Text_IO,...

<< Back to: Ada FAQ: Programming with Ada (part 1 of 4)

Question by ig307
Submitted on 2/17/2004
Related FAQ: Ada FAQ: Programming with Ada (part 1 of 4)
Rating: Rate this question: Vote
While 'withing' and 'using' both Text_IO and
Float_Text_IO, what package can I instantiate
(if any) to display floating point numbers without the exponent, i.e. 1.2500e02 to 125.00. I am familiar with the form:
(floatvar,1,2,0);, but this doesn't work when I use it in:
Put(Output_File, Item => floatvar);.
This is within a 'for' loop that is within a 'begin'
and 'end' for exception handling, (If any of that makes sense),
to the new text file I am generating.
I can overcome this problem by switching all variables to a natural type, but this isn't what I want.
Any help would be greatly appreciated.


Answer by PragmAda Software Engineering
Submitted on 4/28/2004
Rating: Not yet rated Rate this answer: Vote
Ada.Float_Text_IO is [equivalent to] an instantiation of Ada.Text_IO.Float_IO. The discussion of the latter can be found at ARM A.10.9. The ARM may be found at


You will find the following operation:

procedure Put(File : in File_Type;
              Item : in Num;
              Fore : in Field := Default_Fore;
              Aft  : in Field := Default_Aft;
              Exp  : in Field := Default_Exp);

By specifying zero for the value of Exp in this call [Put (..., Exp => 0);] you can avoid outputting an exponent part.


Your answer will be published for anyone to see and rate.  Your answer will not be displayed immediately.  If you'd like to get expert points and benefit from positive ratings, please create a new account or login into an existing account below.

Your name or nickname:
If you'd like to create a new account or access your existing account, put in your password here:
Your answer:

FAQS.ORG reserves the right to edit your answer as to improve its clarity.  By submitting your answer you authorize FAQS.ORG to publish your answer on the WWW without any restrictions. You agree to hold harmless and indemnify FAQS.ORG against any claims, costs, or damages resulting from publishing your answer.


FAQS.ORG makes no guarantees as to the accuracy of the posts. Each post is the personal opinion of the poster. These posts are not intended to substitute for medical, tax, legal, investment, accounting, or other professional advice. FAQS.ORG does not endorse any opinion or any product or service mentioned mentioned in these posts.


<< Back to: Ada FAQ: Programming with Ada (part 1 of 4)

[ Home  |  FAQ-Related Q&As  |  General Q&As  |  Answered Questions ]

© 2008 FAQS.ORG. All rights reserved.