{"id":16985837,"url":"https://github.com/as400jplpc/nim_dcml","last_synced_at":"2026-05-19T15:07:20.463Z","repository":{"id":174038240,"uuid":"221274414","full_name":"AS400JPLPC/nim_dcml","owner":"AS400JPLPC","description":"Decimal avec bornage pour conformiter avec SQL field definition","archived":false,"fork":false,"pushed_at":"2020-07-22T13:24:38.000Z","size":491,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-03-22T01:42:02.193Z","etag":null,"topics":["decimal","nim","nim-lang"],"latest_commit_sha":null,"homepage":"","language":"C","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/AS400JPLPC.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2019-11-12T17:30:27.000Z","updated_at":"2020-07-22T13:24:41.000Z","dependencies_parsed_at":null,"dependency_job_id":"e2435d79-3043-4cea-8cbf-bd2b2d7bbcb4","html_url":"https://github.com/AS400JPLPC/nim_dcml","commit_stats":null,"previous_names":["as400jplpc/nim_dcml"],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/AS400JPLPC/nim_dcml","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/AS400JPLPC%2Fnim_dcml","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/AS400JPLPC%2Fnim_dcml/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/AS400JPLPC%2Fnim_dcml/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/AS400JPLPC%2Fnim_dcml/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/AS400JPLPC","download_url":"https://codeload.github.com/AS400JPLPC/nim_dcml/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/AS400JPLPC%2Fnim_dcml/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":33221353,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-05-19T07:54:09.561Z","status":"ssl_error","status_checked_at":"2026-05-19T07:54:08.508Z","response_time":58,"last_error":"SSL_read: unexpected eof while reading","robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":false,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["decimal","nim","nim-lang"],"created_at":"2024-10-14T02:44:16.207Z","updated_at":"2026-05-19T15:07:15.454Z","avatar_url":"https://github.com/AS400JPLPC.png","language":"C","funding_links":[],"categories":[],"sub_categories":[],"readme":"# nim_dcml\n\n- démarage projet 2019/11/05\n# en test\n\n- date de mise à jour 2019/11/25\n- fin des tests de contrôle de cohérence/validité dcml 2019/11/20\n- simplification le 2019/11/23\n  - harmonistaion en fonction de nim-decimal\n  - `:=` remplace setDcml\n  - supression toStr \n  - ajout debug sortie libre sans contrôle\n  - modification sortie $ avec contrôle\n  - suppression proc delDcml inutil veuillez utiliser nil\n  - encours de test structure Reccord Enrg... \n- test réel valeur et ajout fonction dans eval  le 2019/11/25\n\n- suppression  fma 2019/12/09  correctif  \n- :=(string)-\u003eformat result decimal (Rjust) \n- contrôle import\n- 2019/12/11 correctif ligne 458 dcml.nim  (erreur ??? VsCode) regénération et commit depot\n\n- 2020/07/21 correctif ajout proc isStringDigit*(str: string) \n\n- 2020/07/22 correctif important lier à --gc:arc  + divers conséquence\n\n- 2020/07/22 correctif remove typeinfo use typetraits \n\n\n\n\ndecimal avec bornage pour conformiter avec SQL field definition\n\nC’est un projet qui s’appui sur Nim-decimal\nje remercie l’équipe du très gros travail pour adapter qui est fait en c/c++ pour Nim-lang\n\nhttps://github.com/status-im/nim-decimal\n\net du soutient que j’ai eu dans le forum Nim.\n\ntous les calculs ce font en valeur étendue seul la fonction Valide formaté\n\n- Mon intervention consiste \n\n1. Définir la décimal newDcml( iEntier ; iScale) pour borner et ainsi respecter la définition des zones dcml(x,y) dans SQL \n\n2. j’ai été obligé de changer par rapport au projet initial les retours de valeurs et non pas le retour d’une nouvelle variable\n\n3. la partie disons normale qui sert en gestion sera conforme , la partie mathématique est réduite au minimum\n\n4. Formatage avec justification last zero\n\n5. affectation de valeur (set dcml)  :=  int/int8/int16/int32/int64 uint/uint8/uint16/uint32/uint64/float/string  ex: a:=10\n\n6. a.eval(\"+\", $a, \"/\" , 100 , \"*\" , 4 ) etc... \n\n7. debug(a):string  acces sans contrôle\n\n8. fonction\n  +=  -=  *= /= //=  ^= \n9. autre fonction\n\n  comparaion \u003c \u003e \u003e= \u003c= ==\n\n  floor \n  \n  ceil  \n  \n  (signed) plus minus\n  \n  divint (Integer division)\n  \n  rem (remainder)\n  \n  truncate\n  \n  Rtrim  (trim zero rigth (format scale ))\n\n  Rjust  (add zeros right (format scale ))\n  \n  Valide (format for type SQL DCML   sans arrondi)\n  \n  Round ( arrondi)\n  \n  isErr\n  \nisStringDigit*(str: string)\n\n\n- reslutats tstdcml.nim\n\n ```..TEST.. \n \na:=aa 10.00\na:=aa 10\nIint 10.00\nIint8 10.00\nIint16 10.00\nIint32 10.00\nIint64 10.00\nUint 10.00\nUint8 10.00\nUint16 10.00\nUint32 10.00\nUint64 10.00\nfloat = 10.1234  10.12\na.Rtrim 10.12\nfloat = 10  10.00\na.Rtrim 10.00\nfloat = 10.10  10.10\na.Rtrim 10.10\na+=10 20.00\na-=10 10.00\na*=10 100.00\na/=10 10.00\na//=10 1.00\na^=10 10000000000\na+=b 20.00\na-=b 10.00\na*=b 100.00\na/=b 10.00\na//=b 1.00\ne:= 10.00\ne^=b 10000000000.00\ne^=b 10000000000.00\n a==b  true\n a==10 true\n 10==a true\n a\u003cb   false\n a\u003c10  false\n a\u003cb   false\n a\u003c=b  true\n 10\u003c=a true\n a\u003c=10 true\n a\u003eb   false\n a\u003e10  false\n a\u003eb   false\n a\u003e=b  true\n 10\u003e=a true\n a\u003e=10 true\n a==b  false\n a==10 false\n 10==a false\n a\u003cb   true\n a\u003c10  true\n a\u003cb   true\n a\u003c=b  true\n 10\u003c=a false\n a\u003c=10 true\n a\u003eb   false\n a\u003e10  true\n a\u003eb   false\n a\u003e=b  false\n 10\u003e=a false\n a\u003e=10 true\n\n clone(a) 10.00\n\n b+22.96 32.96\n\n c.ceil(b) 33.00\n\n c.floor(b) 32.00\n\n c.plus() +32.00\n\n c.minus() 32.00\n\n test delete (a)\n\n redefinition var (a)  mauvais coding  only test \n\n\n d.rem(a, b) 1.00\n\n d.divint(a,c) 3.00\n\n d.truncate() 3.00\n\nc:=3.9800000 3.98\n d.Rtrim() 3.98 \\\\n\n\n d.Rjust() 10.10\n\n d.Valide() 10.00\n\n d.Round(3)  10.12\n\nd:=10.12345 10.12\nvar d invalide format \n\nd:=123456789012.12345 \n a.isErr() 123456789012.12345\n30.00 + 20.00 + 3.00\n53.00\n100.00 / 100 * 4 + 100.00\n104.00\n100.00 % 4 +$a\n104.00\n100.00 +% 4\n104.00\n100.00 -% 4\n96.00\n```\n  \n\n\n# test hypotetique de prix revients vente etc.... \n\n\n```\nvar article    :string  =\"\"\nvar poids      = newDcml(3,1)  # tonnes ex 1.5 tonnes\nvar prixBase   = newDcml(8,2)  # montant achat de la tonne\nvar prixGramme = newDcml(3,15) # montant achat du gramme\nvar refund     = newDcml(2,2)  # % refund\nvar prixAchat  = newDcml(8,2)  # montant achat\nvar poidsUnite = newDcml(5,1)  # poids en grammes de l'article\nvar prixBrut   = newDcml(4,15) # prix brut de l'article\nvar increase   = newDcml(2,3)  # % increase usinage spécifique \nvar prixFab    = newDcml(4,15) # prix fabrication brut + 40% gestion salaire investissement ....\nvar poidsFab   = newDcml(5,2)  # poids d'un article à la fabrication gramme\nvar nbrArticle = newDcml(15,0) # nombre d'artcile fab maxi.\nvar prixVente  = newDcml(4,2)  # prix de vente unitaire de base\nvar gainUnite  = newDcml(4,15) # profit sur un article\n\nvar benefice   = newDcml(18,2) # benefice par tonne\n\n\narticle = \"vis Acier\"\n# 2 tonnes\npoids := 5\n\n# 450€ tonne\nprixBase := 450\n\n# 0.000450€ gr\nprixGramme.eval(\"=\",$prixBase,\"/\" ,1000000)\n\n\n# remise\nrefund := 1.5\nprixAchat.eval(\"=\", $poids , \"*\", $prixBase, \"+%\",$refund)\n\n\n# poids 1 vis\npoidsUnite := 1.2\n# gache\nincrease := 0.005\n\n# poids fabrication\npoidsFab.eval(\"=\" ,$poidsUnite, \"+%\", $increase)\n\n\n\n# calcul du prix de fabrication\nprixFab.eval(\"=\", $poidsUnite, \"+%\",$increase,\"*\" ,$prixGramme,\"+%\",40)\n\n# calcul du nombre article  \nnbrArticle.eval(\"=\",$poids, \"*\",1000000, \"/\", $poidsFab , \"-%\", 0.001)\n\n\necho fmt\" Poids :  {$poids} tonnes   PrixBase : {$prixbase} remise : {$refund}  prixAchat = {$prixAchat} \"\necho \" \"\necho fmt\" poidsUnite : {$poidsUnite} grm +  gache : {$increase}%   * prixGramme : {$prixgramme} + 40% (frais gestion Entreprise)  Prix de fabrication = {$prixFab}\"\n\necho fmt\" poids: {$poids} * 1000000 (poids en gramme)  / poidFab : {$poidsFab} grm  - 0.001% de perte manutention   Nombre article = {$nbrArticle}\"\n\nprixVente := 0.10 #cts soit 1€ les dix\n\ngainUnite.eval( \"=\" , $prixVente , \"-\" , $prixFab )\n\necho fmt\"gainUnite sur un article {gainUnite}\"\n\nbenefice.eval(\"=\" , $gainUnite ,  \"*\" ,$nbrArticle , \"-\", $prixAchat )\n\n\necho fmt\"benefice effet de masse  gainUnite: {$gainUnite}   * nbrArticle: {$nbrArticle }  - prixAchat: {$prixAchat} benefice= {$benefice}\"\n\n==============================================================================================================================\nresultat\n\n Poids :  5.0 tonnes   PrixBase : 450.00 remise : 1.50  prixAchat = 2283.75 \n \n poidsUnite : 1.2 grm +  gache : 0.005%   * prixGramme : 0.0004500000 + 40% (frais gestion Entreprise)  Prix de fabrication = 0.00075603780000000000\n poids: 5.0 * 1000000 (poids en gramme)  / poidFab : 1.20 grm  - 0.001% de perte manutention   Nombre article = 4166625\ngainUnite sur un article 0.09924396220000000000\nbenefice effet de masse  gainUnite: 0.09924396220000000000   * nbrArticle: 4166625  - prixAchat: 2283.75 benefice= 411228.62\n```\n ________________________________________________________________________________________________________________________\n \n \n \n# Dependency license\n\nThis library depends on and redistribute mpdecimal. mpdecimal is available at http://www.bytereef.org/mpdecimal/index.html\n\nMpdecimal is licensed under the following Simplified BSD terms (BSD 2-clause).\n\n```Copyright (c) 2008-2016 Stefan Krah. All rights reserved.\n\nRedistribution and use in source and binary forms, with or without\nmodification, are permitted provided that the following conditions\nare met:\n\n1. Redistributions of source code must retain the above copyright\n   notice, this list of conditions and the following disclaimer.\n\n2. Redistributions in binary form must reproduce the above copyright\n   notice, this list of conditions and the following disclaimer in the\n   documentation and/or other materials provided with the distribution.\n\nTHIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS \"AS IS\" AND\nANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE\nIMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE\nARE DISCLAIMED.  IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE\nFOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL\nDAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS\nOR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)\nHOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT\nLIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY\nOUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF\nSUCH DAMAGE.```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fas400jplpc%2Fnim_dcml","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fas400jplpc%2Fnim_dcml","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fas400jplpc%2Fnim_dcml/lists"}