On Jan 19, 2006, at 10:33 PM, Barrie Jones wrote:

Thanks for the examples Erick and John.
format(123 , "###.###") = 123. (prints a decimal point)
So..... is the solution as John suggested?
Test for a fractional number and select the appropriate format.
It's hard to believe that RB does not have a more elegant solution.
Thanks for all the fast replies.
Barrie


Unfortunately, yes, although the test may only need to check for the presence of a decimal point in the passed number in the situations that I'm involved with. This has come up before on the lists, so you may count yourself among those of us number crunchers who would appreciate not having to check and select.

The trailing decimal point insertion isn't a trivial nor ignorable issue when dealing with large arrays of user specified numerical data in scientific/engineering applications. There is a difference between user specified values of '24500' and '24500.' in terms of the significant digits of measured values. This needs to be retained in outputs.

The tests are simple enough, but when processing large arrays of user specified numerical data in loops one would like to do as little preprocessing as possible.

The trailing zero insertion problem was submitted to Feedback a while back when Feedback distinquished between bugs and feature requests. RS responded that it was not a bug, and that it was consistent with VisualBasic. This is fair enough, although VB.NET does not insert a trailing zero.

I fumbled my way through the Feedback edit process and amended the report to ask RS to add an optional template to Format() that we can use to specify that Rb not add a trailing decimal point. In other words:

s = Format(345,"#.# with some optional template designator" ) would return 345 rather than 345.

The Feedback ID is ynktrdlo. Anyone who processes numbers in Rb should consider signing on.

Best,

Jack



_______________________________________________
Unsubscribe or switch delivery mode:
<http://www.realsoftware.com/support/listmanager/>

Search the archives of this list here:
<http://support.realsoftware.com/listarchives/lists.html>

Reply via email to