forked from cory/tildefriends
quickjs-2021-03-27.tar.xz
git-svn-id: https://www.unprompted.com/svn/projects/tildefriends/trunk@3649 ed5197a5-7fde-0310-b194-c3ffbd925b24
This commit is contained in:
13
deps/quickjs/qjscalc.js
vendored
13
deps/quickjs/qjscalc.js
vendored
@@ -2299,8 +2299,13 @@ var Integer, Float, Fraction, Complex, Mod, Polynomial, PolyMod, RationalFunctio
|
||||
function array_div(a, b) {
|
||||
return array_mul(a, b.inverse());
|
||||
}
|
||||
function array_scalar_div(a, b) {
|
||||
return a * b.inverse();
|
||||
function array_element_wise_inverse(a) {
|
||||
var r, i, n;
|
||||
n = a.length;
|
||||
r = [];
|
||||
for(i = 0; i < n; i++)
|
||||
r[i] = a[i].inverse();
|
||||
return r;
|
||||
}
|
||||
function array_eq(a, b) {
|
||||
var n, i;
|
||||
@@ -2337,14 +2342,14 @@ var Integer, Float, Fraction, Complex, Mod, Polynomial, PolyMod, RationalFunctio
|
||||
right: [Number, BigInt, Float, Fraction, Complex, Mod,
|
||||
Polynomial, PolyMod, RationalFunction, Series],
|
||||
"*": array_scalar_mul,
|
||||
"/": array_scalar_div,
|
||||
"/"(a, b) { return a * b.inverse(); },
|
||||
"**": generic_pow, /* XXX: only for integer */
|
||||
},
|
||||
{
|
||||
left: [Number, BigInt, Float, Fraction, Complex, Mod,
|
||||
Polynomial, PolyMod, RationalFunction, Series],
|
||||
"*"(a, b) { return array_scalar_mul(b, a); },
|
||||
"/"(a, b) { return array_scalar_div(b, a); },
|
||||
"/"(a, b) { return a * array_element_wise_inverse(b); },
|
||||
});
|
||||
|
||||
add_props(Array.prototype, {
|
||||
|
Reference in New Issue
Block a user