bowza
March 14th, 2001, 05:59 AM
Hello
Can anyone suggest a simple method to display numbers to a set number of significant figures in vb6?
Example (a) variable is 72.29115, I would like to display to 5 s.f. So variable becomes 72.291
Example (b) 125.8353 to 5 s.f. I would like 125.84
Ok simple enough to use trim and left 6. As these numbers in many instances are written to a text file, I need to format them, so "##.###" in some cases and "###.##" in others.
My question is, since I have many instances where this occurs is there a simple way to do this format other than a function, any ideas? I do need to keep this variable real for calculations
Thanks
bowza
Can anyone suggest a simple method to display numbers to a set number of significant figures in vb6?
Example (a) variable is 72.29115, I would like to display to 5 s.f. So variable becomes 72.291
Example (b) 125.8353 to 5 s.f. I would like 125.84
Ok simple enough to use trim and left 6. As these numbers in many instances are written to a text file, I need to format them, so "##.###" in some cases and "###.##" in others.
My question is, since I have many instances where this occurs is there a simple way to do this format other than a function, any ideas? I do need to keep this variable real for calculations
Thanks
bowza