Multiplying two numbers in log space means adding them:
log_multiply(x, y) = log( exp(x) * exp(y) )
= x + y
Adding two numbers in log space means you do a special log-add operation:
log_add(x, y) = log( exp(x) + exp(y) )
which is implemented in the following code, in a way that doesn't require us to take the two ...
i have written in matlab, a program, which is supossed to generate random numbers between 0 and 1. i have test it only with the runstest in matlab, and te result is that the sequence is random. i have seen the histograms too, and they have a beta distribution. i want to test this rng whith other test, such as diehard, ent, or nist, but i...
how do i round off decimal values ?
Example :
decimal Value = " 19500.98"
i need to display this value to textbox with rounded off like " 19501 "
if decimal value = " 19500.43"
then
value = " 19500 "
...
Hi, I'm using Visual C#2008 Express Edition and an Express SQL database. Every time I build my solution, I get an error like the one above. Obviously the file name changes. A new file is also created every time I hit a debug point.
I have a stored proc that gets every row from a database table, it gets these rows every time the main for...
I am pulling a value via JavaScript from a textbox.
If the textbox is empty, it returns NaN.
I want to return an empty string if it's null, empty,etc.
What check do I do?
if(NAN = tb.value) ?
...
I need to format numbers in my web application depending on user's chosen language, e.g. 1234.56 = "1.234,56" in German. Stuff like sprintf is currently out of question, since they depend on LC_NUMERIC (which is sensible for desktop applications IMHO) and I'd have to generate every locale on the server, which is a no-go. I would prefer u...
Hi,
I want to use JavaScript to restrict input on a text box to currency number formatting. For example:
<input type="text" value="2,500.00" name="rate" />
As given above, the text box should accept only numbers, commas and a period.
But, after the period it should accept two digits after numbers.
How do I accomplish this? Please ...
Hi All
I am trying to find a piece of regex to match a currency value.
I would like to match only numbers and 1 decimal point ie
Allowed
10
100
100.00
Not Allowed
Alpha Characters
100,00
+/- 100
I have search and tried quite a few without any luck.
Hope you can advise
...
I have a list say:
['batting average', '306', 'ERA', '1710']
How can I convert the intended numbers without touching the strings?
Thank you for the help.
...
I have a situation where I need to do something like
select 2, id from users;
I think that would work at least with Oracle but it doesn't work in Mysql. Any ideas?
...
How do I create a string so that it formats floating point numbers to have no trailing decimal point or digits when it is an integer, but to NOT switch to scientific notation for larger numbers?
When I do:
float myFloat= 15.6f;
float myInt = 5.0f;
float myLarge = 7000000.0f;
sprintf(out, "my float is %g", myFloat);
...
Say I have a large number (integer or float) like 12345 and I want it to look like 12,345.
How would I accomplish that?
I'm trying to do this for an iPhone app, so something in Objective-C or C would be nice.
...
Right now I convert the string containing the decimal number to an integer (ignoring the radix point for now), load it into ST(0), and divide by the correct power of ten to account for the radix point. This seems round about, and requires I have a look up table for some of the powers of 10. Is there a better way to do this?
...
Is there a simple formula for determining the maximum and minimum values for an Oracle NUMBER column with (p, s)?
...
Django has various numeric fields available for use in models, e.g. DecimalField and PositiveIntegerField. Although the former can be restricted to the number of decimal places stored and the overall number of characters stored, is there any way to restrict it to storing only numbers within a certain range, e.g. 0.0-5.0 ?
Failing that, ...
How would i go about doing calculations with extremely large numbers in Java? i have tried long but that maxes out at 9223372036854775807, and when using an integer it does not save enough digits and therefore is not accurate enough for what i need. Is there anyway around this?
...
Hello,
Deep inside my code, in a nested if inside a nested for inside a class method, I'm comparing a certain index value to the length of a certain list, to validate I can access that index. The code looks something like that:
if t.index_value < len(work_list):
... do stuff ...
else:
... print some error ...
For clarificati...
Applogies for what I have no doubt is a noob question.
I display several percentage values in a Grid View in ASP.Net
I want to be able to set the NumberFormatInfo.PercentPositivePattern Property which I think I have to bring in a Globals "property" to be able to adjust?
from its Default 0 to 1
This is the property I need to adjust
h...
I'm running a pretty simple bash script in ubuntu but have come up with a problem.
If needed I'll post the whole script, but I've narrowed down the problem.
Basically, I want to run some code every 15 seconds, so I started with this:
time=`date +%S`
time2=$((time%15))
if [ $time2 -eq 0 ]
then
etc, etc, etc....
The problem comes up...
Hi,
How can I convert a binary number into a string character using Perl script?
thanks in advance.
...