No, mine does no padding. It's a very simple loop which just chops off the last character if there are more than six characters after the decimal point. Come to think of it, you could probably replace it with a chop() command:
old: until (length($a) - index($a, '.') < 8){ $a = substr($a, 0, (length($a)-1)) } new: until (length($a) - index($a, '.') < 8){ chop $a; } Yep, it works! ;o) I like it this way for readability, but you could also make it one line: until (length($a) - index($a, '.') < 8){chop $a;} Shawn prabhakn77@yahoo .com To: [EMAIL PROTECTED] cc: 10/22/2002 03:36 bcc: PM Subject: Re: truncation of decimal places. I think what I need is numbers with less than 6 decimals should be left as it is. Does your solution pad them with zeroes.thanks naveen [EMAIL PROTECTED] wrote: I neglected to ask: You did not mention what you would like done to a number with less than six decimal places. Do you want them padded with zeroes? I was in too much of a hurry to be the one helping someone else, rather than asking for help, that I fired this script right off as soon as I could test it. ;o) Shawn shawn_milochik@god ivachoc.com To: [EMAIL PROTECTED] cc: [EMAIL PROTECTED] 10/22/2002 02:41 bcc: PM Subject: Re: truncation of decimal places. Perhaps this is really clumsy, but maybe this will help. If not, the others on the list will fix us right up. until (length($a) - index($a, '.') < 8){ $a = substr($a, 0, (length($a)-1)) } Shawn prabhakn77@yahoo .com To: [EMAIL PROTECTED] cc: 10/22/2002 02:15 bcc: PM Subject: truncation of decimal places. Hi, I have a really simple question.I have two numbers say $a = 1.559999 $b=1.5599999999 how do I compare them to exactly 6 decimals without doing a round off.I used sprintf but it does a round off. thank you. --------------------------------- Do you Yahoo!? Y! Web Hosting - Let the expert host your web site ********************************************************************** This e-mail and any files transmitted with it may contain confidential information and is intended solely for use by the individual to whom it is addressed. If you received this e-mail in error, please notify the sender, do not disclose its contents to others and delete it from your system. ********************************************************************** -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] Do you Yahoo!? Y! Web Hosting - Let the expert host your web site -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]