BBC BASIC for Windows
« Parity Check »

Welcome Guest. Please Login or Register.
Apr 5th, 2018, 11:48pm



ATTENTION MEMBERS: Conforums will be closing it doors and discontinuing its service on April 15, 2018.
Ad-Free has been deactivated. Outstanding Ad-Free credits will be reimbursed to respective payment methods.

If you require a dump of the post on your message board, please come to the support board and request it.


Thank you Conforums members.

BBC BASIC for Windows Resources
Online BBC BASIC for Windows documentation
BBC BASIC for Windows Beginners' Tutorial
BBC BASIC Home Page
BBC BASIC on Rosetta Code
BBC BASIC discussion group
BBC BASIC for Windows Programmers' Reference

« Previous Topic | Next Topic »
Pages: 1  Notify Send Topic Print
 thread  Author  Topic: Parity Check  (Read 463 times)
Wendell
New Member
Image


member is offline

Avatar




PM


Posts: 28
xx Parity Check
« Thread started on: Mar 19th, 2014, 9:04pm »

Richard i have been using the Tutorial a great help too, but i couldnt find anything about a comand to check for Parity of a number, or if there is a command. Sorry to bother you i am almost done.
User IP Logged

rtr
Guest
xx Re: Parity Check
« Reply #1 on: Mar 19th, 2014, 9:45pm »

on Mar 19th, 2014, 9:04pm, Wendell wrote:
i couldnt find anything about a comand to check for Parity of a number

This is the fastest method I know (for 32-bit integers); it returns 0 for even parity and 1 for odd parity:

Code:
      DEF FNparity(X%)
      X% EOR= X% >> 1
      X% EOR= X% >> 2
      X% EOR= X% >> 4
      X% EOR= X% >> 8
      X% EOR= X% >> 16
      = X% AND 1 

Richard.
User IP Logged

Pages: 1  Notify Send Topic Print
« Previous Topic | Next Topic »

| |

This forum powered for FREE by Conforums ©
Terms of Service | Privacy Policy | Conforums Support | Parental Controls