| [ Web Proxy ] |
| Viewing: https://developer.mozilla.org/de/docs/WebAssembly/Reference/Numeric/convert | [Back] [Original] |
Get to know MDN better
Dieser Inhalt wurde automatisch aus dem Englischen bersetzt, und kann Fehler enthalten. Erfahre mehr ber dieses Experiment.
Die convert numerische Anweisungen werden verwendet, um Ganzzahlen in Fliekommazahlen umzuwandeln. Es gibt signierte und unsignierte Versionen dieser Anweisung.
(module
(import "console" "log" (func $log (param f32)))
(func $main
i32.const 10 ;; push an i32 onto the stack
f32.convert_i32_s ;; convert from signed i32 to f32
call $log ;; log the result
)
(start $main)
)
const url = "{%wasm-url%}";
await WebAssembly.instantiateStreaming(fetch(url), { console });
;; push an i32 onto the stack
i32.const 10
;; convert from signed i32 to f32
f32.convert_i32_s
;; the top item on the stack will now be the value 10 of type f32
| Anweisung | Binrer Opcode |
|---|---|
f32.convert_i32_s |
0xb2 |
f32.convert_i32_u |
0xb3 |
f32.convert_i64_s |
0xb4 |
f32.convert_i64_u |
0xb5 |
f64.convert_i32_s |
0xb7 |
f64.convert_i32_u |
0xb8 |
f64.convert_i64_s |
0xb9 |
f64.convert_i64_u |
0xba |
| Spezifikation |
|---|
| WebAssembly Core Specification # numeric-instructions%E2%91%A8 |
Der Bauplan fr ein besseres Internet.
Teile dieses Inhalts sind 19982026 von einzelnen mozilla.org-Mitwirkenden. Inhalte sind verfgbar unter einer Creative-Commons-Lizenz.
| Web Proxy Viewer | New URL | Original Page |