Just starting out? Need help? Post your questions and find answers here.
Micoute
User
Posts: 28 Joined: Sat Jun 22, 2013 4:06 pm
Location: La Mézière FRANCE
Post
by Micoute » Wed Jul 03, 2013 2:52 pm
Pourquoi PB est-il nul en math ?
Translation with Google Translation: Why PB is null in math?
Code: Select all
Global Nombre_Initial.q, NombreTest.q, NombreTest2.q
Global NombreChiffres, Reducteur, Valeur_Retenue, i
Global.s Code
Global Dim Valeur.q(9)
Global NewMap Retenue()
Declare Decomposer(Nombre.q)
Declare Reduire(Nombre.q, Retenue)
Procedure Decomposer(Nombre.q)
Nombre_Initial = Nombre.q
;Code.s = ""
NombreTest = Nombre_Initial
Retenue = 1
NombreChiffres = Len(Str(NombreTest))+1
Reducteur = Val(ReplaceString(Space(NombreChiffres)," ",Str(Retenue)))
code + "(" + Left(Str(NombreChiffres), 2) + "."
Debug "Nombre = " + Str(NombreTest)
Debug "Réducteur = " + Str(Reducteur)
Debug "Longueur = " + Str(NombreChiffres)
Debug Str(Reducteur) + " - " + Str(NombreTest) + " = " +Str(Reducteur-NombreTest)
NombreTest2 = NombreTest
Valeur(0) = NombreTest
For i = 9 To 1 Step - 1
Reducteur = Val(ReplaceString(Space(NombreChiffres-1)," ",Str(i)))
If Reducteur > NombreTest2
NombreTest2 = Reducteur - NombreTest2
Debug " " + Str(Reducteur) + " - " + Str(NombreTest) + " = " + Str(NombreTest2)
Else
NombreTest2 - Reducteur
Debug " " + Str(NombreTest) + " - " + Str(Reducteur) + " = " + Str(NombreTest2)
EndIf
Valeur(i) = NombreTest2
Retenue(Str(i)) = Valeur(i)
Next i
SortArray(Valeur(), #PB_Sort_Descending)
Debug "****************RETENUE****************"
Debug "Valeur retenue " + Str(Valeur(9))
For i = 0 To 9
If Retenue(Str(i)) = Valeur(9)
Retenue = i
Debug "Retenue = " + Str(Retenue)
EndIf
Next
Debug ""
Debug "Nombre initial = " + Str(Nombre_Initial)
reduire(Valeur(9), Retenue)
EndProcedure
Procedure reduire(Nombre.q, Retenue)
NombreTest = Nombre
Valeur_Retenue = Retenue
Debug ""
Debug "********Réduction********"
While NombreTest > 0
Debug "Nombre = " + Str(NombreTest)
NombreChiffres = Len(Str(NombreTest)) - 1
reducteur = Val(ReplaceString(Space(NombreChiffres+1)," ",Str(Valeur_Retenue)))
code + Str(Retenue) + ") "
Debug "Réducteur = " + Str(Reducteur)
;Debug "Longueur = " + Str(NombreChiffres)
Debug "Code = " + code
NombreTest - reducteur
Debug "Reste = " + Str(NombreTest)
Debug ""
Debug "********Fin de réduction********"
If NombreTest < 0
Debug "Reste " + Str(NombreTest)
Else
Decomposer(NombreTest)
EndIf
Wend
EndProcedure
Decomposer(4867201436872539)
;CallDebugger
Last edited by
Micoute on Wed Jul 03, 2013 4:27 pm, edited 2 times in total.
Little John
Addict
Posts: 4789 Joined: Thu Jun 07, 2007 3:25 pm
Location: Berlin, Germany
Post
by Little John » Wed Jul 03, 2013 3:32 pm
Micoute wrote: Pourquoi PB est-il nul en math ?
Hi,
I would like to try to answer your question, but unfortunately I don't understand French.
Please repeat your question in English, as that's the language which is spoken on this forum. Thanks.
Demivec
Addict
Posts: 4269 Joined: Mon Jul 25, 2005 3:51 pm
Location: Utah, USA
Post
by Demivec » Wed Jul 03, 2013 6:20 pm
Use the right sized variables. The variable 'Reducteur' and the map 'Retenue()' need to be quads.
Code: Select all
Global Nombre_Initial.q, NombreTest.q, NombreTest2.q
Global NombreChiffres, Reducteur.q, Valeur_Retenue, i
Global.s Code
Global Dim Valeur.q(9)
Global NewMap Retenue.q()
Micoute
User
Posts: 28 Joined: Sat Jun 22, 2013 4:06 pm
Location: La Mézière FRANCE
Post
by Micoute » Thu Jul 04, 2013 9:27 am
Demivec wrote: Use the right sized variables. The variable 'Reducteur' and the map 'Retenue()' need to be quads.
Code: Select all
Global Nombre_Initial.q, NombreTest.q, NombreTest2.q
Global NombreChiffres, Reducteur.q, Valeur_Retenue, i
Global.s Code
Global Dim Valeur.q(9)
Global NewMap Retenue.q()
Thank you much, but it changes nothing in my problem
Little John
Addict
Posts: 4789 Joined: Thu Jun 07, 2007 3:25 pm
Location: Berlin, Germany
Post
by Little John » Thu Jul 04, 2013 9:46 am
Micoute wrote: Thank you much, but it changes nothing in my problem
So what exactly
is your problem
Micoute wrote: Why PB is null in math?
This is not understandable.
You must help a little yourself, so that we can help you.
Micoute
User
Posts: 28 Joined: Sat Jun 22, 2013 4:06 pm
Location: La Mézière FRANCE
Post
by Micoute » Thu Jul 04, 2013 10:20 am
Little John wrote: Micoute wrote: Thank you much, but it changes nothing in my problem
So what exactly
is your problem
Micoute wrote: Why PB is null in math?
This is not understandable.
You must help a little yourself, so that we can help you.
I believe that will not get there because I only speak French and I trust google translation
Crusiatus Black
Enthusiast
Posts: 389 Joined: Mon May 12, 2008 1:25 pm
Location: The Netherlands
Contact:
Post
by Crusiatus Black » Thu Jul 04, 2013 11:36 am
You could communicate more easily here:
http://purebasic.fr/french/ - The French forums for PureBasic.
Bas Groothedde,
Imagine Programming
I live in a philosophical paradoxal randome filled with enigma's!
Micoute
User
Posts: 28 Joined: Sat Jun 22, 2013 4:06 pm
Location: La Mézière FRANCE
Post
by Micoute » Fri Jul 05, 2013 11:50 am
I know, but the English are more reactive than the French
Demivec
Addict
Posts: 4269 Joined: Mon Jul 25, 2005 3:51 pm
Location: Utah, USA
Post
by Demivec » Fri Jul 05, 2013 2:36 pm
Micoute wrote: I believe that will not get there because I only speak French and I trust google translation
It would help if you write more about what you are trying to do. When you write a longer and more detailed description then google translator will be more likely to have helpful results. When you write only a few words then google translator does not help much because it can't read your mind and doesn't know your thoughts.
Mindphazer
Enthusiast
Posts: 460 Joined: Mon Sep 10, 2012 10:41 am
Location: Savoie
Post
by Mindphazer » Fri Jul 05, 2013 4:07 pm
Micoute wrote: I trust google translation
You should not.
MacBook Pro 16" M4 Pro - 24 Gb - MacOS 15.4.1 - Iphone 15 Pro Max - iPad at home
...and unfortunately... Windows at work...