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

{{WebAssemblySidebar}}

The gt instructions, short for greater than, check if a number is greater than another number. If the first number is greater than the second number equal 1 will be pushed on to the stack, otherwise 0 will be pushed on to the stack.

The integer types have separate greater than instructions for signed (gt_s) and unsigned (gt_u) numbers.

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

Syntax

;; load 2 numbers on to the stack local.get $num i32.const 2 ;; check if $num is greater then '2' i32.gt_u ;; if $num is greater than the `2`, `1` will be pushed on to the stack, ;; otherwise `0` will be pushed on to the stack.
InstructionBinary opcode
i32.gt_s0x4a
i32.gt_u0x4b
i64.gt_s0x55
i64.gt_u0x56
f32.gt0x5e
f64.gt0x64