Glossary entry (derived from question below)
French term or phrase:
la valeur (est) tronquée pour supporter la représentation dans le type primitif
English translation:
value is truncated to conform to the primitive type representattion
Added to glossary by
veratek
Nov 3, 2010 07:18
13 yrs ago
2 viewers *
French term
la valeur tronquée pour supporter la représentation dans le type primitif
French to English
Tech/Engineering
IT (Information Technology)
JAVA
Utiliser les constructeurs BigDecimal et BigInteger à base de chaînes de caractères.
Lorsqu’on crée un BigDecimal (resp. BigInteger) à partir d’une constante du type primitif double (resp.integer), la valeur tronquée pour supporter la représentation dans le type primitif :
//EVITER
BigDecimal num = new BigDecimal(8250325.12f);
//PREFERER
BigDecimal num = new BigDecimal(“8250325.12”);
Lorsqu’on crée un BigDecimal (resp. BigInteger) à partir d’une constante du type primitif double (resp.integer), la valeur tronquée pour supporter la représentation dans le type primitif :
//EVITER
BigDecimal num = new BigDecimal(8250325.12f);
//PREFERER
BigDecimal num = new BigDecimal(“8250325.12”);
Proposed translations
(English)
4 +1 | value is truncated to conform to the primitive type representattion | Kiwiland Bear |
Proposed translations
+1
1 hr
Selected
value is truncated to conform to the primitive type representattion
I believe the value is rounded actually, not truncated but it is a possibility.
What they mean is that when you use the first form (eviter) the value you enter is first converted to double type and only then to the BigDecimal. Because not all decimal fractions can be exactly represented as binary, some rounding will be needed. This causes loss of precision.
If you use the second form (preferer), the value is converted directly into decimal with no loss.
What they mean is that when you use the first form (eviter) the value you enter is first converted to double type and only then to the BigDecimal. Because not all decimal fractions can be exactly represented as binary, some rounding will be needed. This causes loss of precision.
If you use the second form (preferer), the value is converted directly into decimal with no loss.
4 KudoZ points awarded for this answer.
Comment: "Thanks."
Discussion
Lorsqu’on crée un BigDecimal (resp. BigInteger) à partir d’une constante du type primitif double (resp.integer), la valeur tronquée pour supporter la représentation dans le type primitif