# GiNaC | Special purpose C library for symbolic computations | Cryptography library

## kandi X-RAY | GiNaC Summary

## kandi X-RAY | GiNaC Summary

GiNaC (which stands for "GiNaC is Not a CAS" (computer algebra system)) is a C++ library for symbolic mathematical calculations. It is designed to allow the creation of integrated systems that embed symbolic manipulations together with more established areas of computer science (like computation-intense numeric applications, graphical interfaces, etc.) under one roof. The official ftp site is: ftp://ftpthep.physik.uni-mainz.de/pub/GiNaC/. The official web site is: A mailing list is located at: ginac-list@ginac.de. You need to be subscribed to be able to post to the list. To subscribe, please follow the instructions on See for the list policy.

### Support

### Quality

### Security

### License

### Reuse

### Top functions reviewed by kandi - BETA

Currently covering the most popular Java, JavaScript and Python libraries. See a Sample of GiNaC

## GiNaC Key Features

## GiNaC Examples and Code Snippets

## Community Discussions

Trending Discussions on GiNaC

QUESTION

This is my first question on here so please bear with.

I need to add an external library to my qt project in the form of a header file and .so file. If I include the header file (figure.h) only in main.cpp the program compiles and works as intended. If I include the header file only in scene.cpp the program again compiles. However when I go to add the header file to scene.h the compiler states that there are duplicate symbols, even though the header file hasn't been included anywhere else in the project. Is there anyone that could help out? This has had me stumped for a while.

.pro file:

...ANSWER

Answered 2018-Jul-29 at 12:24You can't define global variables in a header file. For example you have:

QUESTION

While trying to implement a sine-function without a FPU I recognized that all of the input is already rational, so I decided to try an all-rational approach. Probably slower but: why not? The series is linearly convergent and hence has a chance for a runtime-optimization with binary-splitting. There is even highly detailed literature for how to do it and which I used.

So far, so good.

My prototyping tool for numerical algorithms is Pari/GP, so I ported the code from the paper mentioned above to Pari/GP and, as you might have guessed from the fact that I post a question here, it did not work. Well, it did work but it was not possible to minimize the error. The paper has several other recipes for different functions but all showed the same behavior. Assuming a typo in the paper I checked the author's implementation in CLN. Heavily optimized but is based on the code in the paper, quite verbatim even.

To get a MWE I used their recipe for `exp(p/q)`

(the simplest recipe besides the factorial) and simplified the Pari/GP code.

ANSWER

Answered 2019-Aug-15 at 19:22You are going to hate yourself/PARI for this (but love stack-overflow).

In the first line you have:

QUESTION

I have a very large Decimal number as a string, it cannot be accurately represented by a float or double, so I cannot use any function that works with numbers, I have to keep my number as string, and do all functions with strings.

For example: PI:

...ANSWER

Answered 2019-Apr-04 at 19:27Given you need precise *decimal* places, all of the libraries you mentioned are either out of bounds or will require setting absurd levels of precision to guarantee your results are rounded accurately.

The problem is they're all based on *binary* floating point, so when you specify a precision, e.g. with `mpf_set_default_prec`

in GMP/MPIR (or the equivalent call in MPFR, a fork of GMP that provides more guarantees on exact, portable precision), you're saying how many bits will be used for the significand (roughly, how many bits of integer precision exist before it is scaled by the exponent). While there is a rough correspondence to decimal precision (so using four bits of significand for every one decimal digit of precision needed is usually good enough for most purposes), the lack of decimal precision means explicit output rounding is always needed to avoid false precision, and there is always the risk of inconsistent rounding: a number that logically ends in `5`

and should be subjected to rounding rules like round half-even, round half-up or round half-down might end up with false precision that makes it appear to not end exactly with `5`

, so the rounding rules aren't applied.

What you want is a *decimal* math library, like Java's `BigDecimal`

, Python's `decimal`

, etc. The C/C++ standard library for this is `libmpdec`

, the core of the `mpdecimal`

package (on Python 3.3+, this is the backend for the `decimal`

module, so you can experiment with its behavior on Python before committing to using it in your C/C++ project). Since it's decimal based, you have guaranteed precision levels; if you set the precision to 4 and mode to `ROUND_HALF_EVEN`

, then parsing `"XX.X45"`

will consistently produce `"XX.X4"`

, while `"XX.X75"`

will consistently produce `"XX.X8"`

(the final `5`

rounds the next digit to even numbers). You can also "quantize" to round to a specific precision *after* the decimal point (so your precision might be 100 to allow for 100 digits combined on left and right hand sides of the decimal point, but you can quantize relative to `"0.0000"`

to force rounding of the right hand of the decimal to exactly four digits).

Point is, if you want to perform exact decimal rounding of strings representing numbers in the reals in C/C++, take a look at `libmpdec`

.

For your particular use case, a Python version of the code (using the `moneyfmt`

recipe, because formatting numbers like `"1.1E-26"`

to avoid scientific notation is a pain) would look roughly like:

QUESTION

I have a third-party library, and I want to use one of the supplied constructors.

**ex.h:**

ANSWER

Answered 2017-Mar-27 at 16:02You need to provide an `ex`

reference, not a `symbol`

reference;
Try this:

QUESTION

I want to download older libraries from a git repository to desktop. How one does it? For example I am trying to download ginac_1-6-5 from

...ANSWER

Answered 2017-Mar-02 at 04:10- Clone the repository.

The link you gave is to the web interface to the repository. The actual repo is at git://www.ginac.de/ginac.git.

QUESTION

So i asked some questions before regarding this, but i think i am finally getting closer to my goal of using a C++ Library in a Swift iOS Project. I have downloaded a C++ Library as tar.gz. To use this library i am supposed to install it on my computer using make, but i want it as a a static library (.a to my knowledge) to use it in a Swift App. I know how to use C++ in a Swift project thats working and running. But i can't find any helpful advice on how to compile this source to a static Library. You can download the Library here. I just need it in a .a file and don't really know how to start. Everything i am finding is using headers and things i absolutely do not know. Please excuse my confusion, I am an absolute newbie in C++.

Thanks a lot for future advice =)

And this is the structure of the archive.

...ANSWER

Answered 2017-Mar-16 at 16:41You need to compile the code and link it with your compiler. Suggested steps:

Run

`make`

in the top-most folder of the source codeFind the location of the library file by running

`find . -type f | grep "\.a$"`

in the terminal.Add the path to the library file in your IDE or compiler.

Community Discussions, Code Snippets contain sources that include Stack Exchange Network

## Vulnerabilities

No vulnerabilities reported

## Install GiNaC

## Support

## Reuse Trending Solutions

Find, review, and download reusable Libraries, Code Snippets, Cloud APIs from over 650 million Knowledge Items

Find more librariesStay Updated

Subscribe to our newsletter for trending solutions and developer bootcamps

Share this Page