PxPlus User Forum

Twitter Twitter Twitter

Author Topic: Hexadecimal to Decimal  (Read 700 times)

Breidy

  • New Member
  • *
  • Posts: 2
    • View Profile
Hexadecimal to Decimal
« on: September 10, 2021, 02:31:10 PM »
Hi everyone
I have a question

This formula returns me the decimal number

Excel
HEX2DEC ("8FCB455C") = 2412463452
HEX2DEC ("7FA2478E") = 2141341582

PxPlus
DEC (ATH ("8FCB455C") = -1882503844
DEC (ATH ("7FA2478E") = 2141341582

Why does pxplus return the decimal value of the first data differently?

Could someone guide me please

Mike King

  • Diamond Member
  • *****
  • Posts: 3810
  • Mike King
    • View Profile
    • BBSysco Consulting
Re: Hexadecimal to Decimal
« Reply #1 on: September 10, 2021, 03:03:16 PM »
As with most computer systems the top (first) bit indicates the sign of the value thus $8FCB455C$ would be a negative number.

If you want to force the value positive regardless of the number of bytes, prefix the value with $00$.

->print DEC (ATH ("008FCB455C") )
 2412463452
->print DEC ($00$ + ATH ("8FCB455C") )
 2412463452

Mike King
President - BBSysco Consulting
eMail: mike.king@bbsysco.com

Breidy

  • New Member
  • *
  • Posts: 2
    • View Profile
Re: Hexadecimal to Decimal
« Reply #2 on: September 10, 2021, 03:23:23 PM »
Excellent, thank you very much Mike