-
Notifications
You must be signed in to change notification settings - Fork 8k
/
index.md
59 lines (37 loc) · 1.46 KB
/
index.md
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
---
title: DataView.prototype.getFloat32()
slug: Web/JavaScript/Reference/Global_Objects/DataView/getFloat32
---
{{JSRef}}
La méthode **`getFloat32()`** permet de lire un nombre flottant signé sur 32 bits à l'octet donné par rapport au début de {{jsxref("DataView")}}.
{{EmbedInteractiveExample("pages/js/dataview-getfloat32.html")}}
## Syntaxe
```js
dataview.getFloat32(positionOctet [, littleEndian])
```
### Paramètres
- `positionOctet`
- : La position, exprimée en nombre d'octets depuis le début de la vue, à laquelle lire les données.
- `littleEndian`
- : {{optional_inline}} indique si la valeur sur 32 bits est enregistrée dans l'ordre des octets {{Glossary("Endianness", "de poids faible")}}. Si le paramètre vaut `false` ou `undefined`, la valeur sera lue dans l'ordre des octets de poids forts.
### Valeur de retour
Un nombre flottant signé, sur 32 bits.
### Erreurs renvoyées
- {{jsxref("RangeError")}}
- : Renvoyée si `positionOctet` est tel qu'il est en dehors de la vue.
## Description
Il n'y a pas de contrainte d'alignement, les valeurs codées sur plusieurs octets peuvent être obtenues depuis n'importe quelle position.
## Exemples
### Utilisation de la méthode `getFloat32`
```js
var buffer = new ArrayBuffer(8);
var dataview = new DataView(buffer);
dataview.getFloat32(1); // 0
```
## Spécifications
{{Specifications}}
## Compatibilité des navigateurs
{{Compat}}
## Voir aussi
- {{jsxref("DataView")}}
- {{jsxref("ArrayBuffer")}}