Longhorn PHP 2025 - Call For Papers

The RoundingMode Enum

(PHP 8 >= 8.4.0)

Introduction

The RoundingMode enum is used to specify how rounding should be performed for round(), bcround(), and BcMath\Number::round().

Enum synopsis

enum RoundingMode
{
case HalfAwayFromZero ; / Round to the nearest integer. If the decimal part is 5, round to the integer with the larger absolute value.

case HalfTowardsZero ; / Round to the nearest integer. If the decimal part is 5, round to the integer with the smaller absolute value.

case HalfEven ; / Round to the nearest integer. If the decimal part is 5, round to the even integer.

case HalfOdd ; / Round to the nearest integer. If the decimal part is 5, round to the odd integer.

case TowardsZero ; / Round to the nearest integer with a smaller or equal absolute value.

case AwayFromZero ; / Round to the nearest integer with a greater or equal absolute value.

case NegativeInfinity ; / Round to the largest integer that is smaller or equal.

case PositiveInfinity ; / Round to the smallest integer that is greater or equal.

}
add a note

User Contributed Notes

There are no user contributed notes for this page.
To Top

Follow Lee on X/Twitter - Father, Husband, Serial builder creating AI, crypto, games & web tools. We are friends :) AI Will Come To Life!

Check out: eBank.nz (Art Generator) | Netwrck.com (AI Tools) | Text-Generator.io (AI API) | BitBank.nz (Crypto AI) | ReadingTime (Kids Reading) | RewordGame | BigMultiplayerChess | WebFiddle | How.nz | Helix AI Assistant