Condition not respected problem

Just starting out? Need help? Post your questions and find answers here.
User avatar
le_magn
Enthusiast
Enthusiast
Posts: 289
Joined: Wed Aug 24, 2005 12:11 pm
Location: Italia

Condition not respected problem

Post by le_magn »

Hi all, I have a question, surely it will be something I miss, how come the first condition is executed as if the variable is greater than the compared number?

Code: Select all

StringSize.i = 1

If StringSize > 4278190079
  Debug "StringSize="+Str(StringSize)
  Debug "INSIDE"
EndIf

If StringSize > 10
  Debug "StringSize="+Str(StringSize)
  Debug "INSIDE2"
EndIf
Image
User avatar
STARGÅTE
Addict
Addict
Posts: 2260
Joined: Thu Jan 10, 2008 1:30 pm
Location: Germany, Glienicke
Contact:

Re: Condition not respected problem

Post by STARGÅTE »

If you compiler with x86 (32 bit) .i is only 32 bit large, and 4278190079 is converted to -16777217 during the comparison, to match the size.
If you want a 64 bit comparison, you have to use StringSize.q
PB 6.01 ― Win 10, 21H2 ― Ryzen 9 3900X, 32 GB ― NVIDIA GeForce RTX 3080 ― Vivaldi 6.0 ― www.unionbytes.de
Lizard - Script language for symbolic calculations and moreTypeface - Sprite-based font include/module
User avatar
le_magn
Enthusiast
Enthusiast
Posts: 289
Joined: Wed Aug 24, 2005 12:11 pm
Location: Italia

Re: Condition not respected problem

Post by le_magn »

STARGÅTE wrote: Tue May 21, 2024 10:36 pm If you compiler with x86 (32 bit) .i is only 32 bit large, and 4278190079 is converted to -16777217 during the comparison, to match the size.
If you want a 64 bit comparison, you have to use StringSize.q
Yes, you are right, x86 compiler, if i use .q it work, thank you.
Image
Post Reply