Closed. This question needs to be more focused. It is not currently accepting answers.
Want to improve this question? Update the question so it focuses on one problem only by editing this post.
Closed 8 years ago.
Improve this question
I'm using long double in a C program to compute 2D images of the Mandelbrot Set but wish to have further precision to zoom deeper.
Are there any performance gains to be had from an arbitrary precision maths library that can restrict the amount of precision as required, rather than leaping from long double precision straight into arbitrary precision?
Which is the fastest of the arbitrary precision maths libraries?
'fastest' is going to be somewhat dependent on your platform and intended use.
The MPFR Library
GMP
This wiki article contains links to several libraries.
If you need more precision, see qd at http://crd.lbl.gov/~dhbailey/mpdist/.
Related
Closed. This question needs to be more focused. It is not currently accepting answers.
Want to improve this question? Update the question so it focuses on one problem only by editing this post.
Closed 1 year ago.
Improve this question
How to use arm_neon.h headerfile to increase the performance of a code using sin and cos functions.?
The board used is a Xilinx T1 accelerator card with ARM architecture armv8-a and cortex a53.
Language is c.
arm_neon.h contains SIMD intrinsics, which offer a C API to access/invoke individual low level instructions.
Thus, if you intend to speed up sin/cos with arm_neon.h, the method is to rewrite those trigonometric functions using vector arithmetic calculating 4 values at the same time.
Things you need to concern are:
the code needs to be branchless
you need to define how accurate you need to be
you need to define the input range (no need to handle multiples of 2*pi ?)
you need to define input unit (radians vs degrees vs fractions of 2^n)
All of this will determine what kind of approximation to use -- polynomial, linear piece-wise, rational polynomial and what steps or corner cases can be omitted.
Closed. This question needs details or clarity. It is not currently accepting answers.
Want to improve this question? Add details and clarify the problem by editing this post.
Closed 1 year ago.
Improve this question
Hello i am using a mali t-624 gpu (Midgard Family Gpu).
Could you tell me if those gpu's are supporting dot product as I cannot find any info for this.
Also could you tell me a kernel written in opencl that will give me the best time execution for dot product.
Yes. The ARM Mali T624 MP4 GPU supports OpenCL 1.1. The specification includes the dot product for 32-bit floating-point. Use float dot (floatn p0, floatn p1) for best execution time.
Closed. This question needs to be more focused. It is not currently accepting answers.
Want to improve this question? Update the question so it focuses on one problem only by editing this post.
Closed 4 years ago.
Improve this question
I have a problem in C, I am not allowed to use floats as the microcontroller it will be flashed does not support that data type. Now all my integers are being rounded off as it should. How do I handle this case?
A short research indicates using bit wise operation such as left shift and right shift. I know what are these operations. But I do not know how to use these operations to achieve what I want.
Another possibility is the Q number format.
You will get some results if you google "Q number format" or some variations.
It is often used for some DSP related topics in C. Here another blog post that explains that number format and here is an example code implementation for q-numbers in C.
In general you can say that q-numbers represent a number between -1 and 1 without using floating point arithmetic.
Normally a microcontroller don't have a floating point unit, everything works with integers. But its up to you which unit you like for your integers.
For example:
100 could be 100 cm or 1,00 m
1000 could be 100,0 cm or 1,000 m and so on..
Please have a look at the description:
electronic.stackexchange
Closed. This question needs to be more focused. It is not currently accepting answers.
Want to improve this question? Update the question so it focuses on one problem only by editing this post.
Closed 7 years ago.
Improve this question
I need to hold a value of range 10^20 in C. Heard that the big int in C can hold such big values. How to declare and use the big int in C.
Does anybody know of an easy way to do that? Any help would really be appreciated!
You can use type unsigned long long, the range is at least 0..18446744073709551615, but that's only 1.8E19, so slightly less than what you need. If you really want to go beyond 64 bits, you can check if your system supports 128 bit integers (as type __int128, __int128_t, int128_t or something similar) or you will need a multi-precision package such as GMP.
Closed. This question needs details or clarity. It is not currently accepting answers.
Want to improve this question? Add details and clarify the problem by editing this post.
Closed 7 years ago.
Improve this question
I'am trying to write a C code to add, subtract, multiply and divide 2 numbers each containing 100 digits. This should include the use of arrays.
Can anyone please give me any suggestions, a pseudo code or a sample code?
To be more clear
The user will enter 2 numbers(Integers)
Each number can comprise of 100 or less digits i.e integer a can be 10 or 234 or 43582 or 23456788 or 23445667788...... etc. Same for integer b.
Now taking these two integers I have to perform the arithmetic operations of Addition,Subtraction,Division,Multiplication,Modulas(%)
You could try using the GMP Library as answered in this question. It can perform Bigint operations in both C and C++. Also if you are fine with C++ code for Bigint you could check out this blogpost.
You are looking for hints on implementing arbitrary precision arithmetic. Start be reading this article: https://en.wikipedia.org/wiki/Arbitrary-precision_arithmetic , then search for bignum c code with a search engine, sample implementations are easy to find. Avoid full blown packages such as gnu MP because they are too advanced and not the right starting point.