• Just to jazz things up ... I have refactored the code to make it work on another SQL dialect as follows ...

    DECLARE @n1 DECIMAL(38,20)

    , @n2 DECIMAL(38,20)

    , @n3 REAL

    , @n4 REAL

    , @n5 DOUBLE PRECISION

    , @n6 DOUBLE PRECISION

    SELECT @n1 = 123.4567

    , @n2 = 0.001

    SELECT @n3 = @n1

    , @n4 = @n2

    , @n5 = @n1

    , @n6 = @n2

    SELECT n_decimal = CONVERT(VARCHAR, @n1 * @n2)

    , n_real = CONVERT(VARCHAR, @n3 * @n4)

    , n_double = CONVERT(VARCHAR, @n5 * @n6)

    GO

    .... which produces ....

    (1 row affected)

    (1 row affected)

    n_decimal n_real n_double

    ------------------------------ ------------------------------ ------------------------------

    0.1234567000000000000000000000 .12345670908689499 .1234567

    (1 row affected)

    ... which is what I expected and suggests that a competent solution is possible if you care enough!

    FWIW if I get a chance I will run it on some other (mainstream) platforms at hand.