Skip to content

Commit dfea79d

Browse files
committed
update specs
1 parent 7e3111e commit dfea79d

File tree

1 file changed

+5
-5
lines changed

1 file changed

+5
-5
lines changed

doc/specs/stdlib_stats.md

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -189,14 +189,14 @@ Experimental
189189
Returns the median of all the elements of `array`, or of the elements of `array` along dimension `dim` if provided, and if the corresponding element in `mask` is `true`.
190190

191191
After that the elements are sorted in an increasing order, e.g. `array_sorted =
192-
sort(array)`, the median of the elements of `array` are defined as, if
193-
`n = size(array)` is an even number:
192+
sort(array)`, the median of the elements of `array` is defined as the "middle"
193+
element. If `n = size(array)` is an even number, the median is:
194194

195195
```
196196
median(array) = array_sorted( floor( (n + 1) / 2.))
197197
```
198198

199-
or as if `n` is an odd number:
199+
and if `n` is an odd number, the median is:
200200

201201
```
202202
median(array) = mean( array_sorted( floor( (n + 1) / 2.):floor( (n + 1) / 2.) + 1 ) )
@@ -217,15 +217,15 @@ Generic subroutine
217217

218218
### Arguments
219219

220-
`array`: Shall be an array of type `integer` or `real`.
220+
`array`: Shall be an array of type `integer` or `real`.
221221

222222
`dim`: Shall be a scalar of type `integer` with a value in the range from 1 to `n`, where `n` is the rank of `array`.
223223

224224
`mask` (optional): Shall be of type `logical` and either a scalar or an array of the same shape as `array`.
225225

226226
### Return value
227227

228-
If `array` is of type `real`, the result is of the same type as `array`.
228+
If `array` is of type `real`, the result is of type `real` with the same kind as `array`.
229229
If `array` is of type `integer`, the result is of type `real(dp)`.
230230

231231
If `dim` is absent, a scalar with the median of all elements in `array` is returned. Otherwise, an array of rank `n-1`, where `n` equals the rank of `array`, and a shape similar to that of `array` with dimension `dim` dropped is returned.

0 commit comments

Comments
 (0)