25.09.2026 - 4 - BUG in binCalc?
This commit is contained in:
@@ -83,10 +83,11 @@ document.getElementById("startBinCalc").addEventListener('click', function(){
|
||||
let bin1 = calcDezToBin(dezNumberToBin1);
|
||||
let bin2 = calcDezToBin(dezNumberToBin2);
|
||||
|
||||
let numbersForText = fillwithZero(bin1.split(''), bin2.split(''));
|
||||
let result = additionTwoBinNumbers(bin1, bin2);
|
||||
//let numbersForText = fillwithZero(bin1, bin2);
|
||||
|
||||
document.getElementById('binCalcResult').innerText = bin1 + " + " + bin2 + " = " + result;
|
||||
|
||||
document.getElementById('binCalcResult').innerHTML = "<center> "+numbersForText.first.join('') + "<br>+ " + numbersForText.second.join('') + "<br> " + result+" </center>";
|
||||
}
|
||||
});
|
||||
|
||||
@@ -138,12 +139,12 @@ function flipBinString(remainderString)
|
||||
function additionTwoBinNumbers(bin1, bin2)
|
||||
{
|
||||
|
||||
let binArrays = fillwithZero(bin1.split(""), bin2.split(""));
|
||||
let binArrays = fillwithZero(bin1.split(''), bin2.split(''));
|
||||
let bin1Array = binArrays.first;
|
||||
let bin2Array = binArrays.second;
|
||||
let binOverflow = Array.from({length: bin2Array.length}, (v, k) => '0');
|
||||
|
||||
let tempResult = ""
|
||||
let tempResult = "";
|
||||
|
||||
for(i = bin1Array.length-1; i >= 0; i--){
|
||||
|
||||
|
||||
Reference in New Issue
Block a user