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
786b0714
Commit
786b0714
authored
May 29, 2017
by
GoshaZotov
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
add FLOOR.PRECISE formula
parent
23bafd3b
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
98 additions
and
14 deletions
+98
-14
cell/model/FormulaObjects/_xlfnFunctions.js
cell/model/FormulaObjects/_xlfnFunctions.js
+1
-13
cell/model/FormulaObjects/mathematicFunctions.js
cell/model/FormulaObjects/mathematicFunctions.js
+97
-1
No files found.
cell/model/FormulaObjects/_xlfnFunctions.js
View file @
786b0714
...
...
@@ -69,7 +69,7 @@
cFormulaFunctionGroup
[
'
Financial
'
].
push
(
cPDURATION
,
cRRI
);
cFormulaFunctionGroup
[
'
Mathematic
'
]
=
cFormulaFunctionGroup
[
'
Mathematic
'
]
||
[];
cFormulaFunctionGroup
[
'
Mathematic
'
].
push
(
cAGGREGATE
,
cBASE
,
cCEILING_MATH
,
cCEILING_PRECISE
,
cCOMBINA
,
cDECIMAL
,
cFLOOR_MATH
,
c
FLOOR_PRECISE
,
c
MUNIT
);
cCOMBINA
,
cDECIMAL
,
cFLOOR_MATH
,
cMUNIT
);
cFormulaFunctionGroup
[
'
LookupAndReference
'
]
=
cFormulaFunctionGroup
[
'
LookupAndReference
'
]
||
[];
cFormulaFunctionGroup
[
'
LookupAndReference
'
].
push
(
cFORMULATEXT
);
cFormulaFunctionGroup
[
'
Information
'
]
=
cFormulaFunctionGroup
[
'
Information
'
]
||
[];
...
...
@@ -521,18 +521,6 @@
cFLOOR_MATH
.
prototype
=
Object
.
create
(
cBaseFunction
.
prototype
);
cFLOOR_MATH
.
prototype
.
constructor
=
cFLOOR_MATH
;
/**
* @constructor
* @extends {AscCommonExcel.cBaseFunction}
*/
function
cFLOOR_PRECISE
()
{
cBaseFunction
.
call
(
this
,
"
FLOOR.PRECISE
"
);
this
.
isXLFN
=
true
;
}
cFLOOR_PRECISE
.
prototype
=
Object
.
create
(
cBaseFunction
.
prototype
);
cFLOOR_PRECISE
.
prototype
.
constructor
=
cFLOOR_PRECISE
;
/**
* @constructor
* @extends {AscCommonExcel.cBaseFunction}
...
...
cell/model/FormulaObjects/mathematicFunctions.js
View file @
786b0714
...
...
@@ -57,7 +57,7 @@
cFormulaFunctionGroup
[
'
Mathematic
'
]
=
cFormulaFunctionGroup
[
'
Mathematic
'
]
||
[];
cFormulaFunctionGroup
[
'
Mathematic
'
].
push
(
cABS
,
cACOS
,
cACOSH
,
cACOT
,
cACOTH
,
cARABIC
,
cASIN
,
cASINH
,
cATAN
,
cATAN2
,
cATANH
,
cCEILING
,
cCOMBIN
,
cCOS
,
cCOSH
,
cCOT
,
cCOTH
,
cCSC
,
cCSCH
,
cDEGREES
,
cECMA_CEILING
,
cEVEN
,
cEXP
,
cFACT
,
cFACTDOUBLE
,
cFLOOR
,
cGCD
,
cINT
,
cCOMBIN
,
cCOS
,
cCOSH
,
cCOT
,
cCOTH
,
cCSC
,
cCSCH
,
cDEGREES
,
cECMA_CEILING
,
cEVEN
,
cEXP
,
cFACT
,
cFACTDOUBLE
,
cFLOOR
,
c
FLOOR_PRECISE
,
c
GCD
,
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
,
cSIGN
,
cSIN
,
cSINH
,
cSQRT
,
cSQRTPI
,
cSUBTOTAL
,
cSUM
,
cSUMIF
,
cSUMIFS
,
cSUMPRODUCT
,
cSUMSQ
,
cSUMX2MY2
,
cSUMX2PY2
,
...
...
@@ -1510,6 +1510,102 @@
};
};
/**
* @constructor
* @extends {AscCommonExcel.cBaseFunction}
*/
function
cFLOOR_PRECISE
()
{
this
.
name
=
"
FLOOR.PRECISE
"
;
this
.
value
=
null
;
this
.
argumentsCurrent
=
0
;
}
cFLOOR_PRECISE
.
prototype
=
Object
.
create
(
cBaseFunction
.
prototype
);
cFLOOR_PRECISE
.
prototype
.
constructor
=
cFLOOR_PRECISE
;
cFLOOR_PRECISE
.
prototype
.
argumentsMin
=
1
;
cFLOOR_PRECISE
.
prototype
.
argumentsMax
=
2
;
cFLOOR_PRECISE
.
prototype
.
isXLFN
=
true
;
cFLOOR_PRECISE
.
prototype
.
Calculate
=
function
(
arg
)
{
var
arg0
=
arg
[
0
],
arg1
=
arg
[
1
];
if
(
arg0
instanceof
cArea
||
arg0
instanceof
cArea3D
)
{
arg0
=
arg0
.
cross
(
arguments
[
1
]);
}
if
(
arg1
instanceof
cArea
||
arg1
instanceof
cArea3D
)
{
arg1
=
arg1
.
cross
(
arguments
[
1
]);
}
arg0
=
arg
[
0
].
tocNumber
();
if
(
arg
[
1
]){
arg1
=
arg
[
1
].
tocNumber
();
}
else
{
arg1
=
new
cNumber
(
1
);
}
if
(
arg0
instanceof
cError
)
{
return
this
.
value
=
arg0
;
}
if
(
arg1
instanceof
cError
)
{
return
this
.
value
=
arg1
;
}
function
floorHelper
(
number
,
significance
)
{
if
(
significance
===
0
||
number
===
0
)
{
return
new
cNumber
(
0.0
);
}
var
sign
=
number
>
0
?
1
:
-
1
;
var
quotient
=
Math
.
abs
(
number
/
significance
);
return
new
cNumber
(
sign
*
Math
.
floor
(
quotient
)
*
Math
.
abs
(
significance
));
}
if
(
arg0
instanceof
cArray
&&
arg1
instanceof
cArray
)
{
arg0
.
foreach
(
function
(
elem
,
r
,
c
)
{
var
a
=
elem
;
var
b
=
arg1
.
getElementRowCol
(
r
,
c
);
if
(
a
instanceof
cNumber
&&
b
instanceof
cNumber
)
{
this
.
array
[
r
][
c
]
=
floorHelper
(
a
.
getValue
(),
b
.
getValue
())
}
else
{
this
.
array
[
r
][
c
]
=
new
cError
(
cErrorType
.
wrong_value_type
);
}
});
return
this
.
value
=
arg0
;
}
else
if
(
arg0
instanceof
cArray
)
{
arg0
.
foreach
(
function
(
elem
,
r
,
c
)
{
var
a
=
elem
;
var
b
=
arg1
;
if
(
a
instanceof
cNumber
&&
b
instanceof
cNumber
)
{
this
.
array
[
r
][
c
]
=
floorHelper
(
a
.
getValue
(),
b
.
getValue
())
}
else
{
this
.
array
[
r
][
c
]
=
new
cError
(
cErrorType
.
wrong_value_type
);
}
});
return
this
.
value
=
arg0
;
}
else
if
(
arg1
instanceof
cArray
)
{
arg1
.
foreach
(
function
(
elem
,
r
,
c
)
{
var
a
=
arg0
;
var
b
=
elem
;
if
(
a
instanceof
cNumber
&&
b
instanceof
cNumber
)
{
this
.
array
[
r
][
c
]
=
floorHelper
(
a
.
getValue
(),
b
.
getValue
())
}
else
{
this
.
array
[
r
][
c
]
=
new
cError
(
cErrorType
.
wrong_value_type
);
}
});
return
this
.
value
=
arg1
;
}
if
(
arg0
instanceof
cString
||
arg1
instanceof
cString
)
{
return
this
.
value
=
new
cError
(
cErrorType
.
wrong_value_type
);
}
return
this
.
value
=
floorHelper
(
arg0
.
getValue
(),
arg1
.
getValue
());
};
cFLOOR_PRECISE
.
prototype
.
getInfo
=
function
()
{
return
{
name
:
this
.
name
,
args
:
"
( x, significance )
"
};
};
/**
* @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