Questions tagged [radix]

A number's radix (also known as its base) is the number of unique digits used in its representation. Common examples are binary (base-2), octal (base-8), decimal (base-10), and hexadecimal (base-16). Use this tag for questions about converting between or otherwise manipulating numbers with different radices.

1459 questions
1892
votes
30 answers

How to convert decimal to hexadecimal in JavaScript

How do you convert decimal values to their hexadecimal equivalent in JavaScript?
Luke Smith
  • 23,504
  • 8
  • 29
  • 28
671
votes
11 answers

JSLint says "missing radix parameter"

I ran JSLint on this JavaScript code and it said: Problem at line 32 character 30: Missing radix parameter. This is the code in question: imageIndex = parseInt(id.substring(id.length - 1))-1; What is wrong here?
Mike Vierwind
  • 6,889
  • 3
  • 15
  • 9
320
votes
35 answers

How to convert an integer to a string in any base?

Python allows easy creation of an integer from a string of a given base via int(str, base). I want to perform the inverse: creation of a string from an integer, i.e. I want some function int2base(num, base), such that: int(int2base(x, b), b) ==…
Mark Borgerding
  • 8,117
  • 4
  • 30
  • 51
194
votes
3 answers

Why is it that parseInt(8,3) == NaN and parseInt(16,3) == 1?

I'm reading this but I'm confused by what is written in the parseInt with a radix argument chapter Why is it that parseInt(8, 3) → NaN and parseInt(16, 3) → 1? AFAIK 8 and 16 are not base-3 numbers, so parseInt(16, 3) should return NaN too
Devid Farinelli
  • 7,514
  • 9
  • 42
  • 73
147
votes
12 answers

How to convert a Binary String to a base 10 integer in Java

I have an array of Strings that represent Binary numbers (without leading zeroes) that I want to convert to their corresponding base 10 numbers. Consider: binary 1011 becomes integer 11 binary 1001 becomes integer 9 binary 11 becomes integer 3 …
dwwilson66
  • 6,806
  • 27
  • 72
  • 117
130
votes
12 answers

Quickest way to convert a base 10 number to any base in .NET?

I have and old(ish) C# method I wrote that takes a number and converts it to any base: string ConvertToBase(int number, char[] baseChars); It's not all that super speedy and neat. Is there a good, known way of achieving this in .NET? I'm looking…
joshcomley
  • 28,099
  • 24
  • 107
  • 147
118
votes
9 answers

Why do we need to use radix parameter when calling `parseInt`?

What does radix actually mean? Why do we need it? parseInt(10, radixValue);
John Cooper
  • 7,343
  • 31
  • 80
  • 100
89
votes
9 answers

Search in SVN repository for a file name

We have a bulk repository for code contain thousands of folder and sub folder, i want to search under this repositor with file name or with some word. Root folder a\ b\ c\ d\ e\ f\ab\ f\ab\cd.txt I want to search for…
Baljeet
81
votes
5 answers

Combine base and ggplot graphics in R figure window

I would like to generate a figure that has a combination of base and ggplot graphics. The following code shows my figure using the base plotting functions of R: t <- c(1:(24*14)) P <- 24 A <- 10 y <-…
KatyB
  • 3,920
  • 7
  • 42
  • 72
71
votes
5 answers

Django project base template

Can I create a base template for my project which all apps can draw from? Or do I have to create a base template for each app? And if I wanted them to be the same I'd just copy them?
heri0n
  • 1,459
  • 3
  • 19
  • 33
69
votes
2 answers

Why base tag does not work for relative paths?

I have a tag as below in section of the page: And a script as below which is relative (of course after ):