Minecraft Maps / Redstone Device

Mathematical base converter

  • 647 views, 2 today
  • 26 downloads, 0 today
  • 5
  • 1
  • 1
Zilack3's Avatar Zilack3
Level 20 : Expert Engineer
9

Mathematical base converter



That system affords you to convert a 4 digits number from a n-base to a m-base with n and m ∈ [2;16]

How to use it ?
- Be in 1.7.2
- Put the render distance to 16 chunks
- To select hexadecimal base, set the digit to 0
- The converter can't perform the conversion of 0 even if the result is always equal to 0.
- If you want to check the answer, you can go to: wims.unice.fr/wims/en_tool~number~baseconv.en.html

- Firstly, select the value of the 4 digits
- Secondly, select the input base
- Thirdly, select the output base
- After that, start the calcul
- Then, wait the end of the conversion (when processing's lamp turns off)
General working
r=0;
q=0;
for(i=0;i<4;i++){
r=a(i)*n^(i)+r;
}
for(i=0;i<16;i++){
q=q<<4; //4 shift left because one digit takes 4 bits.
q=quotient(r/m^(15-i));
r=remainder(r/n^(15-i));
}
Optimization
The number of multiplication depends on the wide of the value to convert (it detects the rank of the last digit different of 0) and the input base.
For input base 2,4,8 and 16, there is 0 multiplication so a jump to division's stage.
The number of division depends on the wide of the value to convert (it detects the rank of the last digit different of 0) and the output base.
For output base 2,4,8 and 16, there is 0 division so a jump to display's stage.

Only 4 module per multiplication because the multiplier can't exceed 15 (4bits).
Only 4 module per division because the quotient can't exceed 15 (4bits)

All of those optimizations affords the system to reduce the calculus from a calculus time always equal to 4min25, to a calculus time varying from 0min13s to 3min20s.
Deadline
t_max : 3min20s [eeee(15)->2120102222(3)]
t_min : 0min13s[0001(2)->0001(2)]
Composition
- 107236 Wool
- 92494 Redstone wire
- 8617 Redstone torch
- 7008 Redstone repeater

PS : All the components and programs have been homemade.
Progress100% complete
Tags

1 Update Logs

Update #1 : by Zilack3 08/06/2016 5:40:12 amAug 6th, 2016

I've corrected the problem that was giving a wrong answer when the value was greater than 1 for 2-base, 3 for 4-base and 7 for 8-base.
I've also added screenshots to see the differences between before and after the correction.

PS : DL's link is updated

Create an account or sign in to comment.

1
08/05/2016 9:01 am
Level 17 : Journeyman Engineer
davidvce
davidvce's Avatar
¡¡¡Amazing¡¡¡
Planet Minecraft

Website

© 2010 - 2024
www.planetminecraft.com

Welcome