The following warnings occurred:
Warning [2] Undefined array key 0 - Line: 1677 - File: showthread.php PHP 8.2.31 (Linux)
File Line Function
/inc/class_error.php 157 errorHandler->error
/showthread.php 1677 errorHandler->error_callback
/showthread.php 916 buildtree




Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Bug or Feature?
#4
LCD Wrote:
Code:
print at 17,0;(peek 3)*9
gives me back 247. Why is this a Problem? PEEK 3 is 255, so (PEEK 3)*9 should be calculated as 255*9=2295, so it looks like the result of this calculation is stored in UBYTE. No problem because PEEK gives back UBYTE, but a multiplication is a little bit more problematic.
Surely the solution is a cast?
Code:
print at 17,0;CAST(uInteger,(peek 3))*9

I haven't tried it, but that seems to me the logical way to kick it up to an integer over a byte type when it returns something smaller than you need?
Reply


Messages In This Thread

Forum Jump:


Users browsing this thread: 1 Guest(s)