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=-0.3 required=5.0 tests=BAYES_00, REPLYTO_WITHOUT_TO_CC autolearn=no autolearn_force=no version=3.4.4 X-Google-Language: ENGLISH,ASCII-7-bit X-Google-Thread: 103376,f362ea01ca404786 X-Google-Attributes: gid103376,public X-Google-ArrivalTime: 1995-01-27 06:38:48 PST Path: nntp.gmd.de!newsserver.jvnc.net!nntpserver.pppl.gov!princeton!gw1.att.com!fnnews.fnal.gov!uwm.edu!news.moneng.mei.com!howland.reston.ans.net!news.sprintlink.net!pipex!uunet!newsgate.watson.ibm.com!watnews.watson.ibm.com!ncohen From: ncohen@watson.ibm.com (Norman H. Cohen) Newsgroups: comp.lang.ada Subject: Re: Easy way to read FLOAT? Date: 27 Jan 1995 14:38:48 GMT Organization: IBM T.J. Watson Research Center Distribution: world Message-ID: <3gb0ho$1flu@watnews1.watson.ibm.com> References: <3gaihr$hak@pdq.coe.montana.edu> Reply-To: ncohen@watson.ibm.com NNTP-Posting-Host: rios8.watson.ibm.com Date: 1995-01-27T14:38:48+00:00 List-Id: In article <3gaihr$hak@pdq.coe.montana.edu>, icsjp318@gemini.oscs.montana.edu (Aaron Diesen) writes: |> I am working on my first ada program, and I need to read a float. I ran |> into problems when trying to input an integer into a float variable |> (works in other languages). The Get procedure provided by instances of Text_IO.Float_IO in Ada 83 only accepts real literals optionally preceded by a '+' or '-'. A real literal always includes a decimal point--er, radix point--with at least one digit on each side of it. The Get procedure provided by instances of Ada.Text_IO.Float_IO in Ada 95 is more liberal, allowing the sames forms that real input in Fortran allows, including numbers without decimal points and numbers with digits on only one side of a decimal point. Your alternatives are: - Read raw characters and compute the Float value yourself. (It's deceptively hard to do this right.) - Use an Ada 95 compiler (in which the new rules are fully implemented) - Change your input file to conform to the Ada-83 rules. I suggest you ask your instructor what he or she has in mind. -- Norman H. Cohen ncohen@watson.ibm.com