home *** CD-ROM | disk | FTP | other *** search
- Newsgroups: comp.lang.pascal
- Path: sparky!uunet!gatech!usenet.ins.cwru.edu!cleveland.Freenet.Edu!bj198
- From: bj198@cleveland.Freenet.Edu (Jeremy Mans)
- Subject: Re: Rounding real #s
- Message-ID: <1992Aug13.221937.13744@usenet.ins.cwru.edu>
- Sender: news@usenet.ins.cwru.edu
- Nntp-Posting-Host: slc8.ins.cwru.edu
- Reply-To: bj198@cleveland.Freenet.Edu (Jeremy Mans)
- Organization: Case Western Reserve University, Cleveland, OH (USA)
- References: <1992Aug12.134112.4397@crpmks.uucp> <164i0vINN2lo@tony.ksu.ksu.edu> <1992Aug11.082014.26260@qiclab.scn.rain.com>
- Date: Thu, 13 Aug 92 22:19:37 GMT
- Lines: 34
-
-
- In a previous article, billb@crpmks.uucp (Bill Bochnik Info Systems)) says:
-
- >In article <1992Aug11.082014.26260@qiclab.scn.rain.com> 70465.203@compuserve.com writes:
- >>wmorgan@tony.ksu.ksu.edu () writes:
- >>
- >>> I am a new user of TP 6.0, and would like to know how to round a
- >>>real number to 2 decimal places, I.E. round 456.2345 to 456.23. I am working
- >>>on a payroll program.
- >>
- >>in a Write, or writeln, you just tack :x:y onto the variable. eg
- >> write(pay:6:2)
- >>will print the contents of pay as a 6 place number with two places to the
- >>left of the decimal.
- >>-123.45
- >> 123.45
-
- OR try this:
-
- pay:=Round(Pay*100.0)/100.0;
-
- Note - this is for all numbers, providing of course that you don't
- exceed MaxReal (which by the way is 1.7 x 10^38.......)
-
-
- -jmans
-
-
- --
- Jeremy Mans |FORTRAN II - A Model T Ford. Once it was king of the
- bj198@cleveland.| road
- freenet.edu |FORTRAN IV - A Model A Ford
- Omaha, NE (CU) |FORTRAN 77 - A V6 Ford Fairlane, no seat belts, auto
-