How about this?

X = 2596 * 8.333     ;*  [X will contain 21632.468]
ANS = INT((X * 100) + .5) / 100
PRINT ANS


The (X * 100) changes X to 2163246.8
The + .5 changes X to 2163247.3
The INT() changes X to 2163247
The / 100 changes X to 21632.47    

The output will displays 21632.47

Using a FOR NEXT loop, I run INT((21632.468 * 100) + .5) / 100 and 
the OCONV(21632.468,'MR20') versions one million times and got .84 seconds for 
the INT version and 4.9 seconds for the OCONV version.

I doubt that 4 seconds would make a difference to most programs but every 
little 
helps.

I also run the OCONV(ICONV(21632.468,'MD2'),'MD2') version and it took 5.1 
seconds.

My point: There is more than one way to skin a cat!

Don Robinson


 



________________________________
From: Chris Austin <cjausti...@hotmail.com>
To: u2-users@listserver.u2ug.org
Sent: Thu, October 14, 2010 12:34:36 PM
Subject: Re: [U2] how to round to 2 decimals?


Are you sure DROUND() is a UniVerse function?

When I do the following code:

X = 2596 * 8.333
*
PRINT DROUND(X,2)

I get the following error:

"Array 'DROUND' never dimensioned."


> From: lar...@wcs-corp.com
> To: u2-users@listserver.u2ug.org
> Date: Thu, 14 Oct 2010 09:25:23 -0700
> Subject: Re: [U2] how to round to 2 decimals?
> 
> What's so difficult about ANS = DROUND(N1 * N2, 2) ?
> 
> 
> -----Original Message-----
> From: u2-users-boun...@listserver.u2ug.org
> [mailto:u2-users-boun...@listserver.u2ug.org] On Behalf Of John Woollam
> Sent: Thursday, October 14, 2010 8:59 AM
> To: U2 Users List
> Subject: Re: [U2] how to round to 2 decimals?
> 
> Hi
> 
> Never heard of the DROUND() function in Universe.
> 
> Anyway, why would I want to use a function syntax when I can do
> 
> ANS = N1 * N2 'R2' and it is the answer that gets rounded?
> Easy to write.
> Easy to read...
> 
> John Woollam  |  Group Function Support 1  (Finance Systems)  |  Travis
> Perkins PLC  |  01604 682751
> 
> -----Original Message-----
> From: u2-users-boun...@listserver.u2ug.org
> [mailto:u2-users-boun...@listserver.u2ug.org] On Behalf Of Larry Hiscock
> Sent: 14 October 2010 16:49
> To: 'U2 Users List'
> Subject: Re: [U2] how to round to 2 decimals?
> 
> Does UniVerse not support the DROUND() function?  
> 
> -----Original Message-----
> From: u2-users-boun...@listserver.u2ug.org
> [mailto:u2-users-boun...@listserver.u2ug.org] On Behalf Of John Woollam
> Sent: Thursday, October 14, 2010 1:02 AM
> To: U2 Users List
> Subject: Re: [U2] how to round to 2 decimals?
> 
> Hi
> 
> I've always used 'R2'
> 
> e.g. ANS = N1 * N2 'R2'
> 
> No scaling, just rounding
> 
> Regards
> 
> John Woollam  |  Group Function Support 1  (Finance Systems)  |  Travis
> Perkins PLC  |  01604 682751
> -----Original Message-----
> From: u2-users-boun...@listserver.u2ug.org
> [mailto:u2-users-boun...@listserver.u2ug.org] On Behalf Of Chris Austin
> Sent: 13 October 2010 22:22
> To: u2-users@listserver.u2ug.org
> Subject: [U2] how to round to 2 decimals?
> 
> 
> I'm trying to figure out how to round to 2 decimal places with a
> floating point in UniVerse
> 
> For example 2596 x 8.333 = 21,632.468
> 
> How would you round that in UniVerse to 21,632.47?
> 
> Thanks!
>                          
> _______________________________________________
> U2-Users mailing list
> U2-Users@listserver.u2ug.org
> http://listserver.u2ug.org/mailman/listinfo/u2-users
> 
> <html>
> <head>
> <meta http-equiv="Content-type" content="text/html; charset=UTF-8">
> </head>
> <body>
> <P style="MARGIN-TOP: 0pt; MARGIN-BOTTOM: 0pt"><SPAN 
> style="FONT-SIZE: 8.2pt; FONT-FAMILY: 'MS Sans Serif'">This e-mail and
> any 
> attachments are confidential and intended solely for the use of the
> addressee 
> only. If you have received this message in error, you must not copy,
> distribute 
> or disclose the contents; please notify the sender immediately and
> delete
> the 
> message. </SPAN></P>
> <P style="MARGIN-TOP: 0pt; MARGIN-BOTTOM: 0pt"><SPAN 
> style="FONT-SIZE: 8.2pt; FONT-FAMILY: 'MS Sans Serif'">This message is 
> attributed to the sender and may not necessarily reflect the view of
> Travis 
> Perkins plc or its subsidiaries (Travis Perkins). Agreements binding
> Travis 
> Perkins may not be concluded by means of e-mail communication.
> </SPAN></P>
> <P style="MARGIN-TOP: 0pt; MARGIN-BOTTOM: 0pt"><SPAN 
> style="FONT-SIZE: 8.2pt; FONT-FAMILY: 'MS Sans Serif'">E-mail
> transmissions
> are 
> not secure and Travis Perkins accepts no responsibility for changes made
> to
> this 
> message after it was sent. Whilst steps have been taken to ensure that
> this 
> message is virus free, Travis Perkins accepts no liability for infection
> and
> 
> recommends that you scan this e-mail and any attachments. </SPAN></P>
> <P style="MARGIN-TOP: 0pt; MARGIN-BOTTOM: 0pt"><SPAN 
> style="FONT-SIZE: 8.2pt; FONT-FAMILY: 'MS Sans Serif'">Part of Travis
> Perkins 
> plc. Registered Office: Lodge Way House, Lodge Way, Harlestone Road, 
> Northampton, NN5 7UG. </SPAN></P>
> </BODY>
> </HTML>
> 
> _______________________________________________
> U2-Users mailing list
> U2-Users@listserver.u2ug.org
> http://listserver.u2ug.org/mailman/listinfo/u2-users
> 
> _______________________________________________
> U2-Users mailing list
> U2-Users@listserver.u2ug.org
> http://listserver.u2ug.org/mailman/listinfo/u2-users
> 
> <html>
> <head>
> <meta http-equiv="Content-type" content="text/html; charset=UTF-8">
> </head>
> <body>
> <P style="MARGIN-TOP: 0pt; MARGIN-BOTTOM: 0pt"><SPAN 
> style="FONT-SIZE: 8.2pt; FONT-FAMILY: 'MS Sans Serif'">This e-mail and any 
> attachments are confidential and intended solely for the use of the
> addressee 
> only. If you have received this message in error, you must not copy,
> distribute 
> or disclose the contents; please notify the sender immediately and delete
> the 
> message. </SPAN></P>
> <P style="MARGIN-TOP: 0pt; MARGIN-BOTTOM: 0pt"><SPAN 
> style="FONT-SIZE: 8.2pt; FONT-FAMILY: 'MS Sans Serif'">This message is 
> attributed to the sender and may not necessarily reflect the view of Travis 
> Perkins plc or its subsidiaries (Travis Perkins). Agreements binding Travis 
> Perkins may not be concluded by means of e-mail communication. </SPAN></P>
> <P style="MARGIN-TOP: 0pt; MARGIN-BOTTOM: 0pt"><SPAN 
> style="FONT-SIZE: 8.2pt; FONT-FAMILY: 'MS Sans Serif'">E-mail transmissions
> are 
> not secure and Travis Perkins accepts no responsibility for changes made to
> this 
> message after it was sent. Whilst steps have been taken to ensure that this 
> message is virus free, Travis Perkins accepts no liability for infection and
> 
> recommends that you scan this e-mail and any attachments. </SPAN></P>
> <P style="MARGIN-TOP: 0pt; MARGIN-BOTTOM: 0pt"><SPAN 
> style="FONT-SIZE: 8.2pt; FONT-FAMILY: 'MS Sans Serif'">Part of Travis
> Perkins 
> plc. Registered Office: Lodge Way House, Lodge Way, Harlestone Road, 
> Northampton, NN5 7UG. </SPAN></P>
> </BODY>
> </HTML>
> 
> _______________________________________________
> U2-Users mailing list
> U2-Users@listserver.u2ug.org
> http://listserver.u2ug.org/mailman/listinfo/u2-users
> 
> _______________________________________________
> U2-Users mailing list
> U2-Users@listserver.u2ug.org
> http://listserver.u2ug.org/mailman/listinfo/u2-users
                        
_______________________________________________
U2-Users mailing list
U2-Users@listserver.u2ug.org
http://listserver.u2ug.org/mailman/listinfo/u2-users
_______________________________________________
U2-Users mailing list
U2-Users@listserver.u2ug.org
http://listserver.u2ug.org/mailman/listinfo/u2-users

Reply via email to