Stephen, Polychronis and Javier... As you can tell, this is not a scientific pursuit but a penny a mile does make a difference to truckers so, on their behalf, I thank you all for helping me to calculate this right.
As always, the list comes through for me! Have a great day, you've made mine! Claudine :) > -----Original Message----- > From: [email protected] [mailto:[EMAIL PROTECTED] On Behalf Of ELOEN > Sent: Tuesday, June 07, 2005 5:19 AM > To: RBG7-L Mailing List > Subject: [RBG7-L] - RE: Rounding Puzzler > > Stephen, > > Note however that for a value like 2.20 gives 2.25 (should be 2.20) > How about vresponse = > (IFEQ(.vx,(INT(.vx*100)/100),.vx,((INT(.vx*100)+5)/100)) > > There is no need for including the value of 1.40 as it is always devided > by > 0.05 > > Polychronis > > > -----Original Message----- > From: [email protected] [mailto:[EMAIL PROTECTED] On Behalf Of Stephen > Markson > Sent: Tuesday, June 07, 2005 7:49 AM > To: RBG7-L Mailing List > Subject: [RBG7-L] - RE: Rounding Puzzler > > Try this: > > SET VAR vrate = ((INT(20*.vresponse)-27)/100) > SET VAR vresponse = (.vrate*5+1.4) > > Should work every time. > > > Regards, > > Stephen Markson > ForenSys The Forensic Systems Group > www.ForenSys.ca > 416 512 6950 > > > -----Original Message----- > > From: [email protected] [mailto:[EMAIL PROTECTED] On Behalf Of Claudine > > Robbins > > Sent: June 7, 2005 12:16 AM > > To: RBG7-L Mailing List > > Subject: [RBG7-L] - Rounding Puzzler > > > > > > I know there is a brainiac out there who knows the answer. It eludes > > me... > > > > I get numbers, such as 2.209; 2.170, etc... > > > > I need to round them to the next number which, after subtracting 1.40 is > > evenly divisible by 5, i.e. 2.209 would round to 2.25 (vrate should be > > .17). 2.170 correctly rounds to 2.20 (vrate is .16). > > > > This is what I have so far, but as you can see, it doesn't work > > reliably: > > > > SET VAR VBASE = 1.40 > > SET VAR VRESPONSE = 2.209 > > SET VAR vmod = (MOD(.vresponse,.05)) > > IF vmod > 0 THEN > > SET VAR vresponse = (ROUND(.vresponse,1)) > > ENDIF > > SET VAR vrate = ((.vresponse - .vbase)/5) > > Show var vrate yields .16 should be .17 > > > > With vresponse = 2.170, vrate is correctly .16 > > > > TIA, > > > > Claudine :)
