Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
S
sdkjs
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Boris Kocherov
sdkjs
Commits
22c80a68
Commit
22c80a68
authored
May 30, 2017
by
GoshaZotov
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
add CEILING.MATH formula
parent
ff491ea4
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
79 additions
and
14 deletions
+79
-14
cell/.unit-tests/FormulaTests.js
cell/.unit-tests/FormulaTests.js
+18
-0
cell/model/FormulaObjects/_xlfnFunctions.js
cell/model/FormulaObjects/_xlfnFunctions.js
+1
-13
cell/model/FormulaObjects/mathematicFunctions.js
cell/model/FormulaObjects/mathematicFunctions.js
+60
-1
No files found.
cell/.unit-tests/FormulaTests.js
View file @
22c80a68
...
...
@@ -810,6 +810,24 @@ $( function () {
strictEqual
(
oParser
.
calculate
().
getValue
(),
-
4
,
'
FLOOR.MATH(-5.5, 2, -1)
'
);
}
);
test
(
"
Test:
\"
CEILING.MATH
\"
"
,
function
()
{
oParser
=
new
parserFormula
(
'
CEILING.MATH(24.3, 5)
'
,
"
A1
"
,
ws
);
ok
(
oParser
.
parse
(),
'
CEILING.MATH(24.3, 5)
'
);
strictEqual
(
oParser
.
calculate
().
getValue
(),
25
,
'
CEILING.MATH(24.3, 5)
'
);
oParser
=
new
parserFormula
(
'
CEILING.MATH(6.7)
'
,
"
A1
"
,
ws
);
ok
(
oParser
.
parse
(),
'
CEILING.MATH(6.7)
'
);
strictEqual
(
oParser
.
calculate
().
getValue
(),
7
,
'
CEILING.MATH(6.7)
'
);
oParser
=
new
parserFormula
(
'
CEILING.MATH(-8.1, 2)
'
,
"
A1
"
,
ws
);
ok
(
oParser
.
parse
(),
'
CEILING.MATH(-8.1, 2)
'
);
strictEqual
(
oParser
.
calculate
().
getValue
(),
-
8
,
'
CEILING.MATH(-8.1, 2)
'
);
oParser
=
new
parserFormula
(
'
CEILING.MATH(-5.5, 2, -1)
'
,
"
A1
"
,
ws
);
ok
(
oParser
.
parse
(),
'
CEILING.MATH(-5.5, 2, -1)
'
);
strictEqual
(
oParser
.
calculate
().
getValue
(),
-
6
,
'
CEILING.MATH(-5.5, 2, -1)
'
);
}
);
test
(
"
Test:
\"
ARABIC('LVII')
\"
"
,
function
()
{
oParser
=
new
parserFormula
(
'
ARABIC("LVII")
'
,
"
A1
"
,
ws
);
ok
(
oParser
.
parse
()
);
...
...
cell/model/FormulaObjects/_xlfnFunctions.js
View file @
22c80a68
...
...
@@ -68,7 +68,7 @@
cFormulaFunctionGroup
[
'
Financial
'
]
=
cFormulaFunctionGroup
[
'
Financial
'
]
||
[];
cFormulaFunctionGroup
[
'
Financial
'
].
push
(
cPDURATION
,
cRRI
);
cFormulaFunctionGroup
[
'
Mathematic
'
]
=
cFormulaFunctionGroup
[
'
Mathematic
'
]
||
[];
cFormulaFunctionGroup
[
'
Mathematic
'
].
push
(
cAGGREGATE
,
cBASE
,
cCEILING_
MATH
,
cCEILING_
PRECISE
,
cFormulaFunctionGroup
[
'
Mathematic
'
].
push
(
cAGGREGATE
,
cBASE
,
cCEILING_PRECISE
,
cCOMBINA
,
cDECIMAL
,
cMUNIT
);
cFormulaFunctionGroup
[
'
LookupAndReference
'
]
=
cFormulaFunctionGroup
[
'
LookupAndReference
'
]
||
[];
cFormulaFunctionGroup
[
'
LookupAndReference
'
].
push
(
cFORMULATEXT
);
...
...
@@ -221,18 +221,6 @@
cBITXOR
.
prototype
=
Object
.
create
(
cBaseFunction
.
prototype
);
cBITXOR
.
prototype
.
constructor
=
cBITXOR
;
/**
* @constructor
* @extends {AscCommonExcel.cBaseFunction}
*/
function
cCEILING_MATH
()
{
cBaseFunction
.
call
(
this
,
"
CEILING.MATH
"
);
this
.
isXLFN
=
true
;
}
cCEILING_MATH
.
prototype
=
Object
.
create
(
cBaseFunction
.
prototype
);
cCEILING_MATH
.
prototype
.
constructor
=
cCEILING_MATH
;
/**
* @constructor
* @extends {AscCommonExcel.cBaseFunction}
...
...
cell/model/FormulaObjects/mathematicFunctions.js
View file @
22c80a68
...
...
@@ -56,7 +56,7 @@
var
_func
=
AscCommonExcel
.
_func
;
cFormulaFunctionGroup
[
'
Mathematic
'
]
=
cFormulaFunctionGroup
[
'
Mathematic
'
]
||
[];
cFormulaFunctionGroup
[
'
Mathematic
'
].
push
(
cABS
,
cACOS
,
cACOSH
,
cACOT
,
cACOTH
,
cARABIC
,
cASIN
,
cASINH
,
cATAN
,
cATAN2
,
cATANH
,
cCEILING
,
cFormulaFunctionGroup
[
'
Mathematic
'
].
push
(
cABS
,
cACOS
,
cACOSH
,
cACOT
,
cACOTH
,
cARABIC
,
cASIN
,
cASINH
,
cATAN
,
cATAN2
,
cATANH
,
cCEILING
,
cCEILING_MATH
,
cCOMBIN
,
cCOS
,
cCOSH
,
cCOT
,
cCOTH
,
cCSC
,
cCSCH
,
cDEGREES
,
cECMA_CEILING
,
cEVEN
,
cEXP
,
cFACT
,
cFACTDOUBLE
,
cFLOOR
,
cFLOOR_PRECISE
,
cFLOOR_MATH
,
cGCD
,
cINT
,
cISO_CEILING
,
cLCM
,
cLN
,
cLOG
,
cLOG10
,
cMDETERM
,
cMINVERSE
,
cMMULT
,
cMOD
,
cMROUND
,
cMULTINOMIAL
,
cODD
,
cPI
,
cPOWER
,
cPRODUCT
,
cQUOTIENT
,
cRADIANS
,
cRAND
,
cRANDBETWEEN
,
cROMAN
,
cROUND
,
cROUNDDOWN
,
cROUNDUP
,
cSEC
,
cSECH
,
cSERIESSUM
,
...
...
@@ -713,6 +713,65 @@
};
};
/**
* @constructor
* @extends {AscCommonExcel.cBaseFunction}
*/
function
cCEILING_MATH
()
{
this
.
name
=
"
CEILING.MATH
"
;
this
.
value
=
null
;
this
.
argumentsCurrent
=
0
;
}
cCEILING_MATH
.
prototype
=
Object
.
create
(
cBaseFunction
.
prototype
);
cCEILING_MATH
.
prototype
.
constructor
=
cCEILING_MATH
;
cCEILING_MATH
.
prototype
.
argumentsMin
=
1
;
cCEILING_MATH
.
prototype
.
argumentsMax
=
3
;
cCEILING_MATH
.
prototype
.
isXLFN
=
true
;
cCEILING_MATH
.
prototype
.
Calculate
=
function
(
arg
)
{
var
argClone
=
[];
argClone
[
0
]
=
this
.
_checkCAreaArg
(
arg
[
0
],
arguments
[
1
]);
argClone
[
1
]
=
this
.
_checkCAreaArg
(
arg
[
1
],
arguments
[
1
]);
argClone
[
2
]
=
this
.
_checkCAreaArg
(
arg
[
2
],
arguments
[
1
]);
argClone
[
0
]
=
argClone
[
0
].
tocNumber
();
if
(
!
argClone
[
1
]){
argClone
[
1
]
=
argClone
[
0
]
>
0
?
new
cNumber
(
1
)
:
new
cNumber
(
-
1
);
}
argClone
[
2
]
=
argClone
[
2
]
?
argClone
[
2
].
tocNumber
()
:
new
cNumber
(
0
);
var
argError
;
if
(
false
!==
(
argError
=
this
.
_checkErrorArg
(
argClone
))){
return
this
.
value
=
argError
;
}
function
floor_math
(
argArray
)
{
var
number
=
argArray
[
0
];
var
significance
=
argArray
[
1
];
var
mod
=
argArray
[
2
];
if
(
significance
===
0
||
number
===
0
)
{
return
new
cNumber
(
0.0
);
}
if
(
number
*
significance
<
0.0
)
significance
=
-
significance
;
if
(
mod
===
0
&&
number
<
0.0
){
return
new
cNumber
(
Math
.
floor
(
number
/
significance
)
*
significance
);
}
else
{
return
new
cNumber
(
Math
.
ceil
(
number
/
significance
)
*
significance
);
}
}
return
this
.
value
=
this
.
_findArrayInNumberArguments
(
argClone
,
floor_math
);
};
cCEILING_MATH
.
prototype
.
getInfo
=
function
()
{
return
{
name
:
this
.
name
,
args
:
"
( x, significance, mode )
"
};
};
/**
* @constructor
* @extends {AscCommonExcel.cBaseFunction}
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment