Ok, so here is my solution. It takes advantage of the optional arguments for STR and is definitely not pretty, but it works. Really, string manipulation (which this is) should be done at a higher level.
DECLARE @Test TABLE (FloatValue FLOAT(53) NOT NULL);
INSERT INTO @Test (FloatValue)
VALUES (10)
, (.302563)
, (423546532)
, (34532.46524556)
, (654.048);
WITH CTE_Base
AS
( SELECT FloatValue
, StrValue = REPLACE(LTRIM(RTRIM(STR(FloatValue, 50, 5))), '.00000', '')
, DecPosition = CHARINDEX('.', REPLACE(LTRIM(RTRIM(STR(FloatValue, 50, 5))), '.00000', ''))
, Reversed = REVERSE(REPLACE(LTRIM(RTRIM(STR(FloatValue, 50, 5))), '.00000', ''))
, LastNonZeroPos = PATINDEX(
'%[^0]%', REVERSE(REPLACE(LTRIM(RTRIM(STR(FloatValue, 50, 5))), '.00000', '')))
FROM @Test)
SELECT *
, FinalValue = SUBSTRING(StrValue
, 1
, CASE WHEN DecPosition = 0
THEN LEN(StrValue)
ELSE LEN(StrValue) - LastNonZeroPos + 1
END)
FROM CTE_Base;