-
Notifications
You must be signed in to change notification settings - Fork 0
/
BigIntFractionComplex.js
47 lines (46 loc) · 1.56 KB
/
BigIntFractionComplex.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
//@ts-check
"use strict";
/**
* BigInt > Fraction > ComplexNumber
* @class
* @author MAZ <https://MAZ01001.GitHub.io/>
*/
class BigIntFractionComplex{
// TODO
/**
* @typedef {[Boolean,BigInt,BigInt,BigInt]} BigIntFraction Integer fraction `[sign] A + ( B / C )`
*/
/**@returns {BigIntFraction} real part */
get real(){return this._real_;}
/**@returns {BigIntFraction} imaginary part */
get imaginary(){return this._imaginary_;}
/**
* @param {BigIntFraction} real - real part
* @param {BigIntFraction} imaginary - imaginary part
*/
constructor(real,imaginary){
if(
!Array.isArray(real)
||real.length!==4
||real.some((v,i)=>i===0?typeof v!=="boolean":typeof v!=="bigint")
)throw new TypeError("[BigIntFractionComplex:constructor] real is not a BigIntFraction type");
if(
!Array.isArray(imaginary)
||imaginary.length!==4
||imaginary.some((v,i)=>i===0?typeof v!=="boolean":typeof v!=="bigint")
)throw new TypeError("[BigIntFractionComplex:constructor] real is not a BigIntFraction type");
this._real_=real;
this._imaginary_=imaginary;
}
/**
* __get the object (string) descriptor__
* @readonly
*/
get[Symbol.toStringTag](){return "BigIntFractionComplex"}
// TODO
};
module.exports=BigIntFractionComplex;
//~ import like this
// const BigIntFractionComplex = require("./BigIntFractionComplex.js");
// Object.freeze(BigIntFractionComplex.prototype);
// Object.freeze(BigIntFractionComplex);