Information générale
Catégorie:
Codage, syntaxe et commandes
********************************************
* 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
*****************************************************************************
Précédent
Répondre
Voir le fil de ce thread
Voir le fil de ce thread à partir de ce message seulement
Voir tous les messages de ce thread
Voir tous les messages de ce thread à partir de ce message seulement