News:

Masm32 SDK description, downloads and other helpful links
Message to All Guests

Main Menu

REAL128

Started by mabdelouahab, May 09, 2016, 08:34:30 AM

Previous topic - Next topic

mabdelouahab

How can we deal with this kind of numbers (with masm32) :dazzled:
It's not REAL10, but

     Real12 (decimal :-7.9 x 10+28 to 7.9 x 10+28) / (10+0 to+ 28)
     Real16 (Float:-3.4 × 10+38to +3.4 × 10+38)
     Real128(double:±5.0 × 10−324 to ±1.7 × 10+308)

I think there is a way but I don't know it.

qWord

Quote from: mabdelouahab on May 09, 2016, 08:34:30 AM
How can we deal with this kind of numbers (with masm32)
By writing a library that handles the wished operations for that type. Because its and decimal format (±m⋅10-e with 0≤m<296 and 0≤e≤28), conversion from- and to string are simple. Addition, subtraction, multiplication and division might be more or less tricky...
MREAL macros - when you need floating point arithmetic while assembling!

mabdelouahab

I was wrong :P, because I have not read well,the Decimal is largest build-in numeric type, 96-bit integer number
(-1)^sign*(hi32*2^64+mid32*2^32+lo32)/10^scale
DECIMAL STRUCT            ; VT_DECIMAL
        wReserved  SWORD  ?         ;   =14 (VT_DECIMAL)
        UNION
          signscale  SWORD  ?
          STRUCT                 
            scale      BYTE   ?      ;  Power of 10
            sign       BYTE   ?      ;  FALSE/TRUE (0,-1)
          ENDS
        ENDS
        Hi32       SDWORD  ?
        UNION
          Lo64       QWORD  ?
          STRUCT                 
            Lo32       SDWORD   ?
            Mid32      SDWORD   ?
          ENDS
        ends
DECIMAL  ENDS


QuoteThe decimal keyword indicates a 128-bit data type. Compared to floating-point types
...
28-29 significant digits

Because float   is just REAL4
QuoteThe float keyword signifies a simple type that stores 32-bit floating-point values
...
7 digits

And Double is REAL8
QuoteThe double keyword signifies a simple type that stores 64-bit floating-point values.
...
15-16 digits