Explorar o código

document Math.round tie behaviour (closes #5447)

Dan Korostelev %!s(int64=9) %!d(string=hai) anos
pai
achega
6d422f34fa
Modificáronse 1 ficheiros con 4 adicións e 0 borrados
  1. 4 0
      std/Math.hx

+ 4 - 0
std/Math.hx

@@ -205,6 +205,8 @@ extern class Math
 	/**
 	/**
 		Rounds `v` to the nearest integer value.
 		Rounds `v` to the nearest integer value.
 
 
+		Ties are rounded up, so that `0.5` becomes `1` and `-0.5` becomes `0`.
+
 		If `v` is outside of the signed `Int32` range, or is `NaN`, `NEGATIVE_INFINITY`
 		If `v` is outside of the signed `Int32` range, or is `NaN`, `NEGATIVE_INFINITY`
 		or `POSITIVE_INFINITY`, the result is unspecified.
 		or `POSITIVE_INFINITY`, the result is unspecified.
 	**/
 	**/
@@ -252,6 +254,8 @@ extern class Math
 	/**
 	/**
 		Rounds `v` to the nearest integer value, as a Float.
 		Rounds `v` to the nearest integer value, as a Float.
 
 
+		Ties are rounded up, so that `0.5` becomes `1` and `-0.5` becomes `0`.
+
 		If `v` is is `NaN`, `NEGATIVE_INFINITY` or `POSITIVE_INFINITY`,
 		If `v` is is `NaN`, `NEGATIVE_INFINITY` or `POSITIVE_INFINITY`,
 		the result is unspecified.
 		the result is unspecified.
 	**/
 	**/