On 26/03/2015 12:35, Svein Erling Tysvær svein.erling.tysv...@kreftregisteret.no [firebird-support] wrote:

Here, I find that

SELECT CAST(123456789.12345678 as decimal) FROM RDB$DATABASE

succeeds, whereas

SELECT CAST(123456789.123456789 as decimal) FROM RDB$DATABASE

fails. I don't know why.

Once Upon A Time there was a language called Algol68 whose designers appeared to be keen to get all that sort of thing absolutely right, according to a careful reading of the "transput" specs ("I/O" was considered an old-fashioned term).

The conclusion one had to come to was that the only way to get the conversion of numbers between binary and decimal digit representation right was to do all the work (not terribly quickly, to be sure) as arbitrary length string manipulation, with only a very /very/ carefully designed conversion to binary form, from a carefully designed canonical string representation, as the last stage of a potentially long and complex sequence of operations.

I've never seen anyone go to remotely as much trouble to get this stuff right since then. I can't, however, see such an approach having a problem with the example above.

--
Tim Ward

  • ... liviuslivius liviusliv...@poczta.onet.pl [firebird-support]
    • ... Svein Erling Tysvær svein.erling.tysv...@kreftregisteret.no [firebird-support]
      • ... Rand Random rand.ran...@outlook.com [firebird-support]
    • ... Mark Rotteveel m...@lawinegevaar.nl [firebird-support]
    • ... liviuslivius liviusliv...@poczta.onet.pl [firebird-support]
      • ... Svein Erling Tysvær svein.erling.tysv...@kreftregisteret.no [firebird-support]
        • ... Tim Ward t...@telensa.com [firebird-support]

Reply via email to