

![]() | Start a set with this search |
![]() | Include this search in one of my sets |
![]() | Exclude this search from one of my sets |
![]() | Permalink to these results Paste this link in email or IM: |
| Atom feed for tracking future search results Paste this URL into your reader: |
10 messages in org.openoffice.fr.progRe: [prog] Grand nombres à problème| From | Sent On | Attachments |
|---|---|---|
| christianwtd | Sep 15, 2006 5:27 am | |
| christianwtd | Sep 15, 2006 5:28 am | .png |
| Laurent Godard | Sep 15, 2006 5:39 am | |
| christianwtd | Sep 15, 2006 5:40 am | |
| Fernand COSTA | Sep 15, 2006 6:57 am | |
| christianwtd | Sep 15, 2006 7:02 am | |
| Fernand COSTA | Sep 15, 2006 7:22 am | |
| christianwtd | Sep 15, 2006 8:42 am | |
| Fernand COSTA | Sep 15, 2006 1:06 pm | |
| christianwtd | Sep 15, 2006 2:03 pm |

![]() | Permalink for this message Paste this link in email or IM: |
![]() | Permalink for this thread Paste this link in email or IM: |
| Atom feed for this thread Paste this URL into your reader: |
| Subject: | Re: [prog] Grand nombres à problème | Actions... |
|---|---|---|
| From: | Fernand COSTA (fern...@crafe.com) | |
| Date: | Sep 15, 2006 7:22:47 am | |
| List: | org.openoffice.fr.prog | |
Re,
Ci dessous un extrait du code : Je récupère les différents paramètres, je vérifie leur validité et différents détails (taille, signe etc ...) puis je convertis le nombre en alpha grâce à la fonction *cstr()*.
J'extrais ensuite mes groupes de chiffre avec la fonction *mid()* puis les retransforme en nombre avec la fonction *cint()* pour continuer ma moulinette.
Tu peux récupérer la macro entière ici <http://www.crafe.com/telechargement/NombreEcritEnLettre.ods> .
Salutations.
Fernand COSTA '********************** Teste des paramètres reçus
if IsNumeric(vNombre) then if vNombre > 999999999999.999 OR vNombre < (-999999999999.999) THEN vMessageErr = "Nombre hors fourchette !" goto TraitementErreur: endif else vMessageErr = "Valeur non numérique !" goto TraitementErreur: endIf if vNombre < 0 then vSigne=false vNombre=abs(vNombre) else vSigne=true endif vtravail=cstr(vNombre) vlongueurnb=len(vtravail) vpositionvirgule=instr(vtravail,",") if vpositionvirgule=0 then vpositionvirgule = vlongueurnb+1 end if
if vposition<0 or vposition>3 then vmessageErr = "Nb de décimales > à 3 !" goto traitementErreur: end if
'********************** Décomposition du nombre vpositiondepart=vpositionvirgule-12 vpositionfin=vpositiondepart+2 vlongueurgroupe=3 if vpositionfin>0 then if vpositiondepart<1 then vlongueurgroupe=vlongueurgroupe+vpositiondepart-1 vpositiondepart = 1 end if vMilliard = cint(mid(vtravail,vpositiondepart,vlongueurgroupe)) end if rem int (vNombre/1000000000)
vpositiondepart=vpositionvirgule-9 vpositionfin=vpositiondepart+2 vlongueurgroupe=3 if vpositionfin>0 then if vpositiondepart<1 then vlongueurgroupe=vlongueurgroupe+vpositiondepart-1 vpositiondepart = 1 end if vMillion = cint(mid(vtravail,vpositiondepart,vlongueurgroupe)) end if
rem vMillion=int((vNombre-(vMilliard*1000000000))/1000000)
vpositiondepart=vpositionvirgule-6 vpositionfin=vpositiondepart+2 vlongueurgroupe=3 if vpositionfin>0 then if vpositiondepart<1 then vlongueurgroupe=vlongueurgroupe+vpositiondepart-1 vpositiondepart = 1 end if vMille = cint(mid(vtravail,vpositiondepart,vlongueurgroupe)) end if vpositiondepart=vpositionvirgule-3 vpositionfin=vpositiondepart+2 vlongueurgroupe=3 if vpositionfin>0 then if vpositiondepart<1 then vlongueurgroupe=vlongueurgroupe+vpositiondepart-1 vpositiondepart = 1 end if vUnite = cint(mid(vtravail,vpositiondepart,vlongueurgroupe)) end if
vIntermediaire=mid(vtravail,vpositionvirgule+1,vposition) IF len(vIntermediaire<vposition) then do while len(vIntermediaire)<vposition vIntermediaire=vIntermediaire+"0"
christianwtd a écrit :
Fernand COSTA a écrit :
Bonjour,
J'ai rencontré le même problème dans ma macro d'écriture de nombre en toute lettre, et je me suis résigné à traiter le problème en passant par de l'alphanumérique. Même en utilisant les int(x) et autre arrondi, je retrouvai, mais pas toujours, des soucis d'arrondi. Une fois en alpha, plus de soucis !!
Salutations.
Fernand COSTA
Bonjour Fernand,
alphanumérique ? Tu peux m'en dire plus...
Bon surf, Christian








.png