# SOME DESCRIPTIVE TITLE. # Copyright (C) 1990-2016, Python Software Foundation # This file is distributed under the same license as the Python package. # FIRST AUTHOR , YEAR. # #, fuzzy msgid "" msgstr "" "Project-Id-Version: Python 2.7\n" "Report-Msgid-Bugs-To: \n" "POT-Creation-Date: 2016-10-30 10:44+0100\n" "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" "Last-Translator: FULL NAME \n" "Language-Team: LANGUAGE \n" "MIME-Version: 1.0\n" "Content-Type: text/plain; charset=UTF-8\n" "Content-Transfer-Encoding: 8bit\n" #: ../Doc/tutorial/floatingpoint.rst:5 msgid "Floating Point Arithmetic: Issues and Limitations" msgstr "Arithmétique en nombres à virgule flottante : problèmes et limites" #: ../Doc/tutorial/floatingpoint.rst:10 msgid "" "Floating-point numbers are represented in computer hardware as base 2 " "(binary) fractions. For example, the decimal fraction ::" msgstr "" "Les nombres à virgule flottante sont représentés, au niveau matériel, en " "fractions de nombres binaires (base 2). Par exemple, la fraction " "décimale : ::" #: ../Doc/tutorial/floatingpoint.rst:15 msgid "" "has value 1/10 + 2/100 + 5/1000, and in the same way the binary fraction ::" msgstr "" "a la valeur 1/10 + 2/100 + 5/1000 et, de la même manière, la fraction " "binaire : ::" #: ../Doc/tutorial/floatingpoint.rst:19 msgid "" "has value 0/2 + 0/4 + 1/8. These two fractions have identical values, the " "only real difference being that the first is written in base 10 fractional " "notation, and the second in base 2." msgstr "" "a la valeur 0/2 + 0/4 + 1/8. Ces deux fractions ont une valeur identique, la " "seule différence est que la première est une fraction décimale, la seconde " "est une fraction binaire." #: ../Doc/tutorial/floatingpoint.rst:23 msgid "" "Unfortunately, most decimal fractions cannot be represented exactly as " "binary fractions. A consequence is that, in general, the decimal floating-" "point numbers you enter are only approximated by the binary floating-point " "numbers actually stored in the machine." msgstr "" "Malheureusement, la plupart des fractions décimales ne peuvent pas avoir de " "représentation exacte en fractions binaires. Par conséquent, en général, les " "nombres à virgule flottante que vous donnez sont seulement approximés en " "fractions binaires pour être stockés dans la machine." #: ../Doc/tutorial/floatingpoint.rst:28 msgid "" "The problem is easier to understand at first in base 10. Consider the " "fraction 1/3. You can approximate that as a base 10 fraction::" msgstr "" "Le problème est plus simple à aborder en base 10. Prenons par exemple, la " "fraction 1/3. Vous pouvez l'approximer en une fraction décimale : ::" #: ../Doc/tutorial/floatingpoint.rst:33 ../Doc/tutorial/floatingpoint.rst:37 msgid "or, better, ::" msgstr "ou, mieux, ::" #: ../Doc/tutorial/floatingpoint.rst:41 msgid "" "and so on. No matter how many digits you're willing to write down, the " "result will never be exactly 1/3, but will be an increasingly better " "approximation of 1/3." msgstr "" "etc. Peu importe le nombre de décimales que vous écrivez, le résultat ne " "vaut jamais exactement 1/3, mais c'est une estimation s'en approchant " "toujours mieux." #: ../Doc/tutorial/floatingpoint.rst:45 msgid "" "In the same way, no matter how many base 2 digits you're willing to use, the " "decimal value 0.1 cannot be represented exactly as a base 2 fraction. In " "base 2, 1/10 is the infinitely repeating fraction ::" msgstr "" "De la même manière, peu importe combien de décimales en base 2 vous " "utilisez, la valeur décimale 0.1 ne peut pas être représentée exactement en " "fraction binaire. En base 2, 1/10 est le nombre périodique suivant : ::" #: ../Doc/tutorial/floatingpoint.rst:51 msgid "Stop at any finite number of bits, and you get an approximation." msgstr "" "Arrêtez à n'importe quelle quantité finie de bits, et vous obtiendez une " "approximation." #: ../Doc/tutorial/floatingpoint.rst:53 msgid "" "On a typical machine running Python, there are 53 bits of precision " "available for a Python float, so the value stored internally when you enter " "the decimal number ``0.1`` is the binary fraction ::" msgstr "" "Pour Python, sur une machine typique, 53 bits sont utilisés pour la " "précision d'un flottant, donc la valeur stockée lorsque vous entrez le " "nombre décimal ``0.1`` est la fraction binaire ::" #: ../Doc/tutorial/floatingpoint.rst:59 msgid "which is close to, but not exactly equal to, 1/10." msgstr "qui est proche, mais pas exactement égale, à 1/10." #: ../Doc/tutorial/floatingpoint.rst:61 msgid "" "It's easy to forget that the stored value is an approximation to the " "original decimal fraction, because of the way that floats are displayed at " "the interpreter prompt. Python only prints a decimal approximation to the " "true decimal value of the binary approximation stored by the machine. If " "Python were to print the true decimal value of the binary approximation " "stored for 0.1, it would have to display ::" msgstr "" "Il est facile d'oublier que la valeur stockée est une approximation de la " "fraction décimale d'origine, du fait de la manière dont les flottants sont " "affichés dans l'interpréteur. Python n'affiche qu'une approximation décimale " "de la valeur stockée en binaire. Si Python devait afficher la vraie valeur " "décimale de l'approximation binaire stockée pour 0.1, il afficherait : ::" #: ../Doc/tutorial/floatingpoint.rst:71 msgid "" "That is more digits than most people find useful, so Python keeps the number " "of digits manageable by displaying a rounded value instead ::" msgstr "" "C'est bien plus de décimales que ce qu'attendent la plupart des " "utilisateurs, donc Python affiche une valeur arrondie afin d'améliorer la " "lisibilité : ::" #: ../Doc/tutorial/floatingpoint.rst:77 msgid "" "It's important to realize that this is, in a real sense, an illusion: the " "value in the machine is not exactly 1/10, you're simply rounding the " "*display* of the true machine value. This fact becomes apparent as soon as " "you try to do arithmetic with these values ::" msgstr "" "Il est important de comprendre qu'en réalité, c'est une illusion : la valeur " "stockée n'est pas exactement 1/10, c'est simplement à *l'affichage* que la " "valeur stockée est arrondie. Ceci devient évident dès que vous effectuez des " "opérations arithmétiques avec ces valeurs : ::" #: ../Doc/tutorial/floatingpoint.rst:85 msgid "" "Note that this is in the very nature of binary floating-point: this is not a " "bug in Python, and it is not a bug in your code either. You'll see the same " "kind of thing in all languages that support your hardware's floating-point " "arithmetic (although some languages may not *display* the difference by " "default, or in all output modes)." msgstr "" "Ce comportement est inhérent à la nature même de la représentation des " "nombres à virgule flottante dans la machine : ce n'est pas un bogue dans " "Python et ce n'est pas non plus un bogue dans votre code. Vous pouvez " "observer le même type de comportement dans tous les autres langages " "utilisant le support matériel pour le calcul des nombres à virgule flottante " "(bien que certains langages ne rendent pas visible la différence par défaut, " "ou pas dans tous les modes d'affichage)." #: ../Doc/tutorial/floatingpoint.rst:91 msgid "" "Other surprises follow from this one. For example, if you try to round the " "value 2.675 to two decimal places, you get this ::" msgstr "" "Une autre surprise est inhérente à celle-ci. Par exemple, si vous tentez " "d'arrondir la valeur 2.675 à deux décimales, vous obtiendrez ::" #: ../Doc/tutorial/floatingpoint.rst:97 msgid "" "The documentation for the built-in :func:`round` function says that it " "rounds to the nearest value, rounding ties away from zero. Since the " "decimal fraction 2.675 is exactly halfway between 2.67 and 2.68, you might " "expect the result here to be (a binary approximation to) 2.68. It's not, " "because when the decimal string ``2.675`` is converted to a binary floating-" "point number, it's again replaced with a binary approximation, whose exact " "value is ::" msgstr "" "La documentation de la primitive :func:`round` indique qu'elle arrondit à la " "valeur la plus proche en s'éloignant de zéro. Puisque la fraction décimale " "est exactement à mi-chemin entre 2.67 et 2.68, vous devriez vous attendre à " "obtenir (une approximation binaire de) 2.68. Ce n'est pourtant pas le cas, " "car lorsque la fraction décimale ``2.675`` est convertie en flottant, elle " "est stockée par une approximation dont la valeur exacte est ::" #: ../Doc/tutorial/floatingpoint.rst:106 msgid "" "Since this approximation is slightly closer to 2.67 than to 2.68, it's " "rounded down." msgstr "" "Puisque l'approximation est légèrement plus proche de 2.67 que 2.68, " "l'arrondi se fait vers le bas." #: ../Doc/tutorial/floatingpoint.rst:109 msgid "" "If you're in a situation where you care which way your decimal halfway-cases " "are rounded, you should consider using the :mod:`decimal` module. " "Incidentally, the :mod:`decimal` module also provides a nice way to \"see\" " "the exact value that's stored in any particular Python float ::" msgstr "" "Si vous êtes dans une situation où les arrondis de nombres décimaux à mi-" "chemin ont de l'importance, vous devriez utiliser le module :mod:`decimal`. " "Soit dit en passant, le module :mod:`decimal` propose aussi un moyen " "pratique de \"voir\" la valeur exacte stockée pour n'importe quel flottant." #: ../Doc/tutorial/floatingpoint.rst:118 msgid "" "Another consequence is that since 0.1 is not exactly 1/10, summing ten " "values of 0.1 may not yield exactly 1.0, either::" msgstr "" "Une autre conséquence du fait que 0.1 n'est pas exactement stocké 1/10 est " "que la somme de dix valeurs de 0.1 ne donne pas 1.0 non plus : ::" #: ../Doc/tutorial/floatingpoint.rst:128 msgid "" "Binary floating-point arithmetic holds many surprises like this. The " "problem with \"0.1\" is explained in precise detail below, in the " "\"Representation Error\" section. See `The Perils of Floating Point `_ for a more complete account of other common " "surprises." msgstr "" "L'arithmétique des nombres binaires à virgule flottante réserve beaucoup de " "surprises de ce genre. Le problème avec \"0.1\" est expliqué en détails ci-" "dessous, dans la section \"Erreurs de représentation\". Voir `The Perils of " "Floating Point `_ pour une liste plus " "complète de ce genre de surprises." #: ../Doc/tutorial/floatingpoint.rst:133 msgid "" "As that says near the end, \"there are no easy answers.\" Still, don't be " "unduly wary of floating-point! The errors in Python float operations are " "inherited from the floating-point hardware, and on most machines are on the " "order of no more than 1 part in 2\\*\\*53 per operation. That's more than " "adequate for most tasks, but you do need to keep in mind that it's not " "decimal arithmetic, and that every float operation can suffer a new rounding " "error." msgstr "" "Il est vrai qu'il n'existe pas de réponse simple, cependant ne vous méfiez " "pas trop des nombres à virtule flottante ! Les erreurs, en Python, dans les " "opérations de nombres à virgule flottante sont dues au matériel sous-jacent, " "et sur la plupart des machines ne sont pas plus importantes que 1 sur 2\\*" "\\*53 par opération. C'est plus que nécessaire pour la plupart des tâches, " "mais vous devez garder à l'esprit que ce ne sont pas des opérations " "décimales, et que chaque opération sur des nombres à virgule flottante peut " "souffrir d'une nouvelle erreur." #: ../Doc/tutorial/floatingpoint.rst:140 msgid "" "While pathological cases do exist, for most casual use of floating-point " "arithmetic you'll see the result you expect in the end if you simply round " "the display of your final results to the number of decimal digits you " "expect. For fine control over how a float is displayed see the :meth:`str." "format` method's format specifiers in :ref:`formatstrings`." msgstr "" "Bien que des cas pathologiques existent, pour la plupart des cas " "d'utilisations courants vous obtiendrez le résultat attendu à la fin en " "arrondissant simplement au nombre de décimales désirées à l'affichage. Pour " "un contrôle fin sur la manière dont les flottants sont affichés, consultez " "dans :ref:`formatstrings` les spécifications de formattage de la méthode :" "meth:`str.format`" #: ../Doc/tutorial/floatingpoint.rst:150 msgid "Representation Error" msgstr "Erreurs de représentation" #: ../Doc/tutorial/floatingpoint.rst:152 msgid "" "This section explains the \"0.1\" example in detail, and shows how you can " "perform an exact analysis of cases like this yourself. Basic familiarity " "with binary floating-point representation is assumed." msgstr "" "Cette section explique en détail l'exemple du \"0.1\" et montre comment vous " "pouvez effectuer une analyse exacte de ce type de cas par vous-même. Nous " "supposons que la représentation binaire des nombres flottants vous est " "familière." #: ../Doc/tutorial/floatingpoint.rst:156 msgid "" ":dfn:`Representation error` refers to the fact that some (most, actually) " "decimal fractions cannot be represented exactly as binary (base 2) " "fractions. This is the chief reason why Python (or Perl, C, C++, Java, " "Fortran, and many others) often won't display the exact decimal number you " "expect::" msgstr "" "Le terme :dfn:`Representation error` signifie que la plupart des fractions " "décimales ne peuvent être représentées exactement en binaire. C'est la " "principale raison pour laquelle Python (ou Perl, C, C++, Java, Fortran, et " "beuacoup d'autres) n'affiche habituellement pas le résultat exact en " "décimal::" #: ../Doc/tutorial/floatingpoint.rst:164 msgid "" "Why is that? 1/10 and 2/10 are not exactly representable as a binary " "fraction. Almost all machines today (July 2010) use IEEE-754 floating point " "arithmetic, and almost all platforms map Python floats to IEEE-754 \"double " "precision\". 754 doubles contain 53 bits of precision, so on input the " "computer strives to convert 0.1 to the closest fraction it can of the form " "*J*/2**\\ *N* where *J* is an integer containing exactly 53 bits. " "Rewriting ::" msgstr "" "Pourquoi ? 1/10 et 2/10 ne sont pas représentable de manière exacte en " "fractions binaires. Cependant, toutes les machines d'aujourd'hui (Juillet " "2010) suivent la norme IEEE-754 en ce qui concerne l'arithmétique des " "nombres à virgule flottante. et la plupart des plateformes utilisent un " "\"IEEE-754 double precision\" pour représenter les floats de Python. Les " "\"IEEE-754 double precision\" utilisent 53 bits de précision, donc a la " "lecture l'ordinateur essaie de convertir 0.1 dans la fraction la plus proche " "possible de la forme *J*/2**\\ *N* avec *J* un nombre entier d'exactement 53 " "bits. Réecrire : ::" #: ../Doc/tutorial/floatingpoint.rst:173 msgid "as ::" msgstr "en : ::" #: ../Doc/tutorial/floatingpoint.rst:177 msgid "" "and recalling that *J* has exactly 53 bits (is ``>= 2**52`` but ``< " "2**53``), the best value for *N* is 56::" msgstr "" "en se rappelant que *J* fait exactement 53 bits (donc ``>= 2**52`` mais ``< " "2**53``), la meilleure valeur possible pour *N* est 56 : ::" #: ../Doc/tutorial/floatingpoint.rst:187 msgid "" "That is, 56 is the only value for *N* that leaves *J* with exactly 53 bits. " "The best possible value for *J* is then that quotient rounded::" msgstr "" "Donc 56 est la seule valeur possible pour *N* qui laisse exactement 53 bits " "pour *J*. La meilleure valeur possible pour *J* est donc ce quotient, " "arrondi::" #: ../Doc/tutorial/floatingpoint.rst:194 msgid "" "Since the remainder is more than half of 10, the best approximation is " "obtained by rounding up::" msgstr "" "Puisque la retenue est plus grande que la moitié de 10, la meilleure " "approximation est obtenue en arrondissant par le haut : ::" #: ../Doc/tutorial/floatingpoint.rst:200 msgid "" "Therefore the best possible approximation to 1/10 in 754 double precision is " "that over 2\\*\\*56, or ::" msgstr "" "Par conséquent la meilleure approximation possible pour 1/10 en \"IEEE-754 " "double precision\" est cette au desus de 2\\*\\*56, soit : ::" #: ../Doc/tutorial/floatingpoint.rst:205 msgid "" "Note that since we rounded up, this is actually a little bit larger than " "1/10; if we had not rounded up, the quotient would have been a little bit " "smaller than 1/10. But in no case can it be *exactly* 1/10!" msgstr "" "Notez que puisque l'arrondi a été fait vers le haut, le résultat est en " "réalité légèrement plus grand que 1/10 ; si nous n'avions pas arrondi par le " "haut, le quotient aurait été légèrement plus petit que 1/10. Mais dans aucun " "cas il ne vaut *exactement* 1/10 !" #: ../Doc/tutorial/floatingpoint.rst:209 msgid "" "So the computer never \"sees\" 1/10: what it sees is the exact fraction " "given above, the best 754 double approximation it can get::" msgstr "" "Donc l'ordinateur ne \"voit\" jamais 1/10 : ce qu'il voit est la fraction " "exacte donnée ci-dessus, la meilleure approximation utilisant les nombres à " "virgule flottante double précision de l'\"IEEE-754\" : ::" #: ../Doc/tutorial/floatingpoint.rst:215 msgid "" "If we multiply that fraction by 10\\*\\*30, we can see the (truncated) value " "of its 30 most significant decimal digits::" msgstr "" "Si on multiplie cette fraction par 10\\*\\*30, on peut observer les valeurs " "de ses 30 décimales de poid fort." #: ../Doc/tutorial/floatingpoint.rst:221 msgid "" "meaning that the exact number stored in the computer is approximately equal " "to the decimal value 0.100000000000000005551115123125. In versions prior to " "Python 2.7 and Python 3.1, Python rounded this value to 17 significant " "digits, giving '0.10000000000000001'. In current versions, Python displays " "a value based on the shortest decimal fraction that rounds correctly back to " "the true binary value, resulting simply in '0.1'." msgstr "" "signifiant que la valeur exacte stockée dans l'ordinateur est " "approximativement évale à la valeur décimale " "0.100000000000000005551115123125. Dans les versions antérieurs à Python 2.7 " "et Python 3.1, Python arrondissait ces valeurs à 17 décimales " "significatives, affichant '0.10000000000000001'. Dans les versions actuelles " "de Python, la valeur affichée est la valeur dont la fraction est la plus " "courte possible tout en redonnant exactement la même représentation une fois " "reconverti en binaire, affichant simplement '0.1'."