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.9 required=5.0 tests=BAYES_00 autolearn=ham autolearn_force=no version=3.4.4 X-Google-Language: ENGLISH,ASCII-7-bit X-Google-Thread: 103376,82221a0da9c4aa5d X-Google-Attributes: gid103376,public X-Google-ArrivalTime: 2003-06-19 19:48:49 PST Path: archiver1.google.com!news1.google.com!newsfeed.stanford.edu!logbridge.uoregon.edu!nntp-server.caltech.edu!attla2!ip.att.net!attbi_feed3!attbi_feed4!attbi.com!sccrnsc04.POSTED!not-for-mail From: "Steve" Newsgroups: comp.lang.ada References: Subject: Re: float value without power X-Priority: 3 X-MSMail-Priority: Normal X-Newsreader: Microsoft Outlook Express 6.00.2800.1158 X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2800.1165 Message-ID: NNTP-Posting-Host: 12.211.13.75 X-Complaints-To: abuse@attbi.com X-Trace: sccrnsc04 1056077327 12.211.13.75 (Fri, 20 Jun 2003 02:48:47 GMT) NNTP-Posting-Date: Fri, 20 Jun 2003 02:48:47 GMT Organization: AT&T Broadband Date: Fri, 20 Jun 2003 02:48:47 GMT Xref: archiver1.google.com comp.lang.ada:39472 Date: 2003-06-20T02:48:47+00:00 List-Id: "Etienne Baudin" wrote in message news:bcs323$925$1@news-reader13.wanadoo.fr... > If F is 123.456 > float'image(F) will be 1.2346e2. I Would like to get 123.465 in the string, > is it possible ? Here's how I do it: with Ada.Float_Text_Io; with Ada.Strings; with Ada.Strings.Fixed; with Ada.Text_Io; procedure DemoFormat is function Float_To_String( f : Float; aft : Natural ) return String is result : String( 1 .. 64 ); begin Ada.Float_Text_Io.Put( result, f, aft, 0 ); return Ada.Strings.Fixed.Trim( result, Ada.Strings.Both ); end Float_To_String; begin Ada.Text_IO.Put_Line( Float_To_String( 123.456, 3 ) ); end DemoFormat; Steve (The Duck) > > Thanks > Etienne > >