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

{{WebAssemblySidebar}}

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

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

Syntax

;; load a number onto the stack f32.const -2.7 ;; round to the nearest integer f32.nearest ;; the top item on the stack will now be -3
InstructionBinary opcode
f32.nearest0x90
f64.nearest0x9e