Re: IBM2435I on ROUND(x,-3)
- From: Peter Flass <Peter_Flass@xxxxxxxxx>
- Date: Thu, 22 Dec 2011 08:05:52 -0500
You don't say what compiler and platform, but possible it's due to the conversion of the character constant.
<quote>
The constant has base, scale, mode, and precision attributes. It converts to the attributes of the target when they are independent of the source attributes, as in the case of assignment. See the specific target types of coded arithmetic data using the attributes of the constant as the source.
If an intermediate result is necessary, as in evaluation of an operational expression, the attributes of the intermediate result are the same as if a decimal fixed-point value of precision (N,0) had appeared in place of the string. (This allows the compiler to generate code to handle all cases, regardless of the attributes of the contained constant.) Consequently, any fractional portion of the constant might be lost.
</quote>
http://publibfp.boulder.ibm.com/cgi-bin/bookmgr/BOOKS/c1472851/5.6?DT=20110908013800
On 12/22/2011 2:37 AM, Robin Vowels wrote:
Hi,
I'm puzzled about the following conversion via ROUND.
Any ideas?
_________________
test: procedure options (main);
declare d fixed (10,5);
d = '1234.567';
put skip data (d);
d = round('1234.567', 2);
put skip data (d);
end test;
Output:
D= 1234.56700;
D= 1234.00000;
.
- Follow-Ups:
- Re: IBM2435I on ROUND(x,-3)
- From: Robin Vowels
- Re: IBM2435I on ROUND(x,-3)
- From: glen herrmannsfeldt
- Re: IBM2435I on ROUND(x,-3)
- References:
- IBM2435I on ROUND(x,-3) by RULES(NOLAXSCALE)
- From: Robin Vowels
- Re: IBM2435I on ROUND(x,-3)
- From: Robin Vowels
- IBM2435I on ROUND(x,-3) by RULES(NOLAXSCALE)
- Prev by Date: Re: IBM2435I on ROUND(x,-3)
- Next by Date: Re: IBM2435I on ROUND(x,-3)
- Previous by thread: Re: IBM2435I on ROUND(x,-3)
- Next by thread: Re: IBM2435I on ROUND(x,-3)
- Index(es):
Relevant Pages
|