Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations IamaSherpa on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Rounding 1

Status
Not open for further replies.

kaeserea

Programmer
Feb 26, 2003
164
DE
Hello!

There's the ROUND function which however is not available on our system (it's only available on certain systems). I was then looking for another way to round a D12.2 format to a I12 format with correct rounding (not truncating the two decimals).

In the manual I found this:
"When a value with decimal places is assigned to an integer field, the value is rounded before it is stored. If the value is assigned via a DEFINE or COMPUTE command, the decimal portion of the value is truncated before it is stored."

I wonder about the first sentence. How is this possible without using DEFINE or COMPUTE? Does anyone know?

Thnax for help!
Eva
 
Have you tried using an intermediate D12 (or P12) field?
e.g.
FLD1/D12.2 = value with 2 decimal places;
FLD2/D12 = FLD1; (Or FLD2/P12 = FLD1)
INT1/I12 = FLD2;
D and P fields behave slightly differently when it comes
to rounding; In this case, D might be better.

Peter.
 
Hello Peter,

thanks a lot. I now use the P format. Works fine!

Eva
 
Eva,

The first sentence refers to data entry. Putting the value 1.6 into an I3 field, stores the value as 1.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top