# Negative base conversion [duplicate]

We already have a base conversion question, but not one with negative bases (nope, this doesn't count).

You will receive a number (may be negative) and a base (must be negative), and your task is to convert the number into the base.

The base will only be from -10 to -2.

### Specs

• You may receive the number in any positive base, including unary.
• You may choose receive the magnitude of the base instead (10 instead of -10).
• The input can be taken in any reasonable format.

### Scoring

This is , shortest solution in bytes wins.

### Testcases

input        output
8163, -10    12243
-8163, -10   9977
17, -3       212

• It is not a duplicate because I could use Retina to do your linked challenge but I would not be able to trivially modify that algorithm to fit this challenge. – Leaky Nun Apr 27 '16 at 3:19
• That may be true for Retina, but for most answers I can simply replace all -2s with int(input) and 2s with -int(input) – Downgoat Apr 27 '16 at 3:22

## Jelly, 1 byte

b


Jelly supports negative bases with its base conversion builtin.

Try it online!

(bV at two bytes if the output must be a single integer.)

• Outputting a number as an array? Is that an accepted output format for numbers? – Downgoat Apr 27 '16 at 2:59
• @Downgoat The challenge does not give a specific output format. – Doorknob Apr 27 '16 at 3:01
• but an array of value [1,2,3] is not equivalent (or I don't think it can be) directly cast to the integer value of 123. If a challenge is to output a string. I wouldn't output a char array (unless that's a string in my language), I would output a string. See this loophole – Downgoat Apr 27 '16 at 3:03