Commit Graph

34 Commits

Author SHA1 Message Date
Émilie Feral
7142f9545e [poincare] Finish replacing approximateContext 2020-11-04 15:58:41 +01:00
Hugo Saint-Vignes
93b5a3f63a [poincare] Handle equal negative numbers in GCD LCM
Change-Id: Ia46966270418a339f8a37e8a1971a7f7dd046034
2020-11-04 15:58:28 +01:00
Hugo Saint-Vignes
cafb1c1c05 [poincare] LCM and GCD accept set of numbers
Change-Id: I367ff5e48fa2856e976aa020ac0d172216f3a421
2020-11-04 15:11:43 +01:00
Léa Saviot
313cbf6767 [poincare/arithmetic] Shortcut the LCM and GCD computation if equal
This fixes: LCM(7.88861e+169, 7.88861e+169), which overflowed at some
point during the computation
2020-03-13 14:16:43 +01:00
Émilie Feral
02b27124f4 [poincare] Integer: remove duplicate method: isInfinite is equivalent to
isOverflow
2019-02-05 16:42:36 +01:00
Lionel Debroux
3b9d307577 [poincare] Use 16-bit values instead of 32-bit values in the table of prime factors.
This is the first of three tradeoffs:
* halving the space taken by the 1000 first prime integers, saving 2 KB;
* expanding the table until the next prime after 1000, still saving over 1 KB;
* expanding the table to 2000 prime integers, and not saving space.

Signed-off-by: Lionel Debroux <lionel_debroux@yahoo.fr>
2018-10-23 11:49:09 +02:00
Jean-Baptiste Boric
d45efe6629 Add const modifier to primeFactors
Saves 4000 bytes of RAM on non-LTO builds by leaving this array in
Flash.
2018-10-19 09:33:27 +02:00
Émilie Feral
0e1fd1bad7 [poincare] Arithmetic::PrimeFactorization return the number of prime
factors found
2018-09-20 15:55:22 +02:00
Léa Saviot
a436cca301 [poincare] Escape when overflows in Integer::multiplication, usum... 2018-09-10 16:19:59 +02:00
Émilie Feral
c762b31bc2 [poincare] Replace the overriding of operator T() by an inline function
to cast Expression in Derived Expression
2018-09-05 13:46:39 +02:00
Émilie Feral
0a6e2bbf63 [poincare] No clone on Integer: copy assignment and copy constructor
automatically clone
2018-09-03 14:45:35 +02:00
Émilie Feral
3b976e9b48 [poincare] Fix Arithmetic with new Integer API 2018-09-03 10:47:53 +02:00
Léa Saviot
91b6a1a239 [poincare] Fix arithmetic 2018-08-31 15:04:48 +02:00
Léa Saviot
0c510ba824 [poincare] Update arithmetic 2018-08-31 15:01:06 +02:00
Émilie Feral
5870804250 [poincare] When operating on Integers, check if the result might have
overflowed
2018-08-29 15:10:47 +02:00
Émilie Feral
5fcd6e6718 [poincare] Work with references when possible 2018-08-29 11:53:36 +02:00
Léa Saviot
170a0d78b6 [poincare] Fix Power and Multiplication 2018-08-28 11:46:54 +02:00
Léa Saviot
199a4386ee [poincare] Handle allocation failures in NaturalIntegerAbstract::udiv 2018-08-20 17:03:43 +02:00
Émilie Feral
4d870f33de [poincare] Fix Rational constructors 2018-08-17 11:15:21 +02:00
Léa Saviot
00d4c3396a [poincare] Arithmetic 2018-08-09 16:02:46 +02:00
Émilie Feral
54f9ea2d46 [poincare] Redesign of Expression: first attempt 2018-08-02 15:46:31 +02:00
Romain Goyet
7de609028c [poincare] Don't make Integer::k_primorial32 a global variable 2018-04-10 15:09:30 +02:00
Émilie Feral
c9943fce60 [poincare] Improve PrimeFactorization: n decomposition requires searching among prime factors p with p^2 <= n 2018-01-30 16:17:03 +01:00
Émilie Feral
45684d439b [poincare] Arithmetic::PrimeFactorization returns special cases when the
factorization fails. factor(integer) can fail and returns Undefined
2018-01-23 10:24:52 +01:00
Émilie Feral
65a87d77d6 [poincare] Cap prime factorizations: cap only prime factors
Change-Id: I6384ced8021d264cbf3a903e1574aeb0a22b7c3f
2017-11-28 14:05:46 +01:00
Émilie Feral
29587bf762 [poincare] Cap the integers that can be prime factorized
Change-Id: Iaf8cd747ac99a586438910bffc90de53e18b7640
2017-11-27 16:13:33 +01:00
Émilie Feral
cbea9aa091 [poincare] Do not split in prime factors integers that are too big (to
avoid lagging)

Change-Id: Icb70a5ca96fbd8b3eb1c829f8de798df43d54de5
2017-11-22 18:01:38 +01:00
Émilie Feral
002fc568de [poincare] Fix division by zero
Change-Id: I644b70b58e6c2610681141158892668afc5a9c58
2017-11-20 16:15:41 +01:00
Émilie Feral
20714334af [poincare] In Arithmetics, add LCM
Change-Id: Iadf69597e900e9d4dc26793857fe91378bcc76c2
2017-11-02 13:37:03 +01:00
Émilie Feral
154129c932 [poincare] clean
Change-Id: I3710822da5d99854de1a77426e4d2480698fff4e
2017-10-25 18:18:58 +02:00
Émilie Feral
a61470e84a [poincare] Fix primeFactorization to factorize any number (no bound
anymore)

Change-Id: I389124fcca03843aadcae4a6d5db10188f14c194
2017-10-09 12:03:15 +02:00
Émilie Feral
ada3ed5b11 [poincare] Improve arithmetics
Change-Id: I95b03b254cceb90978d0e0848af41f647f24274a
2017-09-29 14:41:31 +02:00
Émilie Feral
5d0dcbee1a [poincare] Change API of arithmetic
Change-Id: I1a558c5e269b5f3585feb2e031d0283e38a8f76b
2017-09-27 16:14:48 +02:00
Émilie Feral
5f6e668d81 [poincare] Implement GCD and prime factorization
Change-Id: I900b6f52f74f21fee8f6e2c1df1e06c9b579f19a
2017-09-26 16:07:52 +02:00