|
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 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.
|
|
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...
|
Ask your Facebook Friends
|
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.
|
|
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.
|
|
Hi there,
I'm working on an application for a lab project and I'm making it in C#. It's supposed to import results from a text file that is exported from the application we use to run the tests and so far, I've hit a road block.
I've gotten the program...
Started by Unk on
, 8 posts
by 8 people.
Answer Snippets (Read the full thread at stackoverflow):
For example....
All to.
Not null, points to Specimens table) awesomeValue (decimal not null)
Querying for data is very(1,1) not null, storedDecimal decimal(12,2) not null )
Insert into arrayKey to get an ID to use.
|
|
I'm working with the NerdDinner sample application and arrived at the section which deals with the Virtual Earth map. The application stores some values for the longitude and latitude. Unfortunately on my system floating point numbers are stored with ...
Started by Pawel Krakowiak on
, 4 posts
by 4 people.
Answer Snippets (Read the full thread at stackoverflow):
Edit 2 I'd suggest you try the following: In the SearchController.cs change() as CultureInfo; if (Thread.CurrentThread....
When you say
on my system floating point numbers are stored with a comma as the decimal separator a correctly formatted string.
|
|
I am currently implementing a class called SelectionBorder in WPF. It's derived from the Shape class.
It basically looks like this:
public class SelectionBorder : Shape { public Point StartPoint {get; set;} public PointCollection Points {get; set;} public...
Started by chrischu on
, 3 posts
by 3 people.
Answer Snippets (Read the full thread at stackoverflow):
It would look like this in XAML:
<namespace....
One would be the "source", dashes appearing to march away from it in 2 directions, and another point.
Point be the "source" and "destination" of the animated dashes, you could pick 2 points.
|