Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- push input into cell 0
- ,
- copy from cell 0 into cell 1 and 2 then move from 2 to 0
- [->+>+<<]>>[<<+>>-]>
- push 10000000 into cell 3
- add a plus to the second set of pluses to increase the accuracy by 1 digit
- +>>+++++++[<<[>++<-]>[<+++++>-]>-]<<
- copy data from cell 3 to 4 and 5 then move from 5 to 3
- [->+>+<<]>>[<<+>>-]
- put 1 into cell 7 and point to cell 3
- >>+<<<<
- [
- point to cell 14 and set cell 14 aka baseflag to 1
- >>>>>>>>>>>[-]+
- start position loop
- [
- point to cell 1 aka v1{2}
- <<<<<<<<<<<<<
- copy v1{2} to cell 9 aka v1c
- [->>>>>>>>+<<<<<<<<]
- point to cell 4 aka v2{2}
- >>>
- copy from v2{2} to cell 10 aka v2c
- [->>>>>>+<<<<<<]
- copy v2{1} to v2{2} and cell 5 then move from cell 5 to v2{1}
- <[->+>+<<]>>[<<+>>-]
- point to cell 9
- >>>>
- if v1c is nonzero enter loop
- [
- if both v1c and v2c are nonzero subtract 1 from v1c and v2c and add 1
- to cell 12 then move then point to cell 11
- >[-<->>>+<]
- move the pointer back one cell pointing to cell 9 if cell 10 was nonzero
- and pointing to cell 8 otherwise
- <<
- ]
- move the pointer back one cell and look for a 1 signaling that the pointer
- is in cell 7 rather than 8 and if so move it ahead to 8 to resynch
- <[>]
- move what's left from v1c to v1{2}
- >[-<<<<<<<<+>>>>>>>>]
- clear v2c
- >[-]
- add 1 to cell 13 aka basebuff which represents the current position tally
- then point to divvbuff
- >>>+<
- subtract divbuff from v2{2}
- [-<<<<<<<<->>>>>>>>]
- point to divbuff
- <<<<<<<<
- if v2{2} isn't empty subtract 1 from basebuff and clear v2{2} and set baseflag to 0
- [[-]>>>>>>>>>->-<<<<<<<<<<]
- copy v2{1} to v2{2}
- <[->+>+<<]>>[<<+>>-]
- if base flag is 0 end loop
- >>>>>>>>>
- end position loop
- ]
- move basebuff to cell 15 aka basebuffr and cell 16 aka basebuffr2
- <[->>+>+<<<]
- add 48 to basebuffr and point back to basebuffr
- ++++++[->>++++++++<<]>>
- print and clear basebuffr then point to basebuffr2
- .[-]>
- [
- if cell 16 isn't empty then move to v2{2} and clear it
- -<<<<<<<<<<<<[-]
- copy v2{1} to v2{2} and point to v2{2}
- <[->+>+<<]>>[<<+>>-]<
- add the contents of v2{2} to cell 17 aka v1neg
- [->>>>>>>>>>>>>+<<<<<<<<<<<<<]
- repeat until basebuffr2 is empty
- >>>>>>>>>>>>
- end loop and point to cell 17
- ]>
- subtract v1neg from v1{1}
- [-<<<<<<<<<<<<<<<<<->>>>>>>>>>>>>>>>>]
- clear v1{2}
- <<<<<<<<<<<<<<<<[-]
- copy v1{1} to v1{2}
- <[->+>+<<]>>[<<+>>-]>>
- subtract 1 from v2{1}
- <-
- if v2{1} isn't empty then start the loop
- [
- add 1 back to v2{2} and divide it by 10
- +>[-]<[>>++++++++++[-<<->>]<+<]
- ]
- copy v2{1} to v2{2} and point back to v2{1}
- >[->+<<+>]>[-<+>]<<
- ]
- clear cell 7 and point back to cell 0
- >>>>-<<<<<<<
- [->+>+<<]>>[<<+>>-]>+>>++++++[<<[>++<-]>[<+++++>-]>-]<<[->+>+<<]>>[<<+>>-]>>+<<<<[>>>>>>>>>>>[-]+[<<<<<<<<<<<<<[->>>>>>>>+<<<<<<<<]>>>[->>>>>>+<<<<<<]<[->+>+<<]>>[<<+>>-]>>>>[>[-<->>>+<]<<]<[>]>[-<<<<<<<<+>>>>>>>>]>[-]>>>+<[-<<<<<<<<->>>>>>>>]<<<<<<<<[[-]>>>>>>>>>->-<<<<<<<<<<]<[->+>+<<]>>[<<+>>-]>>>>>>>>>]<[->>+>+<<<]++++++[->>++++++++<<]>>.[-]>[-<<<<<<<<<<<<[-]<[->+>+<<]>>[<<+>>-]<[->>>>>>>>>>>>>+<<<<<<<<<<<<<]>>>>>>>>>>>>]>[-<<<<<<<<<<<<<<<<<->>>>>>>>>>>>>>>>>]<<<<<<<<<<<<<<<<[-]<[->+>+<<]>>[<<+>>-]>><-[+>[-]<[>>++++++++++[-<<->>]<+<]]>[->+<<+>]>[-<+>]<<]>>>>-<<<<<<<
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement