fbpx
Welcome, Guest
Username: Password: Remember me
  • Page:
  • 1

TOPIC: Add Dword to int (V.2.2.1 - Vulcan.Dialect)

Add Dword to int (V.2.2.1 - Vulcan.Dialect) 1 month 2 weeks ago #13221

  Thomas's Avatar Topic Author Thomas Offline Posts: 70
Hi all,

We have problems with some mathematical calculations.
If I add a dword to an integer (less than 0) and assign the result to a usual then I get an overflow.

    [Fact];  
    METHOD Test_CastUsualToInt() AS VOID STRICT

        LOCAL Number1           AS INT
        LOCAL Number2AsDword	AS DWORD
        LOCAL Number2AsInt      AS INT
        LOCAL Summe1            AS USUAL
        LOCAL Summe2            AS USUAL
        LOCAL Summe3            AS INT
        LOCAL Summe4            AS INT
        
        Number1 := -55
        Number2AsDword := 1
        Number2AsInt := 1
        Summe1 := Number1 + Number2AsDword   <==  Summe1 = {4294967242} (Float) ???
        Summe2 := Number1 + Number2AsInt
        Summe3 := Number1 + Number2AsDword
        Summe4 := Number1 + Number2AsInt
        
        Assert.Equal((int)Summe1, -54)      <== fails:  actual value -2147483648
        Assert.Equal((int)Summe2, -54)
        Assert.Equal(Summe3, -54)
        Assert.Equal(Summe4, -54)

Could you please check this.

Regards
Thomas

Please Log in or Create an account to join the conversation.

Add Dword to int (V.2.2.1 - Vulcan.Dialect) 1 month 2 weeks ago #13224

  Chris's Avatar Chris Away Posts: 1753
Thanks Thomas, problem is that the INT+DWORD operation results to a DWORD instead of IN, and this is incompatible to both VO and Vulcan. Will open a report about this.
XSharp Development Team
chris(at)xsharp.eu

Please Log in or Create an account to join the conversation.

  • Page:
  • 1