# Binary to Decimal in Brainf***

Page 1 of 1

## 4 Replies - 3045 Views - Last Post: 06 October 2014 - 11:21 AMRate Topic: //<![CDATA[ rating = new ipb.rating( 'topic_rate_', { url: 'http://www.dreamincode.net/forums/index.php?app=forums&module=ajax&section=topics&do=rateTopic&t=355206&amp;s=c92770bd59eb49d9ebf494107d0bd043&md5check=' + ipb.vars['secure_hash'], cur_rating: 0, rated: 0, allow_rate: 0, multi_rate: 1, show_rate_text: true } ); //]]>

### #1 Julyuary

Reputation: 38
• Posts: 109
• Joined: 20-December 11

# Binary to Decimal in Brainf***

Posted 06 October 2014 - 09:52 AM

It's a very simple program, granted I probably won't understand it next week. It uses an algorithm at the very end that converts the result to characters. The maximum input pretty much depends on the cell size of whatever compiler/interpreter you're using, but the result to character conversion is only accurate up to 999.

```>+[>[-]<[-],[>+>+<<-]>>[<<+>>-]>>[-]<
[>+>+<<-]>>[<<+>>-]<[<+>>+<-]>[<+>-]<<<<[--
-------------------------------------------
---[>>+<<-]]<]>>>>>>++++++++++<<[->+>-[>+>>
]>[+[-<+>]>+>>]<<<<<<]>>[-]>>>++++++++++<[-
>-[>+>>]>[+[-<+>]>+>>]<<<<<]>[-]>>[>++++++[
-<++++++++>]<.<<+>+>[-]]<[<[->-<]++++++[->+
+++++++<]>.[-]]<<++++++[-<++++++++>]<.[-]<<
[-<+>]<
```

Commented for those that care:
Spoiler

I can probably say that this is the worst code I'll ever write.

This post has been edited by macosxnerd101: 06 October 2014 - 09:57 AM
Reason for edit:: Censored title

Is This A Good Question/Topic? 0

## Replies To: Binary to Decimal in Brainf***

### #2 modi123_1

• Suitor #2

Reputation: 13766
• Posts: 54,945
• Joined: 12-June 08

## Re: Binary to Decimal in Brainf***

Posted 06 October 2014 - 09:56 AM

Quote

I can probably say that this is the worst code I'll ever write.

Why is it the worst code you have ever written? Is that mantle solely put on because of the syntax, or the actual logic is whack?

### #3 Julyuary

Reputation: 38
• Posts: 109
• Joined: 20-December 11

## Re: Binary to Decimal in Brainf***

Posted 06 October 2014 - 10:29 AM

I'm really sorry about the title! That was careless of me. It's just the minimalist syntax. Expressing intent without comments seems next to impossible to me.

### #4 modi123_1

• Suitor #2

Reputation: 13766
• Posts: 54,945
• Joined: 12-June 08

## Re: Binary to Decimal in Brainf***

Posted 06 October 2014 - 11:08 AM

Given the language's name, and reputation, I have to say: no doy.

### #5 Julyuary

Reputation: 38
• Posts: 109
• Joined: 20-December 11

## Re: Binary to Decimal in Brainf***

Posted 06 October 2014 - 11:21 AM

Has anyone ever written any sort of input validation in it? The idea makes me shiver.
EDIT: Herp. While it's not very nice to look at, it isn't really suited for this forum since it's logically sound (to me, anyway). My bad.

This post has been edited by Julyuary: 06 October 2014 - 12:08 PM