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

{{WebAssemblySidebar}}

The div instructions, short for division, are used for dividing one number by another, similar to the / operator in other languages.

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

Syntax

;; load two numbers onto the stack i32.const 12 i32.const 3 ;; divide one number by the other i32.div_u ;; the top item on the stack will now be 4 (12 / 3 = 4)
InstructionBinary opcode
i32.div_s0x6d
i32.div_u0x6e
i64.div_s0x7f
i64.div_u0x80
f32.div0x95
f64.div0xa3