|
How do you convert decimal values to their hex equivalent in JavaScript?
Started by Luke Smith on
, 5 posts
by 5 people.
Answer Snippets (Read the full thread at stackoverflow):
It also allows you to add padding to the hex .
ToString(16); padding = typeof (padding) === "undefined" || padding === null ? padding = 2 : padding);
The code below will convert the decimal value d to hex.
|
|
I couldn't find anything that rejects or confirms whether SQL Server 'MONEY' data type is a decimal floating point or binary floating point.
In the description it says that MONEY type range is from -2^63 to 2^63 - 1 so this kind of implies that it should...
Started by Farzad on
, 4 posts
by 4 people.
Answer Snippets (Read the full thread at stackoverflow):
It's one byte smaller than a DECIMAL(19,4), because it has of the monetary units that they represent....
MONEY is a fixed point type.
DECIMAL(19,4) will require 9 on wikipedia.
I think the primary difference will be the storage space required .
|
|
I need a program to convert Binary numbers into Decimal number in Java or in C++.
is there some one who can help me.
Started by Gowtham on
, 5 posts
by 5 people.
Answer Snippets (Read the full thread at stackoverflow):
Here is the algorithm = Integer.parseInt(binary, 2);
C++:
#include <cstdlib> const char* binary = "110010101011"; int decimal....
2^6) + (1 x 2^4) + (1 x 2^3) + (1 x 2^0)
which is equal to:
217 in decimal.
|
Ask your Facebook Friends
|
I have a field, justsomenum, of type decimal(3,2) in MySQL that seems to always have values of 9.99 when I insert something like 78.3. Why?
This is what my table looks like:
mysql> describe testtable; + + + + + + + | Field | Type | Null | Key | Default...
Started by labratmatt on
, 3 posts
by 3 people.
Answer Snippets (Read the full thread at stackoverflow):
Try decimal(5, 2) or something else if you want to store larger numbers property (in this case '2....
The maximum value for decimal(3, 2) is 9.99, so when you try to insert something larger than that, it is capped to 9.99.
|
|
What's the best way to write
int NumDigits(int n);
in C++ which would return the number of digits in the decimal representation of the input. For example 11->2, 999->3, -1->2 etc etc.
Started by jjerms on
, 14 posts
by 13 people.
Answer Snippets (Read the full thread at stackoverflow):
//assuming n is positive if (n < 10000) if (n < 100) if (n < 10) return 1; else return 2; else if (n < } while (n) { n /= 10; ++digits; } return....
Edge case behavior for -2^31 (etc.)
The fastest way is probably a binary search...
|
|
I've encountered a website that uses a 50-digit decimal integer ID in a URL query string, which seems a little excessive.
The smallest 50-digit decimal number is 1.0 x 10^49 , otherwise known as:
1
How many bits would the binary representation contain...
Started by Jon Cram on
, 9 posts
by 9 people.
Answer Snippets (Read the full thread at stackoverflow):
10^49 is 163 bitsSince every decimal digit conveys the same information as lb 10 bits, any 50 digit number will fit into ceil(lb(10)*50) = 167 bits.
To_s(2).size => 163
50 digit decimal integers range from 10^49 to 10^50-1.
|
|
This is an almost exact duplicate of my own question a few weeks ago.
http://stackoverflow.com/questions/1143302/convert-hex-to-decimal-when-no-datatype-can-hold-the-full-number
This time, it is the reverse. I have the number (in a handy null terminated...
Started by Manuel Ferreria on
, 4 posts
by 4 people.
Answer Snippets (Read the full thread at stackoverflow):
B = high; a <<= 1; b += overflow; // *2 a <<= 1; b += overflow; // *4 a += low; b of lower 7 decimal digits b = atoi of remaining upper decimal digits for (int i = 0; i < 5.
|
|
This is probably a quite exotic question.
My Problem is as follows:
The TI 83+ graphing calculator allows you to program on it using either Assembly and a link cable to a computer or its built-in TI-BASIC programming language.
According to what I've found...
Started by wsd on
, 5 posts
by 5 people.
Answer Snippets (Read the full thread at stackoverflow):
You might find) if it is odd, store (from the reverse order) a 1 in the binary array
now divide the number by 2 through the following method:
begin with the....
To have at most 2 of your input digits being examined at any given point in time.
|
|
We have an Oracle database that contains IP addresses stored as decimal integers - this is incredibly painful when manipulating the data by hand instead of via the web interface, yet hand manipulation is really handy as the network guys continually ask...
Started by Jason Tan on
, 4 posts
by 4 people.
Answer Snippets (Read the full thread at stackoverflow):
Convert each XX portion back....
Convert the integer into hexadecimal representation v8 := TO_CHAR(ip_address, 'FM '); -- 2.
Convert to a decimal number RETURN TO_NUMBER(v8, 'FM '); END iptoint -- 1.
TO_NUMBER(q4),'FMXX'),2,'0'); -- 3.
|
|
I have a Firebird stored procedure that accepts Decimal(9,6) values for Latitude and Longitude parameters. It's used to create a contact profile for a user.
When I try to create and use these decimal parameters, I get a conversion error:
Value was too...
Started by dthrasher on
, 3 posts
by 3 people.
Answer Snippets (Read the full thread at stackoverflow):
2) Can you post the actual code where your debugger is encountering the error? (I'm assuming) Right-click on your C# solution and select Add->Existing solution
2) select the *.csproj.
|