General information
Category:
Coding, syntax & commands
********************************************
* Convert a decimal part of a number
* in negative powers of 2
*****************************************************************************
**ip is the power of 2 (i.e. 1->2 / 2->4 / 3->8 / 4->16 / 5->32 / 6->64 )
*****************************************************************************
ip = 6 && (##) you can replace this line with : FOR ip = 1 TO 6
FOR j = 1 TO 2**ip-1 && to generate all different numbers
lcResu=2**ip
R=INT((j/lcResu-INT(j/lcResu))*lcResu) && just saves ip bits
R2=R
****************
FOR i = 1 TO ip
IF BITTEST(R, i-1) && consider a number as a multiple
&& of the ip power of 2
&& if its ip rightmost bits are all zero.
?TRANSFORM(j, '99')+"/"+TRANSFORM(2**ip, '99')+IIF(j=R2,""," => "+TRANSFORM(R2, '99')+"/"+TRANSFORM(lcResu, '99'))
EXIT
ELSE
R2=R2/2
lcResu=lcResu/2
ENDIF
ENDFOR
****************
ENDFOR
?"----------------------"
** (##) && you should replace it with : ENDFOR
*****************************************************************************
Previous
Reply
View the map of this thread
View the map of this thread starting from this message only
View all messages of this thread
View all messages of this thread starting from this message only