Book a Demo!
CoCalc Logo Icon
StoreFeaturesDocsShareSupportNewsAboutPoliciesSign UpSign In
mohamedkhallouq
GitHub Repository: mohamedkhallouq/content
Path: blob/main/files/en-us/webassembly/reference/numeric/convert/index.md
6510 views
---
title: Convert slug: WebAssembly/Reference/Numeric/Convert
---

{{WebAssemblySidebar}}

The convert instructions, are used for converting integer numbers to floating point numbers. There are signed and unsigned versions of this instruction.

{{EmbedInteractiveExample("pages/wat/convert.html", "tabbed-taller")}}

Syntax

;; 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
InstructionBinary opcode
f32.convert_i32_s0xb2
f32.convert_i32_u0xb3
f32.convert_i64_s0xb4
f32.convert_i64_u0xb5
f64.convert_i32_s0xb7
f64.convert_i32_u0xb8
f64.convert_i64_s0xb9
f64.convert_i64_u0xba