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
6699ab83
Commit
6699ab83
authored
Jun 02, 2017
by
GoshaZotov
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
add cIMCSC / cIMCSCH formulas
parent
070642df
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
142 additions
and
26 deletions
+142
-26
cell/.unit-tests/FormulaTests.js
cell/.unit-tests/FormulaTests.js
+12
-0
cell/model/FormulaObjects/_xlfnFunctions.js
cell/model/FormulaObjects/_xlfnFunctions.js
+1
-25
cell/model/FormulaObjects/engineeringFunctions.js
cell/model/FormulaObjects/engineeringFunctions.js
+129
-1
No files found.
cell/.unit-tests/FormulaTests.js
View file @
6699ab83
...
...
@@ -2050,6 +2050,18 @@ $( function () {
strictEqual
(
oParser
.
calculate
().
getValue
(),
"
0.004901182394304475-0.9992669278059015i
"
,
'
IMCOT("4+3i")
'
);
}
);
test
(
"
Test:
\"
IMCSC
\"
"
,
function
()
{
oParser
=
new
parserFormula
(
'
IMCSC("4+3i")
'
,
"
A2
"
,
ws
);
ok
(
oParser
.
parse
(),
'
IMCSC("4+3i")
'
);
strictEqual
(
oParser
.
calculate
().
getValue
(),
"
-0.0754898329158637+0.06487747137063551i
"
,
'
IMCSC("4+3i")
'
);
}
);
test
(
"
Test:
\"
IMCSCH
\"
"
,
function
()
{
oParser
=
new
parserFormula
(
'
IMCSCH("4+3i")
'
,
"
A2
"
,
ws
);
ok
(
oParser
.
parse
(),
'
IMCSCH("4+3i")
'
);
strictEqual
(
oParser
.
calculate
().
getValue
(),
"
-0.03627588962862601-0.0051744731840193976i
"
,
'
IMCSCH("4+3i")
'
);
}
);
test
(
"
Test:
\"
IMTAN
\"
"
,
function
()
{
oParser
=
new
parserFormula
(
'
IMTAN("4+3i")
'
,
"
A2
"
,
ws
);
ok
(
oParser
.
parse
(),
'
IMTAN("4+3i")
'
);
...
...
cell/model/FormulaObjects/_xlfnFunctions.js
View file @
6699ab83
...
...
@@ -52,7 +52,7 @@
cFormulaFunctionGroup
[
'
DateAndTime
'
].
push
(
cDAYS
,
cISOWEEKNUM
);
cFormulaFunctionGroup
[
'
Engineering
'
]
=
cFormulaFunctionGroup
[
'
Engineering
'
]
||
[];
cFormulaFunctionGroup
[
'
Engineering
'
].
push
(
cBITAND
,
cBITLSHIFT
,
cBITOR
,
cBITRSHIFT
,
cBITXOR
,
cERF_PRECISE
,
cERFC_PRECISE
,
cIM
CSC
,
cIMCSCH
,
cIM
SEC
,
cIMSECH
,
cIMSINH
);
cERFC_PRECISE
,
cIMSEC
,
cIMSECH
,
cIMSINH
);
cFormulaFunctionGroup
[
'
TextAndData
'
]
=
cFormulaFunctionGroup
[
'
TextAndData
'
]
||
[];
cFormulaFunctionGroup
[
'
TextAndData
'
].
push
(
cDBCS
,
cNUMBERVALUE
,
cUNICHAR
,
cUNICODE
);
cFormulaFunctionGroup
[
'
Statistical
'
]
=
cFormulaFunctionGroup
[
'
Statistical
'
]
||
[];
...
...
@@ -616,30 +616,6 @@
cIFNA
.
prototype
=
Object
.
create
(
cBaseFunction
.
prototype
);
cIFNA
.
prototype
.
constructor
=
cIFNA
;
/**
* @constructor
* @extends {AscCommonExcel.cBaseFunction}
*/
function
cIMCSC
()
{
cBaseFunction
.
call
(
this
,
"
IMCSC
"
);
this
.
isXLFN
=
true
;
}
cIMCSC
.
prototype
=
Object
.
create
(
cBaseFunction
.
prototype
);
cIMCSC
.
prototype
.
constructor
=
cIMCSC
;
/**
* @constructor
* @extends {AscCommonExcel.cBaseFunction}
*/
function
cIMCSCH
()
{
cBaseFunction
.
call
(
this
,
"
IMCSCH
"
);
this
.
isXLFN
=
true
;
}
cIMCSCH
.
prototype
=
Object
.
create
(
cBaseFunction
.
prototype
);
cIMCSCH
.
prototype
.
constructor
=
cIMCSCH
;
/**
* @constructor
* @extends {AscCommonExcel.cBaseFunction}
...
...
cell/model/FormulaObjects/engineeringFunctions.js
View file @
6699ab83
...
...
@@ -500,6 +500,22 @@
}
else
{
this
.
real
=
Math
.
cosh
(
this
.
real
);
}
},
Csc
:
function
()
{
if
(
this
.
img
)
{
var
a
=
(
2
*
Math
.
sin
(
this
.
real
)
*
Math
.
cosh
(
this
.
img
))
/
(
Math
.
cosh
(
2
*
this
.
img
)
-
Math
.
cos
(
2
*
this
.
real
));
this
.
img
=
(
-
2
*
Math
.
cos
(
this
.
real
)
*
Math
.
sinh
(
this
.
img
))
/
(
Math
.
cosh
(
2
*
this
.
img
)
-
Math
.
cos
(
2
*
this
.
real
));
this
.
real
=
a
;
}
else
{
this
.
real
=
1
/
Math
.
sin
(
this
.
real
);
}
},
Csch
:
function
()
{
if
(
this
.
img
)
{
var
a
=
(
2
*
Math
.
sinh
(
this
.
real
)
*
Math
.
cos
(
this
.
img
))
/
(
Math
.
cosh
(
2
*
this
.
real
)
-
Math
.
cos
(
2
*
this
.
img
));
this
.
img
=
(
-
2
*
Math
.
cosh
(
this
.
real
)
*
Math
.
sin
(
this
.
img
))
/
(
Math
.
cosh
(
2
*
this
.
real
)
-
Math
.
cos
(
2
*
this
.
img
));
this
.
real
=
a
;
}
else
{
this
.
real
=
1
/
Math
.
sinh
(
this
.
real
);
}
},
Sin
:
function
()
{
if
(
this
.
img
)
{
var
a
=
Math
.
sin
(
this
.
real
)
*
Math
.
cosh
(
this
.
img
);
...
...
@@ -897,7 +913,7 @@
cFormulaFunctionGroup
[
'
Engineering
'
]
=
cFormulaFunctionGroup
[
'
Engineering
'
]
||
[];
cFormulaFunctionGroup
[
'
Engineering
'
].
push
(
cBESSELI
,
cBESSELJ
,
cBESSELK
,
cBESSELY
,
cBIN2DEC
,
cBIN2HEX
,
cBIN2OCT
,
cCOMPLEX
,
cCONVERT
,
cDEC2BIN
,
cDEC2HEX
,
cDEC2OCT
,
cDELTA
,
cERF
,
cERFC
,
cGESTEP
,
cHEX2BIN
,
cHEX2DEC
,
cHEX2OCT
,
cIMABS
,
cIMAGINARY
,
cIMARGUMENT
,
cIMCONJUGATE
,
cIMCOS
,
cIMCOSH
,
cIMCOT
,
cIMDIV
,
cIMEXP
,
cIMLN
,
cIMLOG10
,
cIMLOG2
,
cIMPOWER
,
cIMABS
,
cIMAGINARY
,
cIMARGUMENT
,
cIMCONJUGATE
,
cIMCOS
,
cIMCOSH
,
cIMCOT
,
cIM
CSC
,
cIMCSCH
,
cIM
DIV
,
cIMEXP
,
cIMLN
,
cIMLOG10
,
cIMLOG2
,
cIMPOWER
,
cIMPRODUCT
,
cIMREAL
,
cIMSIN
,
cIMSQRT
,
cIMSUB
,
cIMSUM
,
cIMTAN
,
cOCT2BIN
,
cOCT2DEC
,
cOCT2HEX
);
/**
...
...
@@ -2188,6 +2204,118 @@
};
};
/**
* @constructor
* @extends {AscCommonExcel.cBaseFunction}
*/
function
cIMCSC
()
{
cBaseFunction
.
call
(
this
,
"
IMCSC
"
);
}
//TODO проверить!!!
cIMCSC
.
prototype
=
Object
.
create
(
cBaseFunction
.
prototype
);
cIMCSC
.
prototype
.
constructor
=
cIMCSC
;
cIMCSC
.
prototype
.
argumentsMin
=
1
;
cIMCSC
.
prototype
.
argumentsMax
=
1
;
cIMCSC
.
prototype
.
isXLFN
=
true
;
cIMCSC
.
prototype
.
Calculate
=
function
(
arg
)
{
var
arg0
=
arg
[
0
];
if
(
arg0
instanceof
cArea
||
arg0
instanceof
cArea3D
)
{
arg0
=
arg0
.
cross
(
arguments
[
1
]);
}
else
if
(
arg0
instanceof
cArray
)
{
arg0
=
arg0
.
getElementRowCol
(
0
,
0
);
}
if
(
arg0
.
value
===
true
||
arg0
.
value
===
false
){
return
this
.
value
=
new
cError
(
cErrorType
.
wrong_value_type
);
}
arg0
=
arg0
.
tocString
();
if
(
arg0
instanceof
cError
)
{
return
this
.
value
=
arg0
;
}
if
(
0
==
arg0
.
value
){
return
this
.
value
=
new
cError
(
cErrorType
.
not_numeric
);
}
var
c
=
new
Complex
(
arg0
.
toString
());
if
(
c
instanceof
cError
)
{
return
this
.
value
=
c
;
}
c
.
Csc
();
this
.
value
=
new
cString
(
c
.
toString
());
this
.
value
.
numFormat
=
0
;
return
this
.
value
;
};
cIMCSC
.
prototype
.
getInfo
=
function
()
{
return
{
name
:
this
.
name
,
args
:
"
( complex-number )
"
};
};
/**
* @constructor
* @extends {AscCommonExcel.cBaseFunction}
*/
function
cIMCSCH
()
{
cBaseFunction
.
call
(
this
,
"
IMCSCH
"
);
}
//TODO проверить!!!
cIMCSCH
.
prototype
=
Object
.
create
(
cBaseFunction
.
prototype
);
cIMCSCH
.
prototype
.
constructor
=
cIMCSCH
;
cIMCSCH
.
prototype
.
argumentsMin
=
1
;
cIMCSCH
.
prototype
.
argumentsMax
=
1
;
cIMCSCH
.
prototype
.
isXLFN
=
true
;
cIMCSCH
.
prototype
.
Calculate
=
function
(
arg
)
{
var
arg0
=
arg
[
0
];
if
(
arg0
instanceof
cArea
||
arg0
instanceof
cArea3D
)
{
arg0
=
arg0
.
cross
(
arguments
[
1
]);
}
else
if
(
arg0
instanceof
cArray
)
{
arg0
=
arg0
.
getElementRowCol
(
0
,
0
);
}
if
(
arg0
.
value
===
true
||
arg0
.
value
===
false
){
return
this
.
value
=
new
cError
(
cErrorType
.
wrong_value_type
);
}
arg0
=
arg0
.
tocString
();
if
(
arg0
instanceof
cError
)
{
return
this
.
value
=
arg0
;
}
if
(
0
==
arg0
.
value
){
return
this
.
value
=
new
cError
(
cErrorType
.
not_numeric
);
}
var
c
=
new
Complex
(
arg0
.
toString
());
if
(
c
instanceof
cError
)
{
return
this
.
value
=
c
;
}
c
.
Csch
();
this
.
value
=
new
cString
(
c
.
toString
());
this
.
value
.
numFormat
=
0
;
return
this
.
value
;
};
cIMCSCH
.
prototype
.
getInfo
=
function
()
{
return
{
name
:
this
.
name
,
args
:
"
( complex-number )
"
};
};
/**
* @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