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
e4c3ee23
Commit
e4c3ee23
authored
May 30, 2017
by
GoshaZotov
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
add cISO_CEILING formula
parent
be268e1d
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
66 additions
and
2 deletions
+66
-2
cell/.unit-tests/FormulaTests.js
cell/.unit-tests/FormulaTests.js
+27
-1
cell/model/FormulaObjects/mathematicFunctions.js
cell/model/FormulaObjects/mathematicFunctions.js
+39
-1
No files found.
cell/.unit-tests/FormulaTests.js
View file @
e4c3ee23
...
@@ -810,7 +810,7 @@ $( function () {
...
@@ -810,7 +810,7 @@ $( function () {
strictEqual
(
oParser
.
calculate
().
getValue
(),
-
4
,
'
FLOOR.MATH(-5.5, 2, -1)
'
);
strictEqual
(
oParser
.
calculate
().
getValue
(),
-
4
,
'
FLOOR.MATH(-5.5, 2, -1)
'
);
}
);
}
);
test
(
"
Test:
\"
CEILING.
PRECISE
\"
"
,
function
()
{
test
(
"
Test:
\"
CEILING.
MATH
\"
"
,
function
()
{
oParser
=
new
parserFormula
(
'
CEILING.MATH(24.3, 5)
'
,
"
A1
"
,
ws
);
oParser
=
new
parserFormula
(
'
CEILING.MATH(24.3, 5)
'
,
"
A1
"
,
ws
);
ok
(
oParser
.
parse
(),
'
CEILING.MATH(24.3, 5)
'
);
ok
(
oParser
.
parse
(),
'
CEILING.MATH(24.3, 5)
'
);
strictEqual
(
oParser
.
calculate
().
getValue
(),
25
,
'
CEILING.MATH(24.3, 5)
'
);
strictEqual
(
oParser
.
calculate
().
getValue
(),
25
,
'
CEILING.MATH(24.3, 5)
'
);
...
@@ -858,6 +858,32 @@ $( function () {
...
@@ -858,6 +858,32 @@ $( function () {
strictEqual
(
oParser
.
calculate
().
getValue
(),
"
#NAME?
"
,
'
CEILING.PRECISE(test)
'
);
strictEqual
(
oParser
.
calculate
().
getValue
(),
"
#NAME?
"
,
'
CEILING.PRECISE(test)
'
);
}
);
}
);
test
(
"
Test:
\"
ISO.CEILING
\"
"
,
function
()
{
oParser
=
new
parserFormula
(
'
ISO.CEILING(4.3)
'
,
"
A1
"
,
ws
);
ok
(
oParser
.
parse
(),
'
ISO.CEILING(4.3)
'
);
strictEqual
(
oParser
.
calculate
().
getValue
(),
5
,
'
ISO.CEILING(4.3)
'
);
oParser
=
new
parserFormula
(
'
ISO.CEILING(-4.3)
'
,
"
A1
"
,
ws
);
ok
(
oParser
.
parse
(),
'
ISO.CEILING(-4.3)
'
);
strictEqual
(
oParser
.
calculate
().
getValue
(),
-
4
,
'
ISO.CEILING(-4.3)
'
);
oParser
=
new
parserFormula
(
'
ISO.CEILING(4.3, 2)
'
,
"
A1
"
,
ws
);
ok
(
oParser
.
parse
(),
'
ISO.CEILING(4.3, 2)
'
);
strictEqual
(
oParser
.
calculate
().
getValue
(),
6
,
'
ISO.CEILING(4.3, 2)
'
);
oParser
=
new
parserFormula
(
'
ISO.CEILING(4.3,-2)
'
,
"
A1
"
,
ws
);
ok
(
oParser
.
parse
(),
'
ISO.CEILING(4.3,-2)
'
);
strictEqual
(
oParser
.
calculate
().
getValue
(),
6
,
'
ISO.CEILING(4.3,-2)
'
);
oParser
=
new
parserFormula
(
'
ISO.CEILING(-4.3,2)
'
,
"
A1
"
,
ws
);
ok
(
oParser
.
parse
(),
'
ISO.CEILING(-4.3,2)
'
);
strictEqual
(
oParser
.
calculate
().
getValue
(),
-
4
,
'
ISO.CEILING(-4.3,2)
'
);
oParser
=
new
parserFormula
(
'
ISO.CEILING(-4.3,-2)
'
,
"
A1
"
,
ws
);
ok
(
oParser
.
parse
(),
'
ISO.CEILING(-4.3,-2)
'
);
strictEqual
(
oParser
.
calculate
().
getValue
(),
-
4
,
'
ISO.CEILING(-4.3,-2)
'
);
}
);
test
(
"
Test:
\"
ARABIC('LVII')
\"
"
,
function
()
{
test
(
"
Test:
\"
ARABIC('LVII')
\"
"
,
function
()
{
oParser
=
new
parserFormula
(
'
ARABIC("LVII")
'
,
"
A1
"
,
ws
);
oParser
=
new
parserFormula
(
'
ARABIC("LVII")
'
,
"
A1
"
,
ws
);
ok
(
oParser
.
parse
()
);
ok
(
oParser
.
parse
()
);
...
...
cell/model/FormulaObjects/mathematicFunctions.js
View file @
e4c3ee23
...
@@ -1875,12 +1875,50 @@
...
@@ -1875,12 +1875,50 @@
* @constructor
* @constructor
* @extends {AscCommonExcel.cBaseFunction}
* @extends {AscCommonExcel.cBaseFunction}
*/
*/
//TODO точная копия функции CEILING.PRECISE. зачем excel две одинаковые функции?
function
cISO_CEILING
()
{
function
cISO_CEILING
()
{
cBaseFunction
.
call
(
this
,
"
ISO_CEILING
"
);
this
.
name
=
"
ISO.CEILING
"
;
this
.
value
=
null
;
this
.
argumentsCurrent
=
0
;
}
}
cISO_CEILING
.
prototype
=
Object
.
create
(
cBaseFunction
.
prototype
);
cISO_CEILING
.
prototype
=
Object
.
create
(
cBaseFunction
.
prototype
);
cISO_CEILING
.
prototype
.
constructor
=
cISO_CEILING
;
cISO_CEILING
.
prototype
.
constructor
=
cISO_CEILING
;
cISO_CEILING
.
prototype
.
argumentsMin
=
1
;
cISO_CEILING
.
prototype
.
argumentsMax
=
2
;
//cISO_CEILING.prototype.isXLFN = true;
cISO_CEILING
.
prototype
.
Calculate
=
function
(
arg
)
{
var
argClone
=
[];
argClone
[
0
]
=
this
.
_checkCAreaArg
(
arg
[
0
],
arguments
[
1
]);
argClone
[
1
]
=
this
.
_checkCAreaArg
(
arg
[
1
],
arguments
[
1
]);
argClone
[
0
]
=
argClone
[
0
].
tocNumber
();
argClone
[
1
]
=
argClone
[
1
]
?
argClone
[
1
].
tocNumber
()
:
new
cNumber
(
1
);
var
argError
;
if
(
false
!==
(
argError
=
this
.
_checkErrorArg
(
argClone
))){
return
this
.
value
=
argError
;
}
function
floorHelper
(
argArray
)
{
var
number
=
argArray
[
0
];
var
significance
=
argArray
[
1
];
if
(
significance
===
0
||
number
===
0
)
{
return
new
cNumber
(
0.0
);
}
var
absSignificance
=
Math
.
abs
(
significance
);
var
quotient
=
number
/
absSignificance
;
return
new
cNumber
(
Math
.
ceil
(
quotient
)
*
absSignificance
);
}
return
this
.
value
=
this
.
_findArrayInNumberArguments
(
argClone
,
floorHelper
);
};
cISO_CEILING
.
prototype
.
getInfo
=
function
()
{
return
{
name
:
this
.
name
,
args
:
"
( x, significance )
"
};
};
/**
/**
* @constructor
* @constructor
...
...
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