Comparing version 0.9.0-0 to 0.10.0-0
{ | ||
"name": "preciso", | ||
"version": "0.9.0-0", | ||
"version": "0.10.0-0", | ||
"description": "Precise Mathematical Functions", | ||
@@ -31,2 +31,3 @@ "main": "preciso.js", | ||
"fraction.js", | ||
"hypotenuse.js", | ||
"is_even.js", | ||
@@ -75,2 +76,3 @@ "is_factorial.js", | ||
"sort.js", | ||
"square.js", | ||
"square_root.js", | ||
@@ -77,0 +79,0 @@ "subtract.js", |
@@ -8,2 +8,4 @@ "use strict"; | ||
const is_integer = require("./is_integer"); | ||
const is_imaginary = require("./is_imaginary.js"); | ||
const is_odd = require("./is_odd.js"); | ||
const is_zero = require("./is_zero.js"); | ||
@@ -17,2 +19,3 @@ const multiply = require("./multiply.js"); | ||
const simplify_fraction = require("./simplify_fraction.js"); | ||
const is_even = require("./is_even.js"); | ||
@@ -26,2 +29,3 @@ function pow( | ||
ellipsis = false, | ||
imaginary = true, | ||
max_decimal_digits = 100, | ||
@@ -34,2 +38,5 @@ fraction: use_fraction = false | ||
const base_is_imaginary = is_imaginary(base); | ||
if (base_is_imaginary) base = base.replace(/i$/, ""); | ||
const base_is_zero = is_zero(base); | ||
@@ -65,2 +72,3 @@ const exponent_is_zero = is_zero(exponent); | ||
} | ||
if (base_is_imaginary && is_odd(exponent)) product += "i"; | ||
return product; | ||
@@ -67,0 +75,0 @@ } |
@@ -21,2 +21,3 @@ /* global define */ | ||
// const gregory_leibniz = require("./gregory_leibniz.js"); | ||
const hypotenuse = require("./hypotenuse.js"); | ||
const is_factorial = require("./is_factorial.js"); | ||
@@ -78,2 +79,3 @@ const is_infinity = require("./is_infinity.js"); | ||
// gregory_leibniz, | ||
hypotenuse, | ||
is_infinity, | ||
@@ -80,0 +82,0 @@ is_integer, |
@@ -28,2 +28,3 @@ # preciso | ||
- [floor](#floor) | ||
- [hypotenuse](#hypotenuse) | ||
- [max](#max) | ||
@@ -194,2 +195,19 @@ - [mean](#mean) | ||
### hypotenuse | ||
Calculate Hypotenuse in two or more dimensions. This was inspired by [Math.hypot](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Math/hypot). | ||
```js | ||
import hypotenuse from "preciso/hypotenuse.js"; | ||
hypotenuse("3", "4") | ||
"5" | ||
// calculate in three or more dimensions | ||
hypotenuse("3", "4", "5", { max_decimal_digits: 10 }) | ||
"7.0710678118" | ||
// imaginary number support | ||
hypotenuse("3i", "4i") | ||
"5" | ||
``` | ||
### max | ||
@@ -196,0 +214,0 @@ ```js |
Sorry, the diff of this file is too big to display
142358
74
3607
375