Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
I also have a question - about DefInt
#5
Shocked 
(08-16-2024, 11:43 PM)SMcNeill Wrote: Division by 0.

T1 isn't a shared variable.

Of course!!! [Image: shocked.png]

(08-16-2024, 11:45 PM)DSMan195276 Wrote: You're seeing the difference between `/` division and `\` division. Basically, "regular" division turns both arguments into floating-point (`DOUBLE`) values before doing the division, and the result is another floating-point value. If you pass the expression directly to `Print` then you'll be printing the resulting `DOUBLE` value.

If you instead do `t4 = t2 / t1`separately and pass `t4` to `Print` then you'll always see an integer. The assignment of the value to `t4` turns the value back into an integer value. Alternatively, you can Print `t2 \ t1`, which will do integer division. Integer division does not turn either value into a floating-point value and will give you an integer result.

Separately you get Inf because you're doing a divide-by-zero, the `t1` variable is not shared with the `Sub`.

Ah, got it; thanks.
Of all the places on Earth, and all the planets in the Universe, I'd rather live here (Perth, Western Australia.) Big Grin
Please visit my Website at: http://oldendayskids.blogspot.com/
Reply


Messages In This Thread
RE: I also have a question - about DefInt - by PhilOfPerth - 08-17-2024, 02:21 AM

Possibly Related Threads…
Thread Author Replies Views Last Post
  _Putimage Question. Pete 11 673 01-04-2026, 09:33 PM
Last Post: Pete
  Nice simple, I hope, question Mad Axeman 4 340 12-20-2025, 09:28 PM
Last Post: SMcNeill
  NewBie Question niteflyer 2 331 11-06-2025, 07:11 PM
Last Post: Petr
  A Question About _MAPTRIANGLE Magdha 2 376 11-02-2025, 11:37 AM
Last Post: Magdha
  '$include: 'file.tmr' Timing Question pmackay 2 430 10-16-2025, 12:20 PM
Last Post: a740g

Forum Jump:


Users browsing this thread: 1 Guest(s)