/*************************************************************************************************************************************/
/* */
/* G E N E R A T I O N D E S P R E M I E R S E L E M E N T S */
/* D ' U N E S U I T E D E S T E R N : */
/* */
/* */
/* Author of '$xci/valeurs_Stern$K' : */
/* */
/* Jean-Francois COLONNA (LACTAMME, 20121004104759). */
/* */
/*************************************************************************************************************************************/
/*===================================================================================================================================*/
/*************************************************************************************************************************************/
/* */
/* I N T E R F A C E ' listG ' : */
/* */
/* */
/* :Debut_listG: */
/* :Fin_listG: */
/* */
/*************************************************************************************************************************************/
/*===================================================================================================================================*/
/*************************************************************************************************************************************/
/* */
/* D I R E C T I V E S S P E C I F I Q U E S D E C O M P I L A T I O N : */
/* */
/*************************************************************************************************************************************/
#define PRAGMA_CPP_____AUTORISER_LE_GooF
#define GENERER_LES_GET_ARGUMENTS_DE_CONTROLE_DE_L_ARITHMETIQUE_ETENDUE_DES_NOMBRES_FLOTTANTS
/* Introduit le 20121011101232... */
/*===================================================================================================================================*/
/*************************************************************************************************************************************/
/* */
/* F I C H I E R S D ' I N C L U D E S : */
/* */
/*************************************************************************************************************************************/
#include INCLUDES_MINI
/*===================================================================================================================================*/
/*************************************************************************************************************************************/
/* */
/* P A R A M E T R E S : */
/* */
/*************************************************************************************************************************************/
#include xci/sequence.01.I"
#define S0 \
FZERO
#define S1 \
FU
/* Definition des deux premiers termes de la suite... */
#define PONDERATION_S2n___Snm1 \
FZERO
#define PONDERATION_S2n___Sn__ \
FU
#define PONDERATION_S2np1_Sn__ \
FU
#define PONDERATION_S2np1_Snp1 \
FU
/* Ponderations diverses introduites le 20121008153458 pour plus de generalite... */
#define TRANSLATION_S2n__ \
FZERO
#define TRANSLATION_S2np1 \
FZERO
/* Translations diverses introduites le 20121011115829 et rendues necessaires depuis que */
/* l'arithmetique etendue a ete introduite le 20121011101232. En effet si, par exemple, */
/* 'ADD2(...)' (dans 'LIN2(...)') est remplace par 'MUL2(...)', alors le '+FZERO' de */
/* 'LIN2(...)' devient un '*FZERO'... */
#include xci/valeurs.01.I"
/*===================================================================================================================================*/
/*************************************************************************************************************************************/
/* */
/* M A C R O S U T I L E S : */
/* */
/*************************************************************************************************************************************/
#include xci/valeurs.02.I"
#define NOMBRE_DE_TERMES \
NBRE(premiere_image,derniere_image) \
/* Nombre de nombres... */
#define INDEX_DU_PREMIER_TERME \
INDEX0 \
/* Index du premier terme... */
/*===================================================================================================================================*/
/*************************************************************************************************************************************/
/* */
/* G E N E R A T I O N D E S P R E M I E R S E L E M E N T S */
/* D ' U N E S U I T E D E S T E R N : */
/* */
/*************************************************************************************************************************************/
BCommande(nombre_d_arguments,arguments)
/*-----------------------------------------------------------------------------------------------------------------------------------*/
Bblock
DEFV(Int,INIT(premiere_image,PREMIERE_IMAGE));
/* Numero de la premiere image, */
DEFV(Int,INIT(derniere_image,DERNIERE_IMAGE));
/* Numero de la derniere image. */
DEFV(Int,INIT(numero_d_image,UNDEF));
/* Numero de l'image courante. */
DEFV(Int,INIT(pas_des_images,PAS_DES_IMAGES));
/* Pas de passage d'un numero d'image a une autre. */
DEFV(Float,INIT(s0,S0));
DEFV(Float,INIT(s1,S1));
/* Definition des termes {S(0),S(1)}. */
DEFV(Float,INIT(ponderation_S2n___Snm1,PONDERATION_S2n___Snm1));
DEFV(Float,INIT(ponderation_S2n___Sn__,PONDERATION_S2n___Sn__));
DEFV(Float,INIT(ponderation_S2np1_Sn__,PONDERATION_S2np1_Sn__));
DEFV(Float,INIT(ponderation_S2np1_Snp1,PONDERATION_S2np1_Snp1));
/* Ponderations diverses introduites le 20121008153458 pour plus de generalite... */
DEFV(Float,INIT(translation_S2n__,TRANSLATION_S2n__));
DEFV(Float,INIT(translation_S2np1,TRANSLATION_S2np1));
/* Translations diverses introduites le 20121011115829 et rendues necessaires depuis que */
/* l'arithmetique etendue a ete introduite le 20121011101232. En effet si, par exemple, */
/* 'ADD2(...)' (dans 'LIN2(...)') est remplace par 'MUL2(...)', alors le '+FZERO' de */
/* 'LIN2(...)' devient un '*FZERO'... */
#include xci/valeurs.03.I"
/*..............................................................................................................................*/
GET_ARGUMENTS_(nombre_d_arguments
,BLOC(GET_ARGUMENT_I("premiere=""p=""D=",premiere_image);
GET_ARGUMENT_I("derniere=""d=""A=",derniere_image);
GET_ARGUMENT_I("pas=",pas_des_images);
GET_ARGUMENT_F("s0=""S0=",s0);
GET_ARGUMENT_F("s1=""S1=",s1);
GET_ARGUMENT_F("pS2n_Snm1=",ponderation_S2n___Snm1);
GET_ARGUMENT_F("pS2n_Sn=",ponderation_S2n___Sn__);
GET_ARGUMENT_F("pS2np1_Sn=",ponderation_S2np1_Sn__);
GET_ARGUMENT_F("pS2np1_Snp1=",ponderation_S2np1_Snp1);
GET_ARGUMENT_F("tS2n=",translation_S2n__);
GET_ARGUMENT_F("tS2np1=",translation_S2np1);
/* Arguements introduits le 20121011115829... */
PROCESS_ARGUMENTS_DE_PARAMETRAGE_DE_LA_GENERATION_DE_SUITE_DE_VALEURS_1;
)
);
Test(IFLE(premiere_image,derniere_image))
Bblock
Test(IFGE(NOMBRE_DE_TERMES,DEUX))
Bblock
DEFV(Int,INIT(index_courant_des_termes,INDEX_DU_PREMIER_TERME));
DEFV(Local,DEFV(Float,DdTb1(POINTERf,liste_des_termes_de_la_suite,NOMBRE_DE_TERMES,ADRESSE_NON_ENCORE_DEFINIE)));
MdTb1(liste_des_termes_de_la_suite,NOMBRE_DE_TERMES,Float,ADRESSE_NON_ENCORE_DEFINIE);
/* Definition des termes de la suite... */
/* */
/* Le 20121008152823 'liste_des_termes_de_la_suite' est passe de 'Int' a 'Float' pour plus */
/* de generalite... */
DoIn(numero_d_image,premiere_image,derniere_image,pas_des_images)
Bblock
DEFV(Float,INIT(terme_courant,UNDEF));
Test(IFEQ(index_courant_des_termes,NEUT(INDEX_DU_PREMIER_TERME)))
Bblock
EGAL(terme_courant,s0);
Eblock
ATes
Bblock
Test(IFEQ(index_courant_des_termes,SUCC(INDEX_DU_PREMIER_TERME)))
Bblock
EGAL(terme_courant,s1);
Eblock
ATes
Bblock
Test(IFGT(index_courant_des_termes,SUCC(INDEX_DU_PREMIER_TERME)))
Bblock
DEFV(Int,INIT(moitie_de_l_index_courant,MOIT(index_courant_des_termes)));
USs_GooF______CONDITIONNEL
(si_le_GooF_est_activable_utiliser_l_arithmetique_etendue_au_lieu_de_l_arithmetique_de_base
,BLOC(Bblock
EGAL(terme_courant
,COND(EST_PAIR(index_courant_des_termes)
,LIN2(ponderation_S2n___Snm1
,IdTb1(liste_des_termes_de_la_suite,PRED(moitie_de_l_index_courant)
,NOMBRE_DE_TERMES
)
,ponderation_S2n___Sn__
,IdTb1(liste_des_termes_de_la_suite,NEUT(moitie_de_l_index_courant)
,NOMBRE_DE_TERMES
)
,translation_S2n__
)
,LIN2(ponderation_S2np1_Sn__
,IdTb1(liste_des_termes_de_la_suite,NEUT(moitie_de_l_index_courant)
,NOMBRE_DE_TERMES
)
,ponderation_S2np1_Snp1
,IdTb1(liste_des_termes_de_la_suite,SUCC(moitie_de_l_index_courant)
,NOMBRE_DE_TERMES
)
,translation_S2np1
)
)
);
Eblock
)
)
/* Calcul de la suite de Stern : */
/* */
/* S = 0 */
/* 0 */
/* */
/* S = 1 */
/* 1 */
/* */
/* S = S */
/* 2n n */
/* */
/* S = S + S */
/* 2n+1 n n+1 */
/* */
/* avec les ponderations par defaut, soit avec plus de generalite : */
/* */
/* S = A.S + B.S + C */
/* 2n n-1 n */
/* */
/* S = D.S + E.S + F */
/* 2n+1 n n+1 */
/* */
Eblock
ATes
Bblock
Eblock
ETes
Eblock
ETes
Eblock
ETes
EGAL(IdTb1(liste_des_termes_de_la_suite,index_courant_des_termes,NOMBRE_DE_TERMES),terme_courant);
INCR(index_courant_des_termes,I);
CAL2(Prin2(Cara(chain_Aconcaten5(INTRODUCTION_FORMAT,valeurs_signees,".*",format_d_edition,"\n"))
,NOMBRE_DE_DECIMALES_EFFECTIF(nombre_de_decimales)
,MULTIPLE_DE(ENTIER_FLOTTANT(terme_courant))
)
);
Eblock
EDoI
FdTb1(liste_des_termes_de_la_suite,NOMBRE_DE_TERMES,Float,ADRESSE_NON_ENCORE_DEFINIE);
/* Definition des termes de la suite... */
Eblock
ATes
Bblock
PRINT_ERREUR("il faut calculer une liste avec au moins deux termes");
Eblock
ETes
Eblock
ATes
Bblock
PRINT_ERREUR("la relation d'ordre stricte ('premier < dernier') n'est pas respectee");
Eblock
ETes
RETU_Commande;
Eblock
ECommande