News:

Masm32 SDK description, downloads and other helpful links
Message to All Guests
NB: Posting URL's See here: Posted URL Change

Main Menu

Converting string to real8

Started by RuiLoureiro, May 10, 2013, 08:52:56 PM

Previous topic - Next topic

RuiLoureiro

Hi
    Here we have 2 ASM procedures to convert
    a null terminated string to real8:

        1. ConvertString8D:

           - convert integer part to a qword
           - convert decimal part to a qword
           - convert the exponent to a dword

             than load it and compute the real8

        2. ConvertString8BR

           - get the integer part to a BCD - 10 bytes
           - get the decimal part to a BCD - 10 bytes
           - convert the exponent to a dword

             than load the BCD values and compute
             the real8

    The strings may have spaces like this:

            "+000000 012 34.56 7 E + 000012"

    The procedures are in the include file Convert8D.inc
    and the we need to include PowerTable.inc also.

    We have also Convert8DRD to convert from real8
    to string used in the test files.   
   
    We can test using TestString8_D.asm and TestString8_BR.asm.

    All those files are in Convert8S folder.

    EDIT: Please after your tests,
                 remove these prints:
   _error:    
      ;print str$(eax)," ERROR eax-ConvertString8D",13,10
        _error:   
    ;print str$(eax)," ERROR eax-ConvertString8BR",13,10

           ___I would like to know your tests, if you dont mind___

  note: see also converting string to real4

  note 2: i found a bug in the file Convert8DRD to convert real8 to string
              so i removed the old
Quote
***** Time table *****

Intel(R) Pentium(R) 4 CPU 3.40GHz (SSE3)

538  cycles, ConvertString8Y0, direct, no spaces
550  cycles, ConvertString8D, direct, spaces
562  cycles, ConvertString8Y, direct
572  cycles, ConvertString8DF, direct
762  cycles, ConvertString8BS, BCD, no spaces
776  cycles, ConvertString8BR, BCD, spaces
899  cycles, ConvertString8BW, BCD
941  cycles, ConvertString8BF, BCD
1041  cycles, ConvertString8BY, BCD
1116  cycles, ConvertString8BZ, BCD
3188  cycles, ConvertString8B, BCD, save FPU
3248  cycles, ConvertString8BX, BCD, save FPU
********** END **********

Gunther

Hi RuiLoureiro,

here are my results:
Quote
399 cycles, ConvertString8, _RclStr07

683 cycles, ConvertString8BX, _RclStr07

373 cycles, ConvertString8BZ, _RclStr07

674 cycles, ConvertString8BY, _RclStr07

357 cycles, ConvertString8BF, _RclStr07

339 cycles, ConvertString8BW, _RclStr07

164 cycles, ConvertString8Y, _RclStr07

170 cycles, ConvertString8D, _RclStr07

174 cycles, ConvertString8DF, _RclStr07

324 cycles, ConvertString8BR, _RclStr07

302 cycles, ConvertString8BS, _RclStr07

160 cycles, ConvertString8Y0, _RclStr07

*** STOP and END ***

***** Time table *****

Intel(R) Core(TM) i7-3770 CPU @ 3.40GHz (SSE4)

160  cycles, ConvertString8Y0, direct, no spaces
164  cycles, ConvertString8Y, direct
170  cycles, ConvertString8D, direct, spaces
174  cycles, ConvertString8DF, direct
302  cycles, ConvertString8BS, BCD, no spaces
324  cycles, ConvertString8BR, BCD, spaces
339  cycles, ConvertString8BW, BCD
357  cycles, ConvertString8BF, BCD
373  cycles, ConvertString8BY, BCD
399  cycles, ConvertString8BZ, BCD
674  cycles, ConvertString8B, BCD, save FPU
683  cycles, ConvertString8BX, BCD, save FPU
********** END **********

Gunther
You have to know the facts before you can distort them.

RuiLoureiro

i attached a new folder because
the old had a bug in one proc
to convert real8 to string.