Wish [B4X] Wishing for a integer division option

OliverA

Expert
Licensed User
Longtime User
This wish springs forth from these two threads:


It could be in the form of

5 DIV 3

or something like that. It would not break the backward compatibility of the existing way that B4X handles division (casting divisor to double) and yet provide an option for proper integer division for people that need the most speed from such (without casting back and forth between double and int) and for people that expect integer division by 0 to produce an exception.
 

emexes

Expert
Licensed User
Longtime User
Never mind, turns out I've effectively been here before.

+100

\ is another common representation (in QB, FB and PB)

or // in Python

or idiv and ldiv in JVM

or we could be French and go with an entirely contrary method like /.As(Int) and /.As(Long)
 
Last edited:
Top