Post Reply 
Books about CAS
01-19-2020, 04:38 PM
Post: #7
RE: Books about CAS
(01-18-2020 11:03 PM)Nad Wrote:  Hello Jonathan,

(01-14-2020 08:56 PM)Jonathan Busby Wrote:  If it's possible, you might want to use an ARM Cortex M4 embedded CPU for your calculator, as one can then use the embedded versions of the GNU Multi-Precision ( aka "Bignum" ) library, without having to start from scratch Smile See the following link : https://singletonresearch.com/2017/07/11...cortex-m4/

Thanks, that's an impressive library, and appears to be well documented. It would be cool to use it on the higher performance Cortex M7.

If I can get something simple to work, e.g. addition function (page 33 in pdf manual) "void mpz_add (mpz t rop, const mpz t op1, const mpz t op2)" then I should be able to add the rest over time Smile

Yeah Smile It's an easy to use library and it's *very* fast Smile

If you're confused as how to get your code working, then I'll give a short explanation :

  1. First declare the mpz_t variables that you'll be using.
  2. You now have to initialize the variables using mpz_init(variable_name). Alternately, you can initialize the variables and set them to a long int value with mpz_init_set_ui(variable_name, initial_value), where initial_value can be a constant or a long int variable.
  3. You probably want user supplied values in your variables, so you can use gmp_scanf("%Zd", variable_name) to do that. The format specifier string and the function work like the C standard library's scanf().
  4. You can now perform an addition using mpz_add(dest_variable, source_variable_1, source_variable_2), and, note, that dest_variable *can* be the same variable as any of the source variables Smile
  5. To get the variables' contents displayed to the user, you can use either use gmp_printf("%Zd", variable_name) or, alternately, you can get the text representation into a buffer via eg. char *buffer = mpz_get_str(NULL, 10, variable_name) . Note that you'll have to manually free() the buffer.
  6. After you're done using the variables, you need to clear them either via mpz_clear(variable_name) or mpz_clears(variable_name_1, variable_name_2, variable_name_3, NULL) ( mpz_clears() takes a list of an arbitrary numbers of mpz_t variables and the list is terminated by NULL).


Hope this helps Smile

Regards,

Jonathan

Aeternitas modo est. Longa non est, paene nil.
Find all posts by this user
Quote this message in a reply
Post Reply 


Messages In This Thread
Books about CAS - compsystems - 10-26-2019, 01:38 PM
RE: Books about CAS - Nad - 12-02-2019, 07:10 AM
RE: Books about CAS - Jonathan Busby - 01-10-2020, 09:55 PM
RE: Books about CAS - Nad - 01-12-2020, 06:26 AM
RE: Books about CAS - Jonathan Busby - 01-14-2020, 08:56 PM
RE: Books about CAS - Nad - 01-18-2020, 11:03 PM
RE: Books about CAS - Jonathan Busby - 01-19-2020 04:38 PM
RE: Books about CAS - johanw - 05-02-2020, 09:45 PM
RE: Books about CAS - BruceH - 05-03-2020, 12:09 PM
RE: Books about CAS - Eddie W. Shore - 01-22-2020, 03:00 AM
RE: Books about CAS - Eddie W. Shore - 01-22-2020, 03:05 AM
RE: Books about CAS - Jonathan Busby - 01-23-2020, 04:29 PM
RE: Books about CAS - rprosperi - 01-23-2020, 09:51 PM
RE: Books about CAS - Nad - 01-24-2020, 12:13 AM
RE: Books about CAS - Jonathan Busby - 01-24-2020, 03:53 PM
RE: Books about CAS - Nad - 01-31-2020, 06:44 AM
RE: Books about CAS - Jonathan Busby - 01-31-2020, 06:39 PM
RE: Books about CAS - Jonathan Busby - 01-31-2020, 07:52 PM
RE: Books about CAS - Nad - 02-01-2020, 05:20 AM
RE: Books about CAS - Jonathan Busby - 02-01-2020, 03:51 PM
RE: Books about CAS - Nad - 02-09-2020, 05:24 AM
RE: Books about CAS - F-73P - 05-01-2020, 02:42 AM
RE: Books about CAS - Nad - 05-06-2020, 05:08 AM
RE: Books about CAS - F-73P - 05-11-2020, 08:20 AM
RE: Books about CAS - compsystems - 05-06-2020, 05:39 PM
RE: Books about CAS - Jonathan Busby - 05-06-2020, 06:31 PM
RE: Books about CAS - Nad - 05-07-2020, 10:38 AM
RE: Books about CAS - jonmoore - 05-07-2020, 10:31 AM
RE: Books about CAS - Nad - 05-15-2020, 09:06 AM
RE: Books about CAS - John Keith - 05-15-2020, 06:13 PM
RE: Books about CAS - F-73P - 05-27-2020, 04:07 AM
RE: Books about CAS - Jonathan Busby - 05-27-2020, 07:00 PM
RE: Books about CAS - Nad - 05-17-2020, 07:12 AM
RE: Books about CAS - John Keith - 05-17-2020, 09:11 PM
RE: Books about CAS - Nad - 05-18-2020, 02:57 AM
RE: Books about CAS - F-73P - 06-03-2020, 05:14 AM



User(s) browsing this thread: 1 Guest(s)