KIM jihoon Member Licensed User Longtime User Jan 18, 2023 #1 Visual Basic: 2^3=8 b4a ? thanks for the help
E emexes Expert Licensed User Longtime User Jan 18, 2023 #2 although if you're working with integers, probably simpler (and faster?) to just multiply it out manually ? Upvote 0
although if you're working with integers, probably simpler (and faster?) to just multiply it out manually ?
E emexes Expert Licensed User Longtime User Jan 18, 2023 #3 B4X: Dim P As Int = 1 For E = 1 To 3 P = P * 2 'or P + P ? Next or if it's always base-2 then even better: B4X: P = Bit.ShiftLeft(1, 3) 'value of bit position 3 ie 2 ^ 3 Upvote 0
B4X: Dim P As Int = 1 For E = 1 To 3 P = P * 2 'or P + P ? Next or if it's always base-2 then even better: B4X: P = Bit.ShiftLeft(1, 3) 'value of bit position 3 ie 2 ^ 3
KIM jihoon Member Licensed User Longtime User Jan 18, 2023 #4 emexes said: View attachment 138214 although if you're working with integers, probably simpler (and faster?) to just multiply it out manually ? Click to expand... thank you very much !!! Upvote 0
emexes said: View attachment 138214 although if you're working with integers, probably simpler (and faster?) to just multiply it out manually ? Click to expand... thank you very much !!!
E emexes Expert Licensed User Longtime User Jan 18, 2023 #5 KIM jihoon said: thank you very much !!! Click to expand... If you're doing binary bit stuff, like pulling bitfields out of an Int, or setting or clearing bits, then check out: https://www.b4x.com/b4j/help/core.html#bit and it often makes things clearer if number literals are in hexadecimal eg 0xF0 rather than in decimal eg 240 Upvote 0
KIM jihoon said: thank you very much !!! Click to expand... If you're doing binary bit stuff, like pulling bitfields out of an Int, or setting or clearing bits, then check out: https://www.b4x.com/b4j/help/core.html#bit and it often makes things clearer if number literals are in hexadecimal eg 0xF0 rather than in decimal eg 240
KIM jihoon Member Licensed User Longtime User Jan 18, 2023 #6 thank you very much Power(2, 3) solved Upvote 0