Is it possible to make an array of doubles like a c-style string to make a bigger number? Or is an array of chars a special thing to a compiler?
Do you need something like this?
If so, I could help, I remember I did one task "Create program for addition of two enormously big numbers", so the point was to create numbers stored into strings ( array of characters ) and make them calculable, like Array + Array, what happens if it's bigger than 10, and stuff like that.
I ment use an actual array of double to make the number bigger.
Not as such, no. The standard formats for floating-point numbers is such that this wouldn't work. With most x86 compilers, a double is 64 bits long, with one bit for sign, 11 bits for the exponent, and 52 for the significand (that is, the value to the right of the binary point). This format is dictated by the floating-point hardware, so that alone presents a limitation on conventional floating-point numbers. To span the numbers across an array like you suggest would require the compiler to separate the different bit sections out of each number, then span them separately. This simply isn't practical, and even if it were, you would need a compiler that supported it in some fashion.
How large a number do you need? Most compilers for C (and some for C++) support the
long double type, which on the x86 uses an 80 bit extended double format. This may be large enough for your purposes.
Realistically, your best solution may be to use a bignum library such a the GNU Multiprecision arithmetic library (GMP). It is widely used for such purposes, being a key component of some important programs (e.g., GCC).
OTOH, this may not be acceptable if you are working on a homework project, so it depends on what you are doing. If it is homework, and multi-precision math is the objective of the assignment, you'll have to write your own bignum code - and as I said, doubles cannot be spanned.
Another tip - that is even if long double is falling short..
U can use
signed long double
if u need only positive numbers and ur range is falling short.. What this does, is nothing but increase the range of long double by two times !!
In response to the main question - no double array cannot be used as a c string as there are no functions defined for it as defined in "string.h"(turbo c++) which is specially encoded only for char arrays. If in the future some guy makes it for double too.. We shall be blessed :)
Hey, so I wanna ask how I need to create a method who will remove word if in that word is 2 same chars. Example: "Potato" in this word there is a 2 "o" chars so this word will need to be removed. "Forum" in this word there is no ...
Hi I'm having a problem implementing a mini shopping cart drop down in the header to show the user all the products they have in their shopping cart. It seems the only solution for this is Ajax, and I've looked all over and can't find anything that I could possibly ...
Hi. Im using vb 2010. I want to dynamically add textboxes to my form by clicking on a button. I've google searched and so far this code worked:
Private Sub btn_addline_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btn_addline.Click Dim txtB1 As New TextBox Dim i For i = ...