@fluixi/utils 1.0.0-alpha.53

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (354) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +73 -0
  3. package/dist/index.cjs +1 -0
  4. package/dist/index.d.ts +2 -0
  5. package/dist/index.d.ts.map +1 -0
  6. package/dist/index.js +1 -0
  7. package/dist/index.mjs +1 -0
  8. package/dist/lib/array/advanced.cjs +1 -0
  9. package/dist/lib/array/advanced.d.ts +1116 -0
  10. package/dist/lib/array/advanced.d.ts.map +1 -0
  11. package/dist/lib/array/advanced.js +2429 -0
  12. package/dist/lib/array/advanced.mjs +1 -0
  13. package/dist/lib/array/array.cjs +1 -0
  14. package/dist/lib/array/array.d.ts +6 -0
  15. package/dist/lib/array/array.d.ts.map +1 -0
  16. package/dist/lib/array/array.js +31 -0
  17. package/dist/lib/array/array.mjs +1 -0
  18. package/dist/lib/array/index.cjs +1 -0
  19. package/dist/lib/array/index.d.ts +4 -0
  20. package/dist/lib/array/index.d.ts.map +1 -0
  21. package/dist/lib/array/index.js +3 -0
  22. package/dist/lib/array/index.mjs +1 -0
  23. package/dist/lib/array/utils.cjs +1 -0
  24. package/dist/lib/array/utils.d.ts +100 -0
  25. package/dist/lib/array/utils.d.ts.map +1 -0
  26. package/dist/lib/array/utils.js +165 -0
  27. package/dist/lib/array/utils.mjs +1 -0
  28. package/dist/lib/color/color.cjs +1 -0
  29. package/dist/lib/color/color.d.ts +366 -0
  30. package/dist/lib/color/color.d.ts.map +1 -0
  31. package/dist/lib/color/color.js +722 -0
  32. package/dist/lib/color/color.mjs +1 -0
  33. package/dist/lib/color/constants.cjs +1 -0
  34. package/dist/lib/color/constants.d.ts +361 -0
  35. package/dist/lib/color/constants.d.ts.map +1 -0
  36. package/dist/lib/color/constants.js +358 -0
  37. package/dist/lib/color/constants.mjs +1 -0
  38. package/dist/lib/color/conversions.cjs +1 -0
  39. package/dist/lib/color/conversions.d.ts +166 -0
  40. package/dist/lib/color/conversions.d.ts.map +1 -0
  41. package/dist/lib/color/conversions.js +766 -0
  42. package/dist/lib/color/conversions.mjs +1 -0
  43. package/dist/lib/color/helpers.cjs +1 -0
  44. package/dist/lib/color/helpers.d.ts +75 -0
  45. package/dist/lib/color/helpers.d.ts.map +1 -0
  46. package/dist/lib/color/helpers.js +419 -0
  47. package/dist/lib/color/helpers.mjs +1 -0
  48. package/dist/lib/color/index.cjs +1 -0
  49. package/dist/lib/color/index.d.ts +12 -0
  50. package/dist/lib/color/index.d.ts.map +1 -0
  51. package/dist/lib/color/index.js +15 -0
  52. package/dist/lib/color/index.mjs +1 -0
  53. package/dist/lib/color/types.cjs +1 -0
  54. package/dist/lib/color/types.d.ts +179 -0
  55. package/dist/lib/color/types.d.ts.map +1 -0
  56. package/dist/lib/color/types.js +1 -0
  57. package/dist/lib/color/types.mjs +0 -0
  58. package/dist/lib/color/utils.cjs +1 -0
  59. package/dist/lib/color/utils.d.ts +199 -0
  60. package/dist/lib/color/utils.d.ts.map +1 -0
  61. package/dist/lib/color/utils.js +858 -0
  62. package/dist/lib/color/utils.mjs +1 -0
  63. package/dist/lib/compare/comparators.cjs +1 -0
  64. package/dist/lib/compare/comparators.d.ts +65 -0
  65. package/dist/lib/compare/comparators.d.ts.map +1 -0
  66. package/dist/lib/compare/comparators.js +210 -0
  67. package/dist/lib/compare/comparators.mjs +1 -0
  68. package/dist/lib/compare/index.cjs +1 -0
  69. package/dist/lib/compare/index.d.ts +2 -0
  70. package/dist/lib/compare/index.d.ts.map +1 -0
  71. package/dist/lib/compare/index.js +1 -0
  72. package/dist/lib/compare/index.mjs +1 -0
  73. package/dist/lib/crypto/hash.cjs +1 -0
  74. package/dist/lib/crypto/hash.d.ts +6 -0
  75. package/dist/lib/crypto/hash.d.ts.map +1 -0
  76. package/dist/lib/crypto/hash.js +53 -0
  77. package/dist/lib/crypto/hash.mjs +1 -0
  78. package/dist/lib/crypto/index.cjs +1 -0
  79. package/dist/lib/crypto/index.d.ts +2 -0
  80. package/dist/lib/crypto/index.d.ts.map +1 -0
  81. package/dist/lib/crypto/index.js +1 -0
  82. package/dist/lib/crypto/index.mjs +1 -0
  83. package/dist/lib/dom/events.cjs +1 -0
  84. package/dist/lib/dom/events.d.ts +159 -0
  85. package/dist/lib/dom/events.d.ts.map +1 -0
  86. package/dist/lib/dom/events.js +50 -0
  87. package/dist/lib/dom/events.mjs +1 -0
  88. package/dist/lib/dom/index.cjs +1 -0
  89. package/dist/lib/dom/index.d.ts +3 -0
  90. package/dist/lib/dom/index.d.ts.map +1 -0
  91. package/dist/lib/dom/index.js +2 -0
  92. package/dist/lib/dom/index.mjs +1 -0
  93. package/dist/lib/dom/utils.cjs +1 -0
  94. package/dist/lib/dom/utils.d.ts +6 -0
  95. package/dist/lib/dom/utils.d.ts.map +1 -0
  96. package/dist/lib/dom/utils.js +37 -0
  97. package/dist/lib/dom/utils.mjs +1 -0
  98. package/dist/lib/functions/functions.cjs +1 -0
  99. package/dist/lib/functions/functions.d.ts +329 -0
  100. package/dist/lib/functions/functions.d.ts.map +1 -0
  101. package/dist/lib/functions/functions.js +585 -0
  102. package/dist/lib/functions/functions.mjs +1 -0
  103. package/dist/lib/functions/index.cjs +1 -0
  104. package/dist/lib/functions/index.d.ts +3 -0
  105. package/dist/lib/functions/index.d.ts.map +1 -0
  106. package/dist/lib/functions/index.js +1 -0
  107. package/dist/lib/functions/index.mjs +1 -0
  108. package/dist/lib/functions/types.cjs +1 -0
  109. package/dist/lib/functions/types.d.ts +2 -0
  110. package/dist/lib/functions/types.d.ts.map +1 -0
  111. package/dist/lib/functions/types.js +1 -0
  112. package/dist/lib/functions/types.mjs +0 -0
  113. package/dist/lib/helpers.cjs +1 -0
  114. package/dist/lib/helpers.d.ts +13 -0
  115. package/dist/lib/helpers.d.ts.map +1 -0
  116. package/dist/lib/helpers.js +66 -0
  117. package/dist/lib/helpers.mjs +1 -0
  118. package/dist/lib/index.cjs +1 -0
  119. package/dist/lib/index.d.ts +6 -0
  120. package/dist/lib/index.d.ts.map +1 -0
  121. package/dist/lib/index.js +8 -0
  122. package/dist/lib/index.mjs +1 -0
  123. package/dist/lib/maths/constants.cjs +1 -0
  124. package/dist/lib/maths/constants.d.ts +84 -0
  125. package/dist/lib/maths/constants.d.ts.map +1 -0
  126. package/dist/lib/maths/constants.js +79 -0
  127. package/dist/lib/maths/constants.mjs +1 -0
  128. package/dist/lib/maths/fn/advanced.cjs +1 -0
  129. package/dist/lib/maths/fn/advanced.d.ts +149 -0
  130. package/dist/lib/maths/fn/advanced.d.ts.map +1 -0
  131. package/dist/lib/maths/fn/advanced.js +264 -0
  132. package/dist/lib/maths/fn/advanced.mjs +1 -0
  133. package/dist/lib/maths/fn/basic.cjs +1 -0
  134. package/dist/lib/maths/fn/basic.d.ts +182 -0
  135. package/dist/lib/maths/fn/basic.d.ts.map +1 -0
  136. package/dist/lib/maths/fn/basic.js +343 -0
  137. package/dist/lib/maths/fn/basic.mjs +1 -0
  138. package/dist/lib/maths/fn/complex.cjs +1 -0
  139. package/dist/lib/maths/fn/complex.d.ts +153 -0
  140. package/dist/lib/maths/fn/complex.d.ts.map +1 -0
  141. package/dist/lib/maths/fn/complex.js +383 -0
  142. package/dist/lib/maths/fn/complex.mjs +1 -0
  143. package/dist/lib/maths/fn/index.cjs +1 -0
  144. package/dist/lib/maths/fn/index.d.ts +10 -0
  145. package/dist/lib/maths/fn/index.d.ts.map +1 -0
  146. package/dist/lib/maths/fn/index.js +9 -0
  147. package/dist/lib/maths/fn/index.mjs +1 -0
  148. package/dist/lib/maths/fn/trigo.cjs +1 -0
  149. package/dist/lib/maths/fn/trigo.d.ts +147 -0
  150. package/dist/lib/maths/fn/trigo.d.ts.map +1 -0
  151. package/dist/lib/maths/fn/trigo.js +227 -0
  152. package/dist/lib/maths/fn/trigo.mjs +1 -0
  153. package/dist/lib/maths/fn/vector.cjs +1 -0
  154. package/dist/lib/maths/fn/vector.d.ts +512 -0
  155. package/dist/lib/maths/fn/vector.d.ts.map +1 -0
  156. package/dist/lib/maths/fn/vector.js +1136 -0
  157. package/dist/lib/maths/fn/vector.mjs +1 -0
  158. package/dist/lib/maths/formatter.cjs +1 -0
  159. package/dist/lib/maths/formatter.d.ts +35 -0
  160. package/dist/lib/maths/formatter.d.ts.map +1 -0
  161. package/dist/lib/maths/formatter.js +56 -0
  162. package/dist/lib/maths/formatter.mjs +1 -0
  163. package/dist/lib/maths/guards.cjs +1 -0
  164. package/dist/lib/maths/guards.d.ts +166 -0
  165. package/dist/lib/maths/guards.d.ts.map +1 -0
  166. package/dist/lib/maths/guards.js +315 -0
  167. package/dist/lib/maths/guards.mjs +1 -0
  168. package/dist/lib/maths/index.cjs +1 -0
  169. package/dist/lib/maths/index.d.ts +24 -0
  170. package/dist/lib/maths/index.d.ts.map +1 -0
  171. package/dist/lib/maths/index.js +29 -0
  172. package/dist/lib/maths/index.mjs +1 -0
  173. package/dist/lib/maths/parser.cjs +1 -0
  174. package/dist/lib/maths/parser.d.ts +20 -0
  175. package/dist/lib/maths/parser.d.ts.map +1 -0
  176. package/dist/lib/maths/parser.js +78 -0
  177. package/dist/lib/maths/parser.mjs +1 -0
  178. package/dist/lib/maths/random.cjs +1 -0
  179. package/dist/lib/maths/random.d.ts +27 -0
  180. package/dist/lib/maths/random.d.ts.map +1 -0
  181. package/dist/lib/maths/random.js +49 -0
  182. package/dist/lib/maths/random.mjs +1 -0
  183. package/dist/lib/maths/types/advanced.cjs +1 -0
  184. package/dist/lib/maths/types/advanced.d.ts +357 -0
  185. package/dist/lib/maths/types/advanced.d.ts.map +1 -0
  186. package/dist/lib/maths/types/advanced.js +5 -0
  187. package/dist/lib/maths/types/advanced.mjs +0 -0
  188. package/dist/lib/maths/types/basic.cjs +1 -0
  189. package/dist/lib/maths/types/basic.d.ts +95 -0
  190. package/dist/lib/maths/types/basic.d.ts.map +1 -0
  191. package/dist/lib/maths/types/basic.js +5 -0
  192. package/dist/lib/maths/types/basic.mjs +0 -0
  193. package/dist/lib/maths/types/index.cjs +1 -0
  194. package/dist/lib/maths/types/index.d.ts +4 -0
  195. package/dist/lib/maths/types/index.d.ts.map +1 -0
  196. package/dist/lib/maths/types/index.js +3 -0
  197. package/dist/lib/maths/types/index.mjs +0 -0
  198. package/dist/lib/maths/types/negative.cjs +1 -0
  199. package/dist/lib/maths/types/negative.d.ts +51 -0
  200. package/dist/lib/maths/types/negative.d.ts.map +1 -0
  201. package/dist/lib/maths/types/negative.js +5 -0
  202. package/dist/lib/maths/types/negative.mjs +0 -0
  203. package/dist/lib/maths/types/operations.cjs +1 -0
  204. package/dist/lib/maths/types/operations.d.ts +188 -0
  205. package/dist/lib/maths/types/operations.d.ts.map +1 -0
  206. package/dist/lib/maths/types/operations.js +6 -0
  207. package/dist/lib/maths/types/operations.mjs +0 -0
  208. package/dist/lib/object/clone.cjs +1 -0
  209. package/dist/lib/object/clone.d.ts +46 -0
  210. package/dist/lib/object/clone.d.ts.map +1 -0
  211. package/dist/lib/object/clone.js +104 -0
  212. package/dist/lib/object/clone.mjs +1 -0
  213. package/dist/lib/object/diff.cjs +1 -0
  214. package/dist/lib/object/diff.d.ts +203 -0
  215. package/dist/lib/object/diff.d.ts.map +1 -0
  216. package/dist/lib/object/diff.js +805 -0
  217. package/dist/lib/object/diff.mjs +1 -0
  218. package/dist/lib/object/getter-setter.cjs +1 -0
  219. package/dist/lib/object/getter-setter.d.ts +361 -0
  220. package/dist/lib/object/getter-setter.d.ts.map +1 -0
  221. package/dist/lib/object/getter-setter.js +1771 -0
  222. package/dist/lib/object/getter-setter.mjs +1 -0
  223. package/dist/lib/object/index.cjs +6 -0
  224. package/dist/lib/object/index.d.ts +13 -0
  225. package/dist/lib/object/index.d.ts.map +1 -0
  226. package/dist/lib/object/index.js +12 -0
  227. package/dist/lib/object/index.mjs +6 -0
  228. package/dist/lib/object/merge.cjs +1 -0
  229. package/dist/lib/object/merge.d.ts +93 -0
  230. package/dist/lib/object/merge.d.ts.map +1 -0
  231. package/dist/lib/object/merge.js +474 -0
  232. package/dist/lib/object/merge.mjs +1 -0
  233. package/dist/lib/object/object.cjs +1 -0
  234. package/dist/lib/object/object.d.ts +128 -0
  235. package/dist/lib/object/object.d.ts.map +1 -0
  236. package/dist/lib/object/object.js +432 -0
  237. package/dist/lib/object/object.mjs +1 -0
  238. package/dist/lib/object/omit.cjs +1 -0
  239. package/dist/lib/object/omit.d.ts +351 -0
  240. package/dist/lib/object/omit.d.ts.map +1 -0
  241. package/dist/lib/object/omit.js +656 -0
  242. package/dist/lib/object/omit.mjs +1 -0
  243. package/dist/lib/object/reconcile.cjs +1 -0
  244. package/dist/lib/object/reconcile.d.ts +7 -0
  245. package/dist/lib/object/reconcile.d.ts.map +1 -0
  246. package/dist/lib/object/reconcile.js +122 -0
  247. package/dist/lib/object/reconcile.mjs +1 -0
  248. package/dist/lib/object/selector.cjs +1 -0
  249. package/dist/lib/object/selector.d.ts +50 -0
  250. package/dist/lib/object/selector.d.ts.map +1 -0
  251. package/dist/lib/object/selector.js +371 -0
  252. package/dist/lib/object/selector.mjs +1 -0
  253. package/dist/lib/object/sort.cjs +1 -0
  254. package/dist/lib/object/sort.d.ts +149 -0
  255. package/dist/lib/object/sort.d.ts.map +1 -0
  256. package/dist/lib/object/sort.js +298 -0
  257. package/dist/lib/object/sort.mjs +1 -0
  258. package/dist/lib/object/transform.cjs +1 -0
  259. package/dist/lib/object/transform.d.ts +620 -0
  260. package/dist/lib/object/transform.d.ts.map +1 -0
  261. package/dist/lib/object/transform.js +1058 -0
  262. package/dist/lib/object/transform.mjs +1 -0
  263. package/dist/lib/object/types.cjs +1 -0
  264. package/dist/lib/object/types.d.ts +250 -0
  265. package/dist/lib/object/types.d.ts.map +1 -0
  266. package/dist/lib/object/types.js +1 -0
  267. package/dist/lib/object/types.mjs +0 -0
  268. package/dist/lib/object/utils.cjs +6 -0
  269. package/dist/lib/object/utils.d.ts +165 -0
  270. package/dist/lib/object/utils.d.ts.map +1 -0
  271. package/dist/lib/object/utils.js +444 -0
  272. package/dist/lib/object/utils.mjs +6 -0
  273. package/dist/lib/primitive/boolean/boolean.cjs +1 -0
  274. package/dist/lib/primitive/boolean/boolean.d.ts +276 -0
  275. package/dist/lib/primitive/boolean/boolean.d.ts.map +1 -0
  276. package/dist/lib/primitive/boolean/boolean.js +615 -0
  277. package/dist/lib/primitive/boolean/boolean.mjs +1 -0
  278. package/dist/lib/primitive/boolean/index.cjs +1 -0
  279. package/dist/lib/primitive/boolean/index.d.ts +3 -0
  280. package/dist/lib/primitive/boolean/index.d.ts.map +1 -0
  281. package/dist/lib/primitive/boolean/index.js +2 -0
  282. package/dist/lib/primitive/boolean/index.mjs +1 -0
  283. package/dist/lib/primitive/boolean/types.cjs +1 -0
  284. package/dist/lib/primitive/boolean/types.d.ts +14 -0
  285. package/dist/lib/primitive/boolean/types.d.ts.map +1 -0
  286. package/dist/lib/primitive/boolean/types.js +1 -0
  287. package/dist/lib/primitive/boolean/types.mjs +0 -0
  288. package/dist/lib/primitive/date/date.cjs +1 -0
  289. package/dist/lib/primitive/date/date.d.ts +641 -0
  290. package/dist/lib/primitive/date/date.d.ts.map +1 -0
  291. package/dist/lib/primitive/date/date.js +1998 -0
  292. package/dist/lib/primitive/date/date.mjs +1 -0
  293. package/dist/lib/primitive/date/index.cjs +1 -0
  294. package/dist/lib/primitive/date/index.d.ts +3 -0
  295. package/dist/lib/primitive/date/index.d.ts.map +1 -0
  296. package/dist/lib/primitive/date/index.js +2 -0
  297. package/dist/lib/primitive/date/index.mjs +1 -0
  298. package/dist/lib/primitive/date/types.cjs +1 -0
  299. package/dist/lib/primitive/date/types.d.ts +205 -0
  300. package/dist/lib/primitive/date/types.d.ts.map +1 -0
  301. package/dist/lib/primitive/date/types.js +7 -0
  302. package/dist/lib/primitive/date/types.mjs +0 -0
  303. package/dist/lib/primitive/index.cjs +5 -0
  304. package/dist/lib/primitive/index.d.ts +5 -0
  305. package/dist/lib/primitive/index.d.ts.map +1 -0
  306. package/dist/lib/primitive/index.js +4 -0
  307. package/dist/lib/primitive/index.mjs +5 -0
  308. package/dist/lib/primitive/string/index.cjs +5 -0
  309. package/dist/lib/primitive/string/index.d.ts +3 -0
  310. package/dist/lib/primitive/string/index.d.ts.map +1 -0
  311. package/dist/lib/primitive/string/index.js +2 -0
  312. package/dist/lib/primitive/string/index.mjs +5 -0
  313. package/dist/lib/primitive/string/parser-2.cjs +8 -0
  314. package/dist/lib/primitive/string/parser-2.d.ts +17 -0
  315. package/dist/lib/primitive/string/parser-2.d.ts.map +1 -0
  316. package/dist/lib/primitive/string/parser-2.js +656 -0
  317. package/dist/lib/primitive/string/parser-2.mjs +8 -0
  318. package/dist/lib/primitive/string/parser.cjs +3 -0
  319. package/dist/lib/primitive/string/parser.d.ts +9 -0
  320. package/dist/lib/primitive/string/parser.d.ts.map +1 -0
  321. package/dist/lib/primitive/string/parser.js +775 -0
  322. package/dist/lib/primitive/string/parser.mjs +3 -0
  323. package/dist/lib/primitive/string/string.cjs +5 -0
  324. package/dist/lib/primitive/string/string.d.ts +535 -0
  325. package/dist/lib/primitive/string/string.d.ts.map +1 -0
  326. package/dist/lib/primitive/string/string.js +1301 -0
  327. package/dist/lib/primitive/string/string.mjs +5 -0
  328. package/dist/lib/primitive/string/types.cjs +1 -0
  329. package/dist/lib/primitive/string/types.d.ts +318 -0
  330. package/dist/lib/primitive/string/types.d.ts.map +1 -0
  331. package/dist/lib/primitive/string/types.js +5 -0
  332. package/dist/lib/primitive/string/types.mjs +0 -0
  333. package/dist/lib/primitive/types.cjs +1 -0
  334. package/dist/lib/primitive/types.d.ts +27 -0
  335. package/dist/lib/primitive/types.d.ts.map +1 -0
  336. package/dist/lib/primitive/types.js +1 -0
  337. package/dist/lib/primitive/types.mjs +0 -0
  338. package/dist/lib/url/index.cjs +1 -0
  339. package/dist/lib/url/index.d.ts +3 -0
  340. package/dist/lib/url/index.d.ts.map +1 -0
  341. package/dist/lib/url/index.js +2 -0
  342. package/dist/lib/url/index.mjs +1 -0
  343. package/dist/lib/url/parser.cjs +1 -0
  344. package/dist/lib/url/parser.d.ts +216 -0
  345. package/dist/lib/url/parser.d.ts.map +1 -0
  346. package/dist/lib/url/parser.js +488 -0
  347. package/dist/lib/url/parser.mjs +1 -0
  348. package/dist/lib/url/types.cjs +1 -0
  349. package/dist/lib/url/types.d.ts +18 -0
  350. package/dist/lib/url/types.d.ts.map +1 -0
  351. package/dist/lib/url/types.js +1 -0
  352. package/dist/lib/url/types.mjs +0 -0
  353. package/dist/tsconfig.lib.tsbuildinfo +1 -0
  354. package/package.json +150 -0
@@ -0,0 +1,343 @@
1
+ /**
2
+ * Basic mathematical operations.
3
+ * @module BasicMathFunctions
4
+ */
5
+ /**
6
+ * Adds two numbers.
7
+ * @param a - First operand
8
+ * @param b - Second operand
9
+ * @returns The sum of a and b
10
+ */
11
+ export function add(a, b) {
12
+ return a + b;
13
+ }
14
+ /**
15
+ * Subtracts two numbers.
16
+ * @param a - First operand
17
+ * @param b - Second operand
18
+ * @returns The difference of a and b (a - b)
19
+ */
20
+ export function subtract(a, b) {
21
+ return a - b;
22
+ }
23
+ /**
24
+ * Divides two numbers.
25
+ * @param a - Dividend
26
+ * @param b - Divisor
27
+ * @returns The quotient of a divided by b
28
+ * @throws {Error} If b is 0
29
+ */
30
+ export const divide = (dividend, divisor, fallback) => {
31
+ if (divisor === 0) {
32
+ return fallback !== undefined ? fallback : NaN;
33
+ }
34
+ return dividend / divisor;
35
+ };
36
+ /**
37
+ * Calculates the modulo/remainder.
38
+ * @param a - Dividend
39
+ * @param b - Divisor
40
+ * @returns The remainder of a divided by b
41
+ */
42
+ export function modulo(a, b) {
43
+ return a % b;
44
+ }
45
+ /**
46
+ * Calculates the power of a number.
47
+ * @param base - The base number
48
+ * @param exponent - The exponent
49
+ * @returns base raised to the power of exponent
50
+ */
51
+ export function power(base, exponent) {
52
+ return Math.pow(base, exponent);
53
+ }
54
+ /**
55
+ * Calculates the square root of a number.
56
+ * @param value - The number
57
+ * @returns The square root of the number
58
+ * @throws {Error} If value is negative
59
+ */
60
+ export function sqrt(value) {
61
+ if (value < 0) {
62
+ throw new Error('Cannot calculate square root of negative number');
63
+ }
64
+ return Math.sqrt(value);
65
+ }
66
+ /**
67
+ * Calculates the absolute value of a number.
68
+ * @param value - The number
69
+ * @returns The absolute value
70
+ */
71
+ export function abs(value) {
72
+ return Math.abs(value);
73
+ }
74
+ /**
75
+ * Robust rounding using David Gay's dtoa algorithm approach
76
+ * @param value - The value to round
77
+ * @param precision - Decimal precision (default: 0)
78
+ * @returns Rounded number
79
+ * @example
80
+ * round(1.005, 2) // 1.01
81
+ * round(123.456, -1) // 120
82
+ */
83
+ export const round = (value, precision = 0, mode = 'round') => {
84
+ if (mode === 'david')
85
+ return roundUsingDavidGay(value, precision, mode);
86
+ if (!Number.isFinite(value))
87
+ return value;
88
+ if (precision === 0)
89
+ return Math[mode](value);
90
+ // Handle negative precision (rounding to tens, hundreds, etc.)
91
+ if (precision < 0) {
92
+ const factor = 10 ** -precision;
93
+ return Math[mode](value / factor) * factor;
94
+ }
95
+ // For positive precision, use a robust method
96
+ const factor = 10 ** precision;
97
+ // Add epsilon correction to handle floating point errors
98
+ const epsilon = Math.pow(2, -52); // Machine epsilon
99
+ const adjusted = value * factor;
100
+ const correction = Math.sign(adjusted) * epsilon * Math.abs(adjusted);
101
+ let rounded;
102
+ switch (mode) {
103
+ case 'round':
104
+ rounded = Math.round(adjusted + correction);
105
+ break;
106
+ case 'ceil':
107
+ rounded = Math.ceil(adjusted - epsilon);
108
+ break;
109
+ case 'floor':
110
+ rounded = Math.floor(adjusted + epsilon);
111
+ break;
112
+ case 'trunc':
113
+ rounded = adjusted < 0 ? Math.ceil(adjusted) : Math.floor(adjusted);
114
+ break;
115
+ default:
116
+ rounded = Math.round(adjusted + correction);
117
+ }
118
+ return rounded / factor;
119
+ };
120
+ const roundUsingDavidGay = (_value, precision = 0, mode = 'round') => {
121
+ let value = Math.abs(_value);
122
+ const multiplicator = _value < 0 ? -1 : 1;
123
+ if (precision === 0) {
124
+ return Math.round(value) * multiplicator;
125
+ }
126
+ if (!Number.isFinite(value)) {
127
+ return value * multiplicator;
128
+ }
129
+ // Use the banker's rounding variant which is more accurate
130
+ const factor = 10 ** precision;
131
+ // This method handles the 1.005 case correctly
132
+ // First, shift the decimal point to the right
133
+ let shifted = value * factor;
134
+ // Apply a small epsilon to handle floating point errors
135
+ // The epsilon is scaled by the magnitude of the number
136
+ const epsilon = Math.pow(2, -53); // Machine epsilon for double precision
137
+ const correction = Math.sign(shifted) * epsilon * Math.abs(shifted);
138
+ // Round with correction
139
+ shifted += correction;
140
+ // Use Math.round (or could use banker's rounding: Math.round((shifted + Number.EPSILON) * factor) / factor)
141
+ const rounded = Math.round(shifted);
142
+ // Shift the decimal point back
143
+ return (rounded / factor) * multiplicator;
144
+ };
145
+ /**
146
+ * Rounds a number up to the nearest integer.
147
+ * @param value - The number to round up
148
+ * @returns The ceiling integer
149
+ */
150
+ export const ceil = (value, precision = 0) => {
151
+ return round(value, precision, 'ceil');
152
+ };
153
+ /**
154
+ * Rounds a number down to the nearest integer.
155
+ * @param value - The number to round down
156
+ * @returns The floored integer
157
+ */
158
+ export const floor = (value, precision = 0) => {
159
+ return round(value, precision, 'floor');
160
+ };
161
+ /**
162
+ * Truncates the decimal part of a number.
163
+ * @param value - The number to truncate
164
+ * @returns The truncated integer
165
+ */
166
+ export const trunc = (value, precision = 0) => {
167
+ return round(value, precision, 'trunc');
168
+ };
169
+ /**
170
+ * Clamps a value between a minimum and maximum.
171
+ * @param value - The value to clamp
172
+ * @param min - The minimum allowed value
173
+ * @param max - The maximum allowed value
174
+ * @returns The clamped value
175
+ */
176
+ export const clamp = (value, min, max) => {
177
+ if (min > max)
178
+ [min, max] = [max, min]; // Swap if min > max
179
+ return value < min ? min : value > max ? max : value;
180
+ };
181
+ // export function clamp(value: number, min: number, max: number): number {
182
+ // return Math.max(min, Math.min(max, value));
183
+ // }
184
+ /**
185
+ * Returns the sign of a number: -1, 0, or 1.
186
+ * @param value - The number
187
+ * @returns The sign of the number
188
+ */
189
+ export function sign(value) {
190
+ if (value > 0)
191
+ return 1;
192
+ if (value < 0)
193
+ return -1;
194
+ return 0;
195
+ }
196
+ /**
197
+ * Calculates the factorial of a non-negative integer.
198
+ * @param n - The integer
199
+ * @returns The factorial of n
200
+ * @throws {Error} If n is negative or not an integer
201
+ */
202
+ export function factorial(n) {
203
+ if (!Number.isInteger(n) || n < 0) {
204
+ throw new Error('Factorial is only defined for non-negative integers');
205
+ }
206
+ if (n === 0 || n === 1)
207
+ return 1;
208
+ let result = 1;
209
+ for (let i = 2; i <= n; i++) {
210
+ result *= i;
211
+ }
212
+ return result;
213
+ }
214
+ /**
215
+ * Calculates the greatest common divisor (GCD) of two numbers.
216
+ * @param a - First number
217
+ * @param b - Second number
218
+ * @returns The GCD of a and b
219
+ */
220
+ export function gcd(a, b) {
221
+ a = Math.abs(a);
222
+ b = Math.abs(b);
223
+ while (b !== 0) {
224
+ const temp = b;
225
+ b = a % b;
226
+ a = temp;
227
+ }
228
+ return a;
229
+ }
230
+ /**
231
+ * Calculates the least common multiple (LCM) of two numbers.
232
+ * @param a - First number
233
+ * @param b - Second number
234
+ * @returns The LCM of a and b
235
+ */
236
+ export function lcm(a, b) {
237
+ return Math.abs(a * b) / gcd(a, b);
238
+ }
239
+ /**
240
+ * Linearly interpolates between two values.
241
+ * @param start - The starting value
242
+ * @param end - The ending value
243
+ * @param t - The interpolation factor (0 to 1)
244
+ * @returns The interpolated value
245
+ */
246
+ export function lerp(start, end, t) {
247
+ return start + (end - start) * clamp(t, 0, 1);
248
+ }
249
+ /**
250
+ * Inverse linear interpolation.
251
+ * @param start - The starting value
252
+ * @param end - The ending value
253
+ * @param value - The value to interpolate
254
+ * @returns The interpolation factor (0 to 1)
255
+ */
256
+ export const invLerp = (start, end, value) => {
257
+ // return (value - start) / (end - start);
258
+ return clamp((value - start) / (end - start), 0, 1);
259
+ };
260
+ /**
261
+ * Maps a value from one range to another
262
+ * @param value - The value to map
263
+ * @param inMin - The minimum value of the input range
264
+ * @param inMax - The maximum value of the input range
265
+ * @param outMin - The minimum value of the output range
266
+ * @param outMax - The maximum value of the output range
267
+ * @returns The mapped value
268
+ * Optimized: Uses lerp and invLerp
269
+ */
270
+ export const mapRange = (value, inMin, inMax, outMin, outMax) => {
271
+ const t = invLerp(inMin, inMax, value);
272
+ return lerp(outMin, outMax, t);
273
+ };
274
+ /**
275
+ * Returns the minimum of two or more numbers.
276
+ * @param values - Numbers to compare
277
+ * @returns The smallest number
278
+ */
279
+ export function min(...values) {
280
+ return Math.min(...values);
281
+ }
282
+ /**
283
+ * Returns the maximum of two or more numbers.
284
+ * @param values - Numbers to compare
285
+ * @returns The largest number
286
+ */
287
+ export function max(...values) {
288
+ return Math.max(...values);
289
+ }
290
+ /**
291
+ * Calculates the average of numbers.
292
+ * @param values - Numbers to average
293
+ * @returns The average
294
+ */
295
+ export const average = (...numbers) => {
296
+ if (!Array.isArray(numbers) || numbers.length === 0)
297
+ return 0;
298
+ let total = 0;
299
+ let count = 0;
300
+ for (const num of numbers) {
301
+ if (Number.isFinite(num)) {
302
+ total += num;
303
+ count++;
304
+ }
305
+ }
306
+ return count === 0 ? 0 : total / count;
307
+ };
308
+ /**
309
+ * Calculates the sum of numbers.
310
+ * @param values - Numbers to sum
311
+ * @returns The sum
312
+ */
313
+ export const sum = (...numbers) => {
314
+ if (!Array.isArray(numbers))
315
+ return 0;
316
+ return numbers.reduce((acc, val) => acc + (Number.isFinite(val) ? val : 0), 0);
317
+ };
318
+ /**
319
+ * Calculates the median of an array of numbers
320
+ * @param numbers - Array of numbers
321
+ * @returns The median
322
+ * Optimized: Sorts only when necessary
323
+ */
324
+ export const median = (...numbers) => {
325
+ if (!Array.isArray(numbers) || numbers.length === 0)
326
+ return 0;
327
+ const validNumbers = numbers.filter(Number.isFinite);
328
+ if (validNumbers.length === 0)
329
+ return 0;
330
+ validNumbers.sort((a, b) => a - b);
331
+ const mid = Math.floor(validNumbers.length / 2);
332
+ return validNumbers.length % 2 === 0
333
+ ? (validNumbers[mid - 1] + validNumbers[mid]) / 2
334
+ : validNumbers[mid];
335
+ };
336
+ /**
337
+ * Calculates the product of numbers.
338
+ * @param values - Numbers to multiply
339
+ * @returns The product
340
+ */
341
+ export function product(...values) {
342
+ return values.reduce((prod, val) => prod * val, 1);
343
+ }
@@ -0,0 +1 @@
1
+ function l(r,n){return r+n}function M(r,n){return r-n}var g=(r,n,e)=>n===0?e!==void 0?e:NaN:r/n;function x(r,n){return r%n}function w(r,n){return Math.pow(r,n)}function y(r){if(r<0)throw new Error("Cannot calculate square root of negative number");return Math.sqrt(r)}function N(r){return Math.abs(r)}var c=(r,n=0,e="round")=>{if(e==="david")return s(r,n,e);if(!Number.isFinite(r))return r;if(n===0)return Math[e](r);if(n<0){let m=10**-n;return Math[e](r/m)*m}let t=10**n,o=Math.pow(2,-52),u=r*t,i=Math.sign(u)*o*Math.abs(u),b;switch(e){case"round":b=Math.round(u+i);break;case"ceil":b=Math.ceil(u-o);break;case"floor":b=Math.floor(u+o);break;case"trunc":b=u<0?Math.ceil(u):Math.floor(u);break;default:b=Math.round(u+i)}return b/t},s=(r,n=0,e="round")=>{let t=Math.abs(r),o=r<0?-1:1;if(n===0)return Math.round(t)*o;if(!Number.isFinite(t))return t*o;let u=10**n,i=t*u,b=Math.pow(2,-53),m=Math.sign(i)*b*Math.abs(i);return i+=m,Math.round(i)/u*o},T=(r,n=0)=>c(r,n,"ceil"),A=(r,n=0)=>c(r,n,"floor"),F=(r,n=0)=>c(r,n,"trunc"),a=(r,n,e)=>(n>e&&([n,e]=[e,n]),r<n?n:r>e?e:r);function S(r){return r>0?1:r<0?-1:0}function R(r){if(!Number.isInteger(r)||r<0)throw new Error("Factorial is only defined for non-negative integers");if(r===0||r===1)return 1;let n=1;for(let e=2;e<=r;e++)n*=e;return n}function f(r,n){for(r=Math.abs(r),n=Math.abs(n);n!==0;){let e=n;n=r%n,r=e}return r}function k(r,n){return Math.abs(r*n)/f(r,n)}function d(r,n,e){return r+(n-r)*a(e,0,1)}var h=(r,n,e)=>a((e-r)/(n-r),0,1),q=(r,n,e,t,o)=>{let u=h(n,e,r);return d(t,o,u)};function j(...r){return Math.min(...r)}function E(...r){return Math.max(...r)}var C=(...r)=>{if(!Array.isArray(r)||r.length===0)return 0;let n=0,e=0;for(let t of r)Number.isFinite(t)&&(n+=t,e++);return e===0?0:n/e},D=(...r)=>Array.isArray(r)?r.reduce((n,e)=>n+(Number.isFinite(e)?e:0),0):0,G=(...r)=>{if(!Array.isArray(r)||r.length===0)return 0;let n=r.filter(Number.isFinite);if(n.length===0)return 0;n.sort((t,o)=>t-o);let e=Math.floor(n.length/2);return n.length%2===0?(n[e-1]+n[e])/2:n[e]};function I(...r){return r.reduce((n,e)=>n*e,1)}export{N as abs,l as add,C as average,T as ceil,a as clamp,g as divide,R as factorial,A as floor,f as gcd,h as invLerp,k as lcm,d as lerp,q as mapRange,E as max,G as median,j as min,x as modulo,w as power,I as product,c as round,S as sign,y as sqrt,M as subtract,D as sum,F as trunc};
@@ -0,0 +1 @@
1
+ "use strict";var s=Object.defineProperty;var c=Object.getOwnPropertyDescriptor;var d=Object.getOwnPropertyNames;var w=Object.prototype.hasOwnProperty;var E=(e,r)=>{for(var o in r)s(e,o,{get:r[o],enumerable:!0})},P=(e,r,o,a)=>{if(r&&typeof r=="object"||typeof r=="function")for(let l of d(r))!w.call(e,l)&&l!==o&&s(e,l,{get:()=>r[l],enumerable:!(a=c(r,l))||a.enumerable});return e};var I=e=>P(s({},"__esModule",{value:!0}),e);var W={};E(W,{addComplex:()=>S,argumentComplex:()=>b,complexEquals:()=>z,conjugateComplex:()=>O,cosComplex:()=>A,createComplex:()=>i,divideComplex:()=>v,expComplex:()=>$,fromPolarComplex:()=>x,getImag:()=>k,getReal:()=>Z,isZeroComplex:()=>R,lnComplex:()=>L,magnitudeComplex:()=>g,multiplyComplex:()=>h,negateComplex:()=>D,powerComplex:()=>F,reciprocalComplex:()=>T,sinComplex:()=>j,sqrtComplex:()=>q,subtractComplex:()=>y,toPolarComplex:()=>M});module.exports=I(W);var N=2*Math.PI;function n(e){return Math.abs(e)<1e-10}function p(e,r){return Math.abs(e-r)<1e-10}function t(e){return{real:n(e.real)?0:e.real,imag:n(e.imag)?0:e.imag}}function u(e,r){if(typeof e!="number"||!Number.isFinite(e))throw new Error(`${r} must be a finite number, got ${e}`)}function m(e,r="Complex number"){if(!e||typeof e!="object")throw new Error(`${r} must be an object`);u(e.real,`${r}.real`),u(e.imag,`${r}.imag`)}function i(e,r=0){return u(e,"real"),u(r,"imag"),t({real:e,imag:r})}function z(e,r){return m(e,"First complex number"),m(r,"Second complex number"),p(e.real,r.real)&&p(e.imag,r.imag)}function S(e,r){return m(e,"First complex number"),m(r,"Second complex number"),t({real:e.real+r.real,imag:e.imag+r.imag})}function y(e,r){return m(e,"First complex number"),m(r,"Second complex number"),t({real:e.real-r.real,imag:e.imag-r.imag})}function h(e,r){return m(e,"First complex number"),m(r,"Second complex number"),t({real:e.real*r.real-e.imag*r.imag,imag:e.real*r.imag+e.imag*r.real})}function v(e,r){m(e,"Numerator complex number"),m(r,"Denominator complex number");let o=r.real*r.real+r.imag*r.imag;if(n(o))throw new Error("Cannot divide by zero or near-zero complex number");return t({real:(e.real*r.real+e.imag*r.imag)/o,imag:(e.imag*r.real-e.real*r.imag)/o})}function g(e){m(e);let r=Math.sqrt(e.real*e.real+e.imag*e.imag);return n(r)?0:r}function O(e){return m(e),t({real:e.real,imag:-e.imag})}function b(e){return m(e),n(e.real)&&n(e.imag)?0:Math.atan2(e.imag,e.real)}function M(e){return m(e),{magnitude:g(e),angle:b(e)}}function x(e,r){if(u(e,"magnitude"),u(r,"angle"),e<-1e-10)throw new Error("Magnitude must be non-negative");let o=r%N;o>Math.PI&&(o-=N),o<=-Math.PI&&(o+=N);let a=Math.max(0,e);return t({real:a*Math.cos(o),imag:a*Math.sin(o)})}function q(e){if(m(e),n(e.real)&&n(e.imag)){let f=i(0,0);return[f,f]}let r=g(e),o=b(e),a=Math.sqrt(r),l=o/2,C=l+Math.PI;return[x(a,l),x(a,C)]}function F(e,r){if(m(e),u(r,"exponent"),n(r))return i(1,0);if(p(r,1))return i(e.real,e.imag);if(p(r,2))return h(e,e);if(n(e.real)&&n(e.imag)){if(r>0)return i(0,0);if(r<0)throw new Error("Cannot raise zero to a negative power")}let o=M(e),a=Math.pow(o.magnitude,r),l=a<-1e-10?Math.abs(a):Math.max(0,a),C=o.angle*r;return x(l,C)}function L(e){m(e);let r=g(e);if(n(r))throw new Error("Cannot take logarithm of zero or near-zero complex number");let o=b(e);return t({real:Math.log(r),imag:o})}function $(e){m(e);let r=Math.exp(e.real);return t({real:r*Math.cos(e.imag),imag:r*Math.sin(e.imag)})}function j(e){return m(e),t({real:Math.sin(e.real)*Math.cosh(e.imag),imag:Math.cos(e.real)*Math.sinh(e.imag)})}function A(e){return m(e),t({real:Math.cos(e.real)*Math.cosh(e.imag),imag:-Math.sin(e.real)*Math.sinh(e.imag)})}function R(e){return m(e),n(e.real)&&n(e.imag)}function Z(e){return m(e),e.real}function k(e){return m(e),e.imag}function D(e){return m(e),t({real:-e.real,imag:-e.imag})}function T(e){m(e);let r=e.real*e.real+e.imag*e.imag;if(n(r))throw new Error("Cannot calculate reciprocal of zero or near-zero complex number");return t({real:e.real/r,imag:-e.imag/r})}
@@ -0,0 +1,153 @@
1
+ /**
2
+ * Complex number operations.
3
+ * @module ComplexFunctions
4
+ */
5
+ import type { ComplexNumber } from '../types/advanced.js';
6
+ /**
7
+ * Creates a complex number with validation and normalization.
8
+ * @param real - Real part
9
+ * @param imag - Imaginary part
10
+ * @returns Validated and normalized complex number
11
+ */
12
+ export declare function createComplex(real: number, imag?: number): ComplexNumber;
13
+ /**
14
+ * Checks if two complex numbers are approximately equal.
15
+ * @param a - First complex number
16
+ * @param b - Second complex number
17
+ * @returns True if numbers are approximately equal
18
+ */
19
+ export declare function complexEquals(a: ComplexNumber, b: ComplexNumber): boolean;
20
+ /**
21
+ * Adds two complex numbers.
22
+ * @param a - First complex number
23
+ * @param b - Second complex number
24
+ * @returns The sum as a complex number
25
+ */
26
+ export declare function addComplex(a: ComplexNumber, b: ComplexNumber): ComplexNumber;
27
+ /**
28
+ * Subtracts two complex numbers.
29
+ * @param a - First complex number
30
+ * @param b - Second complex number
31
+ * @returns The difference as a complex number (a - b)
32
+ */
33
+ export declare function subtractComplex(a: ComplexNumber, b: ComplexNumber): ComplexNumber;
34
+ /**
35
+ * Multiplies two complex numbers.
36
+ * @param a - First complex number
37
+ * @param b - Second complex number
38
+ * @returns The product as a complex number
39
+ */
40
+ export declare function multiplyComplex(a: ComplexNumber, b: ComplexNumber): ComplexNumber;
41
+ /**
42
+ * Divides two complex numbers.
43
+ * @param a - Numerator complex number
44
+ * @param b - Denominator complex number
45
+ * @returns The quotient as a complex number
46
+ * @throws {Error} If dividing by zero or near-zero complex number
47
+ */
48
+ export declare function divideComplex(a: ComplexNumber, b: ComplexNumber): ComplexNumber;
49
+ /**
50
+ * Calculates the magnitude (absolute value) of a complex number.
51
+ * @param c - The complex number
52
+ * @returns The magnitude (non-negative)
53
+ */
54
+ export declare function magnitudeComplex(c: ComplexNumber): number;
55
+ /**
56
+ * Calculates the conjugate of a complex number.
57
+ * @param c - The complex number
58
+ * @returns The complex conjugate
59
+ */
60
+ export declare function conjugateComplex(c: ComplexNumber): ComplexNumber;
61
+ /**
62
+ * Calculates the argument (angle) of a complex number in radians.
63
+ * @param c - The complex number
64
+ * @returns The principal argument in radians (-π, π]
65
+ */
66
+ export declare function argumentComplex(c: ComplexNumber): number;
67
+ /**
68
+ * Converts a complex number to polar form.
69
+ * @param c - The complex number
70
+ * @returns Polar representation {magnitude, angle}
71
+ */
72
+ export declare function toPolarComplex(c: ComplexNumber): {
73
+ magnitude: number;
74
+ angle: number;
75
+ };
76
+ /**
77
+ * Converts polar form to a complex number.
78
+ * @param magnitude - The magnitude (must be non-negative)
79
+ * @param angle - The angle in radians
80
+ * @returns The complex number
81
+ * @throws {Error} If magnitude is negative
82
+ */
83
+ export declare function fromPolarComplex(magnitude: number, angle: number): ComplexNumber;
84
+ /**
85
+ * Calculates the square root of a complex number.
86
+ * @param c - The complex number
87
+ * @returns Array of two complex square roots (principal and secondary)
88
+ */
89
+ export declare function sqrtComplex(c: ComplexNumber): [ComplexNumber, ComplexNumber];
90
+ /**
91
+ * Calculates the power of a complex number with a real exponent.
92
+ * @param c - The complex number
93
+ * @param exponent - The exponent (real number)
94
+ * @returns The complex number raised to the power
95
+ */
96
+ export declare function powerComplex(c: ComplexNumber, exponent: number): ComplexNumber;
97
+ /**
98
+ * Calculates the natural logarithm of a complex number.
99
+ * @param c - The complex number
100
+ * @returns The principal value of natural logarithm as a complex number
101
+ * @throws {Error} If the complex number is zero or near-zero
102
+ */
103
+ export declare function lnComplex(c: ComplexNumber): ComplexNumber;
104
+ /**
105
+ * Calculates the exponential of a complex number.
106
+ * @param c - The complex number
107
+ * @returns The exponential as a complex number
108
+ */
109
+ export declare function expComplex(c: ComplexNumber): ComplexNumber;
110
+ /**
111
+ * Calculates the sine of a complex number.
112
+ * @param c - The complex number
113
+ * @returns The sine as a complex number
114
+ */
115
+ export declare function sinComplex(c: ComplexNumber): ComplexNumber;
116
+ /**
117
+ * Calculates the cosine of a complex number.
118
+ * @param c - The complex number
119
+ * @returns The cosine as a complex number
120
+ */
121
+ export declare function cosComplex(c: ComplexNumber): ComplexNumber;
122
+ /**
123
+ * Checks if a complex number is zero (or effectively zero).
124
+ * @param c - The complex number to check
125
+ * @returns True if the complex number is effectively zero
126
+ */
127
+ export declare function isZeroComplex(c: ComplexNumber): boolean;
128
+ /**
129
+ * Returns the real part of a complex number.
130
+ * @param c - The complex number
131
+ * @returns The real part
132
+ */
133
+ export declare function getReal(c: ComplexNumber): number;
134
+ /**
135
+ * Returns the imaginary part of a complex number.
136
+ * @param c - The complex number
137
+ * @returns The imaginary part
138
+ */
139
+ export declare function getImag(c: ComplexNumber): number;
140
+ /**
141
+ * Negates a complex number.
142
+ * @param c - The complex number
143
+ * @returns The negated complex number
144
+ */
145
+ export declare function negateComplex(c: ComplexNumber): ComplexNumber;
146
+ /**
147
+ * Calculates the reciprocal of a complex number.
148
+ * @param c - The complex number
149
+ * @returns The reciprocal (1/c)
150
+ * @throws {Error} If the complex number is zero or near-zero
151
+ */
152
+ export declare function reciprocalComplex(c: ComplexNumber): ComplexNumber;
153
+ //# sourceMappingURL=complex.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"complex.d.ts","sourceRoot":"","sources":["../../../../src/lib/maths/fn/complex.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,sBAAsB,CAAC;AAmE1D;;;;;GAKG;AACH,wBAAgB,aAAa,CAAC,IAAI,EAAE,MAAM,EAAE,IAAI,GAAE,MAAU,GAAG,aAAa,CAI3E;AAED;;;;;GAKG;AACH,wBAAgB,aAAa,CAAC,CAAC,EAAE,aAAa,EAAE,CAAC,EAAE,aAAa,GAAG,OAAO,CAOzE;AAED;;;;;GAKG;AACH,wBAAgB,UAAU,CAAC,CAAC,EAAE,aAAa,EAAE,CAAC,EAAE,aAAa,GAAG,aAAa,CAQ5E;AAED;;;;;GAKG;AACH,wBAAgB,eAAe,CAC7B,CAAC,EAAE,aAAa,EAChB,CAAC,EAAE,aAAa,GACf,aAAa,CAQf;AAED;;;;;GAKG;AACH,wBAAgB,eAAe,CAC7B,CAAC,EAAE,aAAa,EAChB,CAAC,EAAE,aAAa,GACf,aAAa,CAQf;AAED;;;;;;GAMG;AACH,wBAAgB,aAAa,CAC3B,CAAC,EAAE,aAAa,EAChB,CAAC,EAAE,aAAa,GACf,aAAa,CAcf;AAED;;;;GAIG;AACH,wBAAgB,gBAAgB,CAAC,CAAC,EAAE,aAAa,GAAG,MAAM,CAKzD;AAED;;;;GAIG;AACH,wBAAgB,gBAAgB,CAAC,CAAC,EAAE,aAAa,GAAG,aAAa,CAOhE;AAED;;;;GAIG;AACH,wBAAgB,eAAe,CAAC,CAAC,EAAE,aAAa,GAAG,MAAM,CAQxD;AAED;;;;GAIG;AACH,wBAAgB,cAAc,CAAC,CAAC,EAAE,aAAa,GAAG;IAChD,SAAS,EAAE,MAAM,CAAC;IAClB,KAAK,EAAE,MAAM,CAAC;CACf,CAOA;AAED;;;;;;GAMG;AACH,wBAAgB,gBAAgB,CAC9B,SAAS,EAAE,MAAM,EACjB,KAAK,EAAE,MAAM,GACZ,aAAa,CAmBf;AAED;;;;GAIG;AACH,wBAAgB,WAAW,CAAC,CAAC,EAAE,aAAa,GAAG,CAAC,aAAa,EAAE,aAAa,CAAC,CAmB5E;AAED;;;;;GAKG;AACH,wBAAgB,YAAY,CAC1B,CAAC,EAAE,aAAa,EAChB,QAAQ,EAAE,MAAM,GACf,aAAa,CAoCf;AAED;;;;;GAKG;AACH,wBAAgB,SAAS,CAAC,CAAC,EAAE,aAAa,GAAG,aAAa,CAgBzD;AAED;;;;GAIG;AACH,wBAAgB,UAAU,CAAC,CAAC,EAAE,aAAa,GAAG,aAAa,CAS1D;AAED;;;;GAIG;AACH,wBAAgB,UAAU,CAAC,CAAC,EAAE,aAAa,GAAG,aAAa,CAQ1D;AAED;;;;GAIG;AACH,wBAAgB,UAAU,CAAC,CAAC,EAAE,aAAa,GAAG,aAAa,CAQ1D;AAED;;;;GAIG;AACH,wBAAgB,aAAa,CAAC,CAAC,EAAE,aAAa,GAAG,OAAO,CAGvD;AAED;;;;GAIG;AACH,wBAAgB,OAAO,CAAC,CAAC,EAAE,aAAa,GAAG,MAAM,CAGhD;AAED;;;;GAIG;AACH,wBAAgB,OAAO,CAAC,CAAC,EAAE,aAAa,GAAG,MAAM,CAGhD;AAED;;;;GAIG;AACH,wBAAgB,aAAa,CAAC,CAAC,EAAE,aAAa,GAAG,aAAa,CAM7D;AAED;;;;;GAKG;AACH,wBAAgB,iBAAiB,CAAC,CAAC,EAAE,aAAa,GAAG,aAAa,CAcjE"}