[Date Prev][Date Next][Thread Prev][Thread Next]
[Author Index]
[Date Index]
[Thread Index]
[SQR-USERS Info]
[SQRUG Home Page]
RE: [sqr-users] Rounding up to the nearest 1000 in SQR
10400 - 1000 + 400 = 9800 ...
after the "Else" should be:
Let #rounded_value = #your_value - #remainder
10000 = 10400 - 400
> -----Original Message-----
> From: Patel, Samir [SMTP:SPatel@FDIC.gov]
> Sent: Wednesday, July 30, 2003 2:29 PM
> To: 'sqr-users@sqrug.org'
> Subject: RE: [sqr-users] Rounding up to the nearest 1000 in SQR
>
> Oops, made a typo
>
> Example 2:
> ----------
> Your value = 10400
> Rounded = 10400 - 1000 + 400 = 10000
>
> -----Original Message-----
> From: Patel, Samir
> Sent: Wednesday, July 30, 2003 2:22 PM
> To: 'sqr-users@sqrug.org'
> Subject: RE: [sqr-users] Rounding up to the nearest 1000 in SQR
>
> Jacquelin,
>
> The following MAY not be the best way to accomplish what you want, but it
> just might work for you.
>
> There is a SQR function which will give you the remainder when dividing 2
> numbers. Unfortunately, I cannot recall what the function is, but you can
> look it up in a reference book (or someone in the group will know). In
> your
> case, you are dividing by 1000.
>
> If #remainder >= 500
> Let #rounded_value = #your_value + 1000 - #remainder
> Else
> Let #rounded_value = #your_value - 1000 + #remainder
> End-If
>
> Example 1:
> ----------
> Your value = 10600
> Rounded = 10600 + 1000 - 600 = 11000
>
> Example 2:
> ----------
> Your value = 10400
> Rounded = 10400 - 1000 + 600 = 10000
>
> Hope that helps,
> Samir
>
>
> -----Original Message-----
> From: Turner, Ivan [mailto:Ivan.Turner@qwest.com]
> Sent: Wednesday, July 30, 2003 12:30 PM
> To: 'sqr-users@sqrug.org'
> Subject: RE: [sqr-users] Rounding up to the nearest 1000 in SQR
>
> Richard,Knapp,
> Rounding rounds to the nearest integer or to a specified number of
> decimal places. Adding 500 won't work.
>
> -----Original Message-----
> From: Knapp, Richard [mailto:KnappR@umsystem.edu]
> Sent: Wednesday, July 30, 2003 12:08 PM
> To: sqr-users@sqrug.org
> Subject: RE: [sqr-users] Rounding up to the nearest 1000 in SQR
>
>
>
> Or... you could add 500 and round.
>
> Richard Knapp
> Database Programmer/Analyst
> Institutional Research and Planning
> University of Missouri System
> 573-882-8856
> knappr@umsystem.edu
>
>
> -----Original Message-----
> From: George Jansen [mailto:GJANSEN@aflcio.org]
> Sent: Wednesday, July 30, 2003 9:28 AM
> To: sqr-users@sqrug.org
> Subject: Re: [sqr-users] Rounding up to the nearest 1000 in SQR
>
>
> Oracle will let you round to an explicit number of places, positive for
> after the decimal, negative for before. But that's rounding, not
> rounding up. Pehaps the Ontko.com clan knows a cleaner way, but I'd use
> the ceil function:
>
> begin-setup
> declare-variable
> integer #y
> end-declare
> end-setup
>
> begin-procedure k-round(#raw, :#rounded)
> let #rounded = ceil(#raw/1000) * 1000
> end-procedure
>
>
> begin-program
>
> let #x = 950.00
> while #x < 1100
> do k-round(#x, #y)
> show #y
> let #x = #x + 50
> end-while
> end-program
>
> _______________________________________________
> sqr-users mailing list
> sqr-users@sqrug.org
> http://www.sqrug.org/mailman/listinfo/sqr-users
>
> _______________________________________________
> sqr-users mailing list
> sqr-users@sqrug.org
> http://www.sqrug.org/mailman/listinfo/sqr-users
>
> _______________________________________________
> sqr-users mailing list
> sqr-users@sqrug.org
> http://www.sqrug.org/mailman/listinfo/sqr-users
>
> _______________________________________________
> sqr-users mailing list
> sqr-users@sqrug.org
> http://www.sqrug.org/mailman/listinfo/sqr-users
>
_______________________________________________
sqr-users mailing list
sqr-users@sqrug.org
http://www.sqrug.org/mailman/listinfo/sqr-users