Let me see if I can explain this.
The \ operator returns the integer quotient, which drops the remainder. When divide by Zero, it returns infinity (PositiveInfinity (INF) or NegativeInfinity (_INF)), or NaN or -NaN (not a number) if expression2 is also zero. (I think that's right - I lost a lot of my math during the past 45 years!)
the / operator (which is used in most all division), returns the full quotient, which retains the remainder in the fractional portion as a decimal. When divide by Zero, it produces a Divide By Zero Exception.
They are both division, but perform two entirely different functions. And you can't mix operands either.
This explains the -NaN or the -INF you are getting. I have no idea where the "D" in your example is coming from.
However, for testing TRUE or FALSE, a -NaN or -INF is correctly interpreted as TRUE. It may not be a number or be infinite, but a condition is considered TRUE only of the result is negative.
K = 69
R = 1
x = ((K = 69) / (R > 1))
Above, x=-INF, but works when you do the IF x THEN ... It tests as TRUE
In the beginning of BASIC, logical or unary operations had to be done using the math operands. (Unlike C/C++, Python and other languages that have logical AND == and OR ! and NOT !=). The reason my example doesn't give a divide by zero error is because BASIC treats these as unary or binary logic functions, and not math constructs. This only applies to the regular / operand. I'm not sure about when the \ operand came into use, but in every program I have ever written, seen, etc. logical true/false tests was constructed like a formula. When you put () around the logical test, like R=68: PRINT (R=69), you get the result of the logical (IS 68=69) rather than R becoming 69 as in an assignment or LET statement.
Today, I can write the following and it works:
However, back in the 1960's through to the early 1980's, the only way in BASIC to write this was:
Both give you the same result = 0 or FALSE using the Truth Table.
So if I wanted to write a complex, logical algebraic truth test, I can use regular math operands, even today in QB64, and the interpreter back then (the compiler today) will see that not as a math formula, but a logic test. But you need to use the regular operands, not the \ operand, which works differently.
That is why when I do "IF (K=69) * (R>1)" what this does is ask: IS K=69 AND R>1. When I do "IF (K=69) / (R>1)" it asks: IS K=69 OR R>1.
Same with "IF (K=69) <> (R>1)" asks: is K=69 XOR R>1. See snippet:
' *** Same a P XOR Q in Truth Tables
K = 689
R = 1
PRINT (K
= 69) <> (R
> 1) ' *** I get 0 because 689=69 (FALSE) IS NOT OR 1>1 (FALSE) (The entire logic test passes as FALSE)
So especially in older programs, you see code like this (From a TI/99 BASIC program):
310 IF S=0 THEN 280
320 IF K=81 THEN 520
330 IF (K=69)*(R>1)THEN 390
340 IF (K=a3)*(C>3)THEN 410
350 IF (K=68)*(C<31)THEN 430
360 IF (K=88)* (R<22)THEN 453
Lines 310 & 320 are checking for actual values, where 330-360 are doing AND logic tests. (This code snippet is from a TI/99 BASIC program: MICRO SKETCH - A simple graphics program that allows you to move a block around the screen to draw a picture. The E, D, S, and X keys allow moving up, right, left, and down respectively. The T key will allow you to toggle between a block and a blinking block which can be used as an eraser. You will be able to draw any shape you desire on the screen). This part of the code checks to see if you are within the physical dimensions of the screen, from what I can tell.
K = 69
R = 1
Print (K
= 69) / (R
> 1);
"WTH???" 'Output>>> -INF D is weird!!!
'Compare to this
K = 69
R = 1
Print (K
= 69) \
(R
> 1) ' as expected comment out to try next line If (K
= 69) \
(R
> 1) Then Print "One is TRUE" Else Print "Neither are NOT TRUE" ' Div by zero as expected!
It's not printing "One is true" because one is true but because this "-INF D " <> 0.