Path: blob/main/files/en-us/webassembly/reference/numeric/index.md
6517 views
------{{WebAssemblySidebar}}
WebAssembly numeric instructions.
Constants
: Declare a constant numbers.
Comparison
: Check if two numbers are equal.
: Check if two numbers are not equal.
: Check if a number is greater than another number.
: Check if a number is less than another number.
: Check if a number is greater than or equal to another number.
: Check if a number is less than or equal to another number.
Arithmetic
: Add up two numbers.
: Subtract one number from another number.
: Multiply one number by another number.
: Divide one number by another number.
: Calculate the remainder left over when one integer is divided by another integer.
Conversion
: Convert (extend)
i32toi64.
: Convert (wrap)
i64toi32.
: Convert (promote)
f32tof64.
: Convert (demote)
f64tof32.
: Convert integers to floating points.
: Convert (truncate fractional part) floating points to integers.
: Reinterpret the bytes of integers as floating points and vice versa.
Floating point specific instructions
: Get the lower of two numbers.
: Get the higher of two numbers.
: Round a number to the nearest integer.
: Round up a number.
: Round down a number.
: Discard the fractional part of a number.
: Get the absolute value of a number.
: Negate a number.
: Get the square root of a number.
: Copy just the sign bit from one number to another.
Bitwise
: Used for performing a bitwise AND.
: Used for performing a bitwise OR.
: Used for performing a bitwise XOR.
: Used for performing a bitwise left-shift.
: Used for performing a bitwise left-shift.
: Used for performing a bitwise left-rotate.
: Used for performing a bitwise right-rotate.
: Count the amount of leading zeros in a numbers binary representation.
: Count the amount of trailing zeros in a numbers binary representation.
: Count the total amount of 1s in a numbers binary representation.