chengkun
2025-06-05 4080b5997b38ca84b3b203c7101dcadb97b76925
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
<?php
 
namespace PhpOffice\PhpSpreadsheet\Calculation\Statistical;
 
class StandardDeviations
{
    /**
     * STDEV.
     *
     * Estimates standard deviation based on a sample. The standard deviation is a measure of how
     *        widely values are dispersed from the average value (the mean).
     *
     * Excel Function:
     *        STDEV(value1[,value2[, ...]])
     *
     * @param mixed ...$args Data values
     *
     * @return float|string The result, or a string containing an error
     */
    public static function STDEV(mixed ...$args)
    {
        $result = Variances::VAR(...$args);
        if (!is_numeric($result)) {
            return $result;
        }
 
        return sqrt((float) $result);
    }
 
    /**
     * STDEVA.
     *
     * Estimates standard deviation based on a sample, including numbers, text, and logical values
     *
     * Excel Function:
     *        STDEVA(value1[,value2[, ...]])
     *
     * @param mixed ...$args Data values
     */
    public static function STDEVA(mixed ...$args): float|string
    {
        $result = Variances::VARA(...$args);
        if (!is_numeric($result)) {
            return $result;
        }
 
        return sqrt((float) $result);
    }
 
    /**
     * STDEVP.
     *
     * Calculates standard deviation based on the entire population
     *
     * Excel Function:
     *        STDEVP(value1[,value2[, ...]])
     *
     * @param mixed ...$args Data values
     */
    public static function STDEVP(mixed ...$args): float|string
    {
        $result = Variances::VARP(...$args);
        if (!is_numeric($result)) {
            return $result;
        }
 
        return sqrt((float) $result);
    }
 
    /**
     * STDEVPA.
     *
     * Calculates standard deviation based on the entire population, including numbers, text, and logical values
     *
     * Excel Function:
     *        STDEVPA(value1[,value2[, ...]])
     *
     * @param mixed ...$args Data values
     */
    public static function STDEVPA(mixed ...$args): float|string
    {
        $result = Variances::VARPA(...$args);
        if (!is_numeric($result)) {
            return $result;
        }
 
        return sqrt((float) $result);
    }
}