Printing a page range

This does not work:

if g.LastPage = -1 then tFirstPage = 1 tLastPage = pNumOfPages else tFirstPage = g.FirstPage tLastPage = g.LastPage end if

This does work:

if g.LastPage = 2147483647 then tFirstPage = 1 tLastPage = pNumOfPages else tFirstPage = g.FirstPage tLastPage = g.LastPage end if

I did not say that -1 would work… I just said that that big # was the 1’s complement of -1

tfirstpage=max(1,g.firstpage)
tlastpage=min(pnumofpages,g.lastpage)

much simpler

The 1’s complement of -1 is 1. :slight_smile: For a 32 bit signed word using one’s complement, -1 shown as an uint32 should be 4294967294 (FFFFFFFE, negative 1, and it’s 1’s complement is 00000001). 2147483647 is 7FFFFFFF, the highest positive number for a 32 bit signed integer signed as 2’s complement (FFFFFFFF striped the sign bit). You got confused with 2’s complement and high non-negative or I misunderstood something. :slight_smile:

I do not agree.