This commit is contained in:
2026-09-12 18:12:13 +02:00
parent 18306bdc8c
commit 57ae671f88
27 changed files with 2060 additions and 623 deletions

View File

@@ -1,8 +1,8 @@
# Exemples / DO-DON'T — Chapitre 24 — Casts et conversions
> Document compagnon non normatif tant qu'une règle n'est pas explicitement référencée comme normative par le chapitre.
> Document compagnon. Les exemples illustrent les règles du chapitre ; la formulation normative reste dans le chapitre lui-même.
## Exemples actuellement présents dans le chapitre
## Exemples extraits du chapitre
### Exemple 1
@@ -66,19 +66,112 @@ wrapToTarget()
### Exemple 6
```text
tryExactToInt32()
tryFloorToInt32()
tryCeilToInt32()
tryRoundToInt32()
tryTruncateToInt32()
tryToIntXX()
tryToUintXX()
```
### Exemple 7
```text
floor()
ceil()
round()
truncate()
```
### Exemple 8
```text
value::floor()::tryToInt32()
value::ceil()::tryToInt32()
value::round()::tryToInt32()
value::truncate()::tryToInt32()
```
### Exemple 9
```text
value::floor()::trySaturateToInt32()
value::round()::tryWrapToInt32()
```
### Exemple 10
```text
NaN -> NaN
+Infinity -> +Infinity
-Infinity -> -Infinity
+0 -> +0
-0 -> -0
```
### Exemple 11
```text
payload NaN
quiet/signaling bit
signe du NaN
représentation binaire exacte
```
### Exemple 12
```text
tryToFloatXX()
exige une représentation exacte
tryRoundToFloatXX()
accepte l'arrondi canonique
refuse une valeur finie hors domaine fini destination
saturatingRoundToFloatXX()
accepte l'arrondi canonique
sature une valeur finie hors domaine vers +/-Target::Max
```
### Exemple 13
```text
NotFinite
NotIntegral
OutOfRange
Inexact
```
### Exemple 14
```text
NotFinite
NaN ou +/-Infinity lorsqu'une valeur finie est requise
NotIntegral
float -> integer alors que la valeur n'est pas mathématiquement entière
OutOfRange
valeur mathématique hors du domaine de la destination
Inexact
valeur dans le domaine destination mais non représentable exactement
alors que l'opération exige l'exactitude
```
### Exemple 15
```text
sourceType
targetType
sourceValue
timestamp
backend
roundingMode
```
### Exemple 16
```text
annexes/A-numeric-conversions.md
```
## DO / DON'T / WHY / compiler error / edge cases
La couverture structurée de cette section sera enrichie au fur et à mesure de la fermeture des règles du chapitre. La migration `0.2.12` conserve volontairement les exemples historiques dans le chapitre afin de ne perdre aucun contexte normatif.
À consolider progressivement avant la baseline publique V3 et à transformer, lorsque pertinent, en tests de conformité de la toolchain.