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

{{WebAssemblySidebar}}

The floor instructions, are used for getting the value of a number rounded down to the next integer.

floor differs from trunc when used on negative numbers, floor will round down in those cases while trunc will round up.

{{EmbedInteractiveExample("pages/wat/floor.html", "tabbed-standard")}}

Syntax

;; load a number onto the stack f32.const -2.7 ;; round down f32.floor ;; the top item on the stack will now be -3
InstructionBinary opcode
f32.floor0x8e
f64.floor0x9c