I am looking for suggestions on how to find the sizes (in bits) and range of floating point numbers in an architecture independent manner. The code could be built on various platforms (AIX, Linux, HPUX, VMS, maybe Windoze) using different flags - so results should vary. The sign, I've only seen as one bit, but how to measure the size o...
Hi guys,
I'm developing something for international use. Wondering if anyone can shed any light on whether the CultureInfo class has support for finding currency exponents for particular countries, or whether I need to feed this data in at the database level.
I can't see any property that represents this at the minute, so if anyone kn...
So I realize that #include is necessary, and that there is a pow(x,y) where x^y works...but when I attempted to use pow(2,(num-1)), it kicked back an error...
errorC2668: 'pow' : ambiguous call to overloaded function
the line of code I have for it is as follows
perfect = (pow(2,(num-1))) * (pow(2,num)-1);
Any recommendations?
Thank...
Hi there ;-)
I've written a small function in C, which almost do the same work as standart function `fcvt'. As you may know, this function takes a float/double and make a string, representing this number in ANSI characters. Everything works ;-)
For example, for number 1.33334, my function gives me string: "133334" and set up special in...
I have to implement a digital envelope using AES and RSA, but I am having problems with the .NET implementation of the RSA algorithm.
I have managed to encrypt the data (AES) with the random symetric key, but now I have to encrypt the key with RSA.
The key is an array of bytes (byte[]) and the public key I have tells me only the modulu...
Hello, I have run into an issue that I have yet to be able to solve. Hopefully someone can help. I have an app that I am using to do simple calculations, some of the results are larger than the UItextField. Does anyone know how to limit the output to say 10 characters like say a calculator would using exponents. This is the code I am...
Hello :)
I have a 128 byte (1024 bit) modulus (in a byte array format) and my exponent (also in a byte array format). I need to create a 128 bytes byte array representing the public key.
According to Wikipedia, "The public key consists of the modulus n and the public (or encryption) exponent e." But that doesn't tell me how to mix both...
I have a application which needs to raise a number to a fractional power. The target platform is an FPGA and I can get estimates on an FPU size for it, but I need an algorithm for raising a number to a fractional power just for a feasibility study. I'm assuming floating point as a worst case, I expect in practice we will be able to use...
I have an array in python that contains a set of values, some of them are
2.32313e+07
2.1155e+07
1.923e+07
11856
112.32
How do I convert the exponential formats to the decimal format
Additional: Is there a way I can convert the exponent directly to decimal when printing out in UNIX with awk?
...
I may be missing something obvious, but how do you calculate 'powers' in SAS?
Eg X squared, or Y cubed?
what I need is to have variable1 ^ variable2, but cannot find the syntax... (I am using SAS 9.1.3)
...
I'm going to rely on the saying that no question is a dumb question, but I have a slightly dumb one to ask.
EDIT:
Seems that this question has been asked and answered a few times on here already, though using titles I didn't come across when searching for duplicates. Here are some related posts:
http://stackoverflow.com/questions/15...
I'm just doing some University related Diffie Hellmann exercises and tried to use ruby for it.
Sadly, ruby doesn't seem to be able to deal with large exponents:
warning: in a**b, b may be too big
NaN
[...]
Is there any way arround it? (e.g. a special math class or something along that line?)
p.s. here is the code in question...
The python frexp and ldexp functions splits floats into mantissa and exponent.
Do anybody know if this process exposes the actual float structure, or if it requires python to do expensive logarithmic calls?
...
We're writing a very simple program to execute on a processor we've built for a class. It doesn't have the capability to multiply or divide. We do however, had support for addition, subtraction, and, or, and branching for loop control (like branch on equal if you are familiar with MIPS). We were thinking a neat program to run on it would...
Mathematically any number with an exponent of 0 is supposed to equal 1 (my remedial math research assures me).
But this code produces 5:
[NSDecimalNumber decimalNumberWithMantissa:5 exponent:0 isNegative:NO]
Is this something standard in computer programming -- that can be relied upon not being "corrected" in future Cocoa versions?
...
I have the following string: "3.39112632978e+001" which I need to convert to float. WolframAlpha says that the result of this value is 33.9112632978 which evidently I should get somehow and I couldn't figure out how.
Single.Parse("3.39112632978e+001") gives 3.39112624E+12
Double.Parse("3.39112632978e+001") gives 3391126329780.0
float....
Why exponent in float is displaced by 127?
Well, the real question is : What is the advantage of such notation in comparison to 2's complement notation?
...
I'm trying to get this expression to work, I'm pretty sure its not the parenthesis because I counted all of them. Perhaps there something I'm doing wrong involving the parameter pow (x,y).
double calculatePeriodicPayment()
{
periodicPaymentcalc = (loan * ((interestRate / yearlyPayment))) / (1-((pow ((1+(interestRate / yearlyPayment))...
Hi,
I did some tests on pow(exponent) method. Unfortunately, my math skills are not strong enough to handle the following problem.
I'm using this code:
BigInteger.valueOf(2).pow(var);
Results:
var | time in ms
2000000 | 11450
2500000 | 12471
3000000 | 22379
3500000 | 32147
4000000 | 46270
4500000 | 31459
5000000 | 49922
See? 2,5...
In Java, I am trying to get DecimalFormat to enforce the sign on an exponent sign. When it is positive I need a plus sign to appear. From what I have read this seems like a no brainer, but for myself it always throws up an error. I appreciate that there may be other methods to achieve my goal, but I would like to understand why in this s...