Format function  is implemented in SbxValue::Format . It has two sections, first of which uses SvNumberFormatter, and the second uses home-grown SbxBasicFormater. The latter handles non-numeric input, such as strings, Nulls, etc., and also special Basic string formats like "Standard" or "ttttt". (Note that the first section also handles some special formats, like "<" or "General Date".)
Also the latter function handles potential numeric string cases which couldn't be converted to number using SvNumberFormatter::IsNumberFormat, but succeeded using ScanNumIntnl.
This makes the implementation buggy, inconsistent, and over-engineered. The task is to unify special format string handling in the beginning of the implementation, then process Null values, check if string should be converted to number (analyzing the type of format string using SvNumberFormatter facilities) and if it can be converted, and then use the normal SvNumberFormatter processing.
The implementation should drop the special processing of "@" format character used to indicate insertion of thousand separators (used currently when processing "Standard" format) and non-standard string formatting characters '!' and '\' (see bug 143183 comment 2).
The fix must include an extensive unit test.