Finally after an lot of work How to Write an Extremely Fast - TopicsExpress



          

Finally after an lot of work How to Write an Extremely Fast Infinite Divide Function be careful using it because it will create paradoxes with certain values how to divide numbers in large sections instead of digit at an time in the computer divide can be done though shifting binary divide which can be done in one circuit action in good processors although is limited in accuracy in an 32 bit integer remember an 32 bit integer can hold 9 decimal numbers in binary format perfectly so to divide faster we take an number like 1238490235135.135135139 divided by 3895082.349062568903456 = ? first the program starts by pretending the decimal place point does not exist and centers the points with 0 placement 0000003895082.349062568903456 1238490235135.135135139000000 it then removes the points 0000003895082349062568903456 1238490235135135135139000000 it removes all the 0 at the start of each number and puts them to the end of the number take note the only number that is centered is how many places it moved one way or the other this gives the program where the decimal point because the number we are dividing into has to move back 6 places means the number first divided amount starts at 0.00000 it starts 6 places in if the number on the bottom was padded this tells us how far in the opposite direction the decimal place is 3895082349062568903456000000 1238490235135135135139000000 it then reads the numbers backwards and checks if both numbers have zeros if they do it removes the unneeded zeros it stops if the top or bottom number has an number besides 0 as it reads backwards and removes unneeded zero places 0.00000 and are trying to find what divides there but before it does this it does one more minor check it checks if the number on the bottom is larger than the number on top if it is it would have to add an 0 to the end of the number on top making it larger and add an 0 behind the number on the bottom and then would add one to 6 and we would be starting at 0.000000 instead of 0.00000 and the reverse happens if the start point was not -6 and was 6 because the bottom number divided more times it would would have to make the top number larger so the bottom fits then 6 would subtract by one instead the new result looks like this 3895082349062568903456 1238490235135135135139 lastly because computers can do 9 numbers at an time accurate super fast we add four 0 places to the bottom number and four 0 places to the end of the number on top 389508234 90625689034560000 000012384 90235135135135139 389508234/000012384=31452 this result is accurate but its last digit is not because it dose not divide the other numbers behind it so you always set the last digit 0 but it will solve the exact multiple of times the section of the number will go into the number on top 31452=31450 for example if the rest of the numbers before are divide by 9 it would completely change the carrying of the number to the digit we zeroed out also understand that the carry can never exceed past this digit that we 0 out especially if it is an close fit i have already tested it wit all 9 behind the other number section and works perfectly 00001238490235135135135139*31450=38950517895000000000121550 note the multiplication must be done using the infinity multiplier 38950823490625689034560000-38950517895000000000121550=305595625689034438450 note the subtraction must be done using the infinity subtraction function after the subtract the program has to do an minor check this check is to check if the next number was 0 by calculating how meany digits where removed from the number on top if the number of digits removed is more than 4 the next number was 0 because then you would have 5 removed digits shown below 38950 823490625689034560000 = number before divide and subtract 00000 305595625689034438450 = resulting number after divide and subtract it then adds to the current number for decimal placement 0.00000+38950 305595625 68903443845000000 000012384 90235135135135139 now you take the bottom number add four 0 to it and pad the top number to match the length and do this over again 305595625/000012384=24676 24676=24670 000012384 90235135135135139*24670=30553554100783783783879130 305595625 68903443845000000-30553554100783783783879130=6008468119660061120870 then check length 30559562568903443845000000 6008468119660061120870 = length difference 4 the next number was not 0 since it did not fit into the fifth digit now do you get it 0.00000+38950+2467 this uses the infinite multiply and subtract little as possible because they are slow if they have to be used constantly per digit when dividing large numbers and if your algorithm requires constant division then it becomes an problem for performance but not any more :) it uses this sweet technique to divide that works infinitely and fast the nice thing is that the divide circuit 32 bit integer divide instantly divides by shift binary dividing these functions are as fast as they get with losing no accuracy in 32 bit i spent an lots of time figuring out the fastest way to divide with the hardware and as fast as possible and as large of numbers you want and accurately and to make them have next to no difference in time in calculation versus normal float hardware and will allow your algorithms to use full accuracy and not limited accuracy in real time finally an faster way of dividing accurately because of division paradoxes i will design it to work x amount of digits behind decimal point the Fixed Number function but in version 7 which will be after this one i will design it to store the tow numbers it was dividing into the number format so as you multiply the number larger it will calculate more of the divided number improving accuracy and speed and the fixed point will be where it round also because 1/3 never stops and will result to 0.9999999999999999999 forever and kill the computer when multiplied by three in version 7 it will calculate to the fixed point how much more of the stored divided numbers in it has to divide and calculate as the number grows and round this will fix any possible accuracy error and has never been done before and will give results so accurate there will never be a math error ever again and will operate at full speed the multiply function will only calculate more divided numbers as you multiply the number larger if the number has two numbers it divided stored in it some divide and repeats forever but can be used fully this way now and has not been done to this extreme accuracy level and super speed only version 7 will do this crazy optimization version 6 will just stop to where you want it to stop behind the decimal point and will not multiply the numbers out that are behind the fixed round point.
Posted on: Sun, 23 Mar 2014 10:40:15 +0000

Trending Topics



Recently Viewed Topics




© 2015