Code Duplication    Length = 33-33 lines in 2 locations

src/PhpSpreadsheet/Calculation/Engineering.php 2 locations

@@ 1014-1046 (lines=33) @@
1011
     *
1012
     * @return    float
1013
     */
1014
    public static function BESSELK($x, $ord)
1015
    {
1016
        $x = (is_null($x)) ? 0.0 : Functions::flattenSingleValue($x);
1017
        $ord = (is_null($ord)) ? 0.0 : Functions::flattenSingleValue($ord);
1018
1019
        if ((is_numeric($x)) && (is_numeric($ord))) {
1020
            if (($ord < 0) || ($x == 0.0)) {
1021
                return Functions::NAN();
1022
            }
1023
1024
            switch (floor($ord)) {
1025
                case 0:
1026
                    $fBk = self::besselK0($x);
1027
                    break;
1028
                case 1:
1029
                    $fBk = self::besselK1($x);
1030
                    break;
1031
                default:
1032
                    $fTox = 2 / $x;
1033
                    $fBkm = self::besselK0($x);
1034
                    $fBk = self::besselK1($x);
1035
                    for ($n = 1; $n < $ord; ++$n) {
1036
                        $fBkp = $fBkm + $n * $fTox * $fBk;
1037
                        $fBkm = $fBk;
1038
                        $fBk = $fBkp;
1039
                    }
1040
            }
1041
1042
            return (is_nan($fBk)) ? Functions::NAN() : $fBk;
1043
        }
1044
1045
        return Functions::VALUE();
1046
    }
1047
1048
    private static function besselY0($fNum)
1049
    {
@@ 1101-1133 (lines=33) @@
1098
     *
1099
     * @return    float
1100
     */
1101
    public static function BESSELY($x, $ord)
1102
    {
1103
        $x = (is_null($x)) ? 0.0 : Functions::flattenSingleValue($x);
1104
        $ord = (is_null($ord)) ? 0.0 : Functions::flattenSingleValue($ord);
1105
1106
        if ((is_numeric($x)) && (is_numeric($ord))) {
1107
            if (($ord < 0) || ($x == 0.0)) {
1108
                return Functions::NAN();
1109
            }
1110
1111
            switch (floor($ord)) {
1112
                case 0:
1113
                    $fBy = self::besselY0($x);
1114
                    break;
1115
                case 1:
1116
                    $fBy = self::besselY1($x);
1117
                    break;
1118
                default:
1119
                    $fTox = 2 / $x;
1120
                    $fBym = self::besselY0($x);
1121
                    $fBy = self::besselY1($x);
1122
                    for ($n = 1; $n < $ord; ++$n) {
1123
                        $fByp = $n * $fTox * $fBy - $fBym;
1124
                        $fBym = $fBy;
1125
                        $fBy = $fByp;
1126
                    }
1127
            }
1128
1129
            return (is_nan($fBy)) ? Functions::NAN() : $fBy;
1130
        }
1131
1132
        return Functions::VALUE();
1133
    }
1134
1135
    /**
1136
     * BINTODEC.