Skip to main content

Notifications

Finance | Project Operations, Human Resources, ...
Unanswered

str2int function returns incorrect value with minus sign

Posted on by 768

Hello guys,

I have some code where str2int function return incorrect value with minus sign. It doesn't match the parameter and also it adds "-" sign. What does that mean? I'm sure that it accepts the variable of the string type.

One of the examples:

str2int("2711838385");

it returns integer = -1583128911

never faced such things before.

  • Yuji Imaoka Profile Picture
    Yuji Imaoka on at
    RE: str2int function returns incorrect value with minus sign

    The customer uses str2int64 instead of str2int.

  • dark_knight Profile Picture
    dark_knight 768 on at
    RE: str2int function returns incorrect value with minus sign

    yes. figured it out by myself already. Thanks.

  • Community Member Profile Picture
    Community Member Microsoft Employee on at
    RE: str2int function returns incorrect value with minus sign

    Use str2int64 instead. 

    int is a 32 bit integer, with range of  -2,147,483,647 to 2,147,483,647. Your value is higher and the compiler do a overflow in the memory allocated.

  • dark_knight Profile Picture
    dark_knight 768 on at
    RE: str2int function returns incorrect value with minus sign

    resolved by myself. Sorry for disturbance.

  • dark_knight Profile Picture
    dark_knight 768 on at
    RE: str2int function returns incorrect value with minus sign

    I got that 2711838385 is too big for int but str2int64 doesn't help also. It proceeds to return minus value.

Under review

Thank you for your reply! To ensure a great experience for everyone, your content is awaiting approval by our Community Managers. Please check back later.

Helpful resources

Quick Links

December Spotlight Star - Muhammad Affan

Congratulations to a top community star!

Top 10 leaders for November!

Congratulations to our November super stars!

Community AMA December 12th

Join us as we continue to demystify the Dynamics 365 Contact Center

Leaderboard

#1
André Arnaud de Calavon Profile Picture

André Arnaud de Cal... 291,240 Super User 2024 Season 2

#2
Martin Dráb Profile Picture

Martin Dráb 230,149 Most Valuable Professional

#3
nmaenpaa Profile Picture

nmaenpaa 101,156

Leaderboard

Product updates

Dynamics 365 release plans