View previous topic :: View next topic
|
Author |
Message |
vinuk2009
New User
Joined: 30 Apr 2009 Posts: 19 Location: chennai
|
|
|
|
Hi,
Is it possible to round 9th decimal point while dividing values.
if the output of two values divide function is .093989466 that output value I want as .093989470 and if output is .093989464 that output value I want as .093989464. |
|
Back to top |
|
|
Robert Sample
Global Moderator
Joined: 06 Jun 2008 Posts: 8696 Location: Dubuque, Iowa, USA
|
|
|
|
Does ROUNDED not give you what you want? |
|
Back to top |
|
|
CICS Guy
Senior Member
Joined: 18 Jul 2007 Posts: 2146 Location: At my coffee table
|
|
|
|
Rounding 66 to 70 is inconsistent with rounding 64 to 64.
Did you mean 64 to 60? |
|
Back to top |
|
|
daveporcelan
Active Member
Joined: 01 Dec 2006 Posts: 792 Location: Pennsylvania
|
|
|
|
If you used 'rounded' then the result is rounded.
You rounded the 10th significant digit into the 9th.
So maybe .093989466 was .0939894664 (notice the 10th digit in Bold) This was rounded down.
It could have been .0939894656 in which case it was rounded up.
Leaving the lengths of the significant digits the same and wanting to change the values is simply not correct. |
|
Back to top |
|
|
dbzTHEdinosauer
Global Moderator
Joined: 20 Oct 2006 Posts: 6966 Location: porcelain throne
|
|
|
|
actually,
would it not be
66 to 7
and
64 to 6
???? |
|
Back to top |
|
|
daveporcelan
Active Member
Joined: 01 Dec 2006 Posts: 792 Location: Pennsylvania
|
|
|
|
It depends, in my example I described 10 digits to 9.
Your example would be for 9 digits to 8.
The OP has to tell us how many digits the end result should be.
My point is that if the end result should be 9 digits, and they used the rounded parameter, then they results are already correct.
I believe that they are try to perform additional rounding in their mind rather than trusting the computer to do its job. |
|
Back to top |
|
|
dbzTHEdinosauer
Global Moderator
Joined: 20 Oct 2006 Posts: 6966 Location: porcelain throne
|
|
|
|
Quote: |
I believe that they are try to perform additional rounding in their mind rather than trusting the computer to do its job. |
yes dave, I agree,
this is a typical
'i want this'
regardless of how COBOL works. |
|
Back to top |
|
|
Anuj Dhawan
Superior Member
Joined: 22 Apr 2006 Posts: 6250 Location: Mumbai, India
|
|
|
|
I'd say even if don't consider how COBOL does it, if one has used 'ROUNDED' then the result is rounded and that's just simple math. Whoever have "invented" "rounded" for COBOL must have used the basic math to write the underline-routine of "ROUNDED" and it won't give what you (vinuk2009) expect.
Probably, You (vinuk2009) just don't want to round off the digits - instead you need something totally different. If so, you should have used some other word to describe what you want in your subject line instead of the word "rounded"; with which we assume that you want what Dave has shown. |
|
Back to top |
|
|
Anuj Dhawan
Superior Member
Joined: 22 Apr 2006 Posts: 6250 Location: Mumbai, India
|
|
|
|
Also, please answer what CG has pointed to - answer for that will make your problem better explained. |
|
Back to top |
|
|
|