Up ! Mathematical - Decimal

Ce programme présente l'usage des décimaux.

Le fichier source est ${UPS_HOME}/upsvtm/demo/${UPS_LANGUAGE}/decimal.upl.

Mode compilé

Commande de compilation

upscmp Source=decimal.upl

Commande d'exécution

decimal TaillePartieDecimale=216 TaillePartieEntiere=216

Mode interprété

upssng Source=decimal.upl TaillePartieDecimale=216 TaillePartieEntiere=216

Fichier source

Source Composant "Exemple d'emploi du type Decimal" Version 4.0.0;

ImporterModule
/************/
Principal
/*******/
Variable
/******/
Debut
A=1.0;
Ecran.Ecrire(A.VersCaractere());
B=1.0;
Ecran.Ecrire(B.VersCaractere());

A=A+1.0;
Ecran.Ecrire(A.VersCaractere());
B=B+1.0;
Ecran.Ecrire(B.VersCaractere());

A=A-10.0;
Ecran.Ecrire(A.VersCaractere());
B=B-10.0;
Ecran.Ecrire(B.VersCaractere());

A=A*10.0;
Ecran.Ecrire(A.VersCaractere());
B=B*10.0;
Ecran.Ecrire(B.VersCaractere());

A=A/5.0;
Ecran.Ecrire(A.VersCaractere());
B=B/5.0;
Ecran.Ecrire(B.VersCaractere());

A=A^3.0;
Ecran.Ecrire(A.VersCaractere());
B=B^3.0;
Ecran.Ecrire(B.VersCaractere());

A=1.0;
Ecran.Ecrire(A.VersCaractere());
B=1.0;
Ecran.Ecrire(B.VersCaractere());

A+=1.0;
Ecran.Ecrire(A.VersCaractere());
B+=1.0;
Ecran.Ecrire(B.VersCaractere());

A-=10.0;
Ecran.Ecrire(A.VersCaractere());
B-=10.0;
Ecran.Ecrire(B.VersCaractere());

A*=10.0;
Ecran.Ecrire(A.VersCaractere());
B*=10.0;
Ecran.Ecrire(B.VersCaractere());

A^=3.0;
Ecran.Ecrire(A.VersCaractere());
B^=3.0;
Ecran.Ecrire(B.VersCaractere());

A=1;
Ecran.Ecrire(A.VersCaractere());
B=1;
Ecran.Ecrire(B.VersCaractere());

A=A+1;
Ecran.Ecrire(A.VersCaractere());
B=B+1;
Ecran.Ecrire(B.VersCaractere());

A=A-10;
Ecran.Ecrire(A.VersCaractere());
B=B-10;
Ecran.Ecrire(B.VersCaractere());

A=A*10;
Ecran.Ecrire(A.VersCaractere());
B=B*10;
Ecran.Ecrire(B.VersCaractere());

A=A/5;
Ecran.Ecrire(A.VersCaractere());
B=B/5;
Ecran.Ecrire(B.VersCaractere());

A=A^3;
Ecran.Ecrire(A.VersCaractere());
B=B^3;
Ecran.Ecrire(B.VersCaractere());

A=1;
Ecran.Ecrire(A.VersCaractere());
B=1;
Ecran.Ecrire(B.VersCaractere());

A+=1;
Ecran.Ecrire(A.VersCaractere());
B+=1;
Ecran.Ecrire(B.VersCaractere());

A-=10;
Ecran.Ecrire(A.VersCaractere());
B-=10;
Ecran.Ecrire(B.VersCaractere());

A*=10;
Ecran.Ecrire(A.VersCaractere());
B*=10;
Ecran.Ecrire(B.VersCaractere());

A^=3;
Ecran.Ecrire(A.VersCaractere());
B^=3;
Ecran.Ecrire(B.VersCaractere());

A++;
Ecran.Ecrire(A.VersCaractere());
B++;
Ecran.Ecrire(B.VersCaractere());

A--;
Ecran.Ecrire(A.VersCaractere());
B--;
Ecran.Ecrire(B.VersCaractere());

++A;
Ecran.Ecrire(A.VersCaractere());
++B;
Ecran.Ecrire(B.VersCaractere());

--A;
Ecran.Ecrire(A.VersCaractere());
--B;
Ecran.Ecrire(B.VersCaractere());

Si A==1.0 Alors Fin Si
Si A!=1.0 Alors Fin Si
Si A<=1.0 Alors Fin Si
Si A>=1.0 Alors Fin Si
Si A<1.0 Alors Fin Si
Si A>1.0 Alors Fin Si

Si B==1.0 Alors Fin Si
Si B!=1.0 Alors Fin Si
Si B<=1.0 Alors Fin Si
Si B>=1.0 Alors Fin Si Si B>1.0 Alors Fin Si
Si B>1.0 Alors Fin Si

Si A==1 Alors Fin Si
Si A!=1 Alors Fin Si
Si A<=1 Alors Fin Si
Si A>=1 Alors Fin Si
Si A<1 Alors Fin Si
Si A>1 Alors Fin Si

Si B==1 Alors Fin Si
Si B!=1 Alors Fin Si
Si B<=1 Alors Fin Si
Si B>=1 Alors Fin Si
Si B<1 Alors Fin Si
Si B>1 Alors Fin Si
Fin Principal

Résultat de l'exécution

1,0000 1,0000 2,0000 2,0000 -8,0000 -8,0000 -80,0000 -80,0000 -16,0000 -16,0000 -4.096,0000 -4.096,0000 1,0000 1,0000 2,0000 2,0000 -8,0000 -8,0000 -80,0000 -80,0000 -512.000,0000 -512.000,0000 1,0000 1,0000 2,0000 2,0000 -8,0000 -8,0000 -80,0000 -80,0000 -16,0000 -16,0000 -4.096,0000 -4.096,0000 1,0000 1,0000 2,0000 2,0000 -8,0000 -8,0000 -80,0000 -80,0000 -512.000,0000 -512.000,0000 -511.999,0000 -511.999,0000 -512.000,0000 -512.000,0000 -511.999,0000 -511.999,0000 -512.000,0000 -512.000,0000 A!=1.0 A<=1.0 A<1.0 B!=1.0 B<=1.0 B<1.0 A!=1 A<=1 A<1 B!=1 B<=1 B<1