dasari4kntr Posted October 11, 2020 Author Report Posted October 11, 2020 19 minutes ago, Maryadaramanna said: This is wrong. It holds true only when a isn’t equal to b. you’re limiting the value of the function. Yup...you have good point.... let me try with different alternative.... Quote
Mr Mirchi Posted October 11, 2020 Report Posted October 11, 2020 6 hours ago, dasari4kntr said: This is one alternate way i can think.... a+b= (a2-b2)/(a-b) Mukku eshi ante direct ga supiyakunda head back gunda hand thippi mukku supettinattu vundhi uncle 1 Quote
Mr Mirchi Posted October 11, 2020 Report Posted October 11, 2020 6 hours ago, dasari4kntr said: This is one alternate way i can think.... a+b= (a2-b2)/(a-b) + vaadodhu ani nuvvu vaadesinaav kadheti Quote
redsox Posted October 11, 2020 Report Posted October 11, 2020 def add(x, y): while x: x, y = ((x & y) << 1), (x ^ y) return y XOR operation with carry bit Quote
Hydrockers Posted October 11, 2020 Report Posted October 11, 2020 4 minutes ago, redsox said: def add(x, y): while x: x, y = ((x & y) << 1), (x ^ y) return y XOR operation with carry bit Functions use cheyakunda possible aa Quote
Hydrockers Posted October 11, 2020 Report Posted October 11, 2020 7 hours ago, Sucker said: Yendi vuncle Satday lu Funday lu kuda ila ee coding lu. Poragallani kuda intla ila ne saavaodthurra yendi. Nuvvu rayi chudham Quote
redsox Posted October 11, 2020 Report Posted October 11, 2020 Just now, Hydrockers said: Functions use cheyakunda possible aa I mean, functions make it simpler kada. What's the point of not using a function? 🤨 you input two integers and return the sum value Quote
Tdpabhimaani Posted October 11, 2020 Report Posted October 11, 2020 7 hours ago, Sucker said: Yendi vuncle Satday lu Funday lu kuda ila ee coding lu. Poragallani kuda intla ila ne saavaodthurra yendi. Nee lanti freeloader gallani ye bongu radu ga 😂😂😂 Quote
Hydrockers Posted October 11, 2020 Report Posted October 11, 2020 1 minute ago, redsox said: I mean, functions make it simpler kada. What's the point of not using a function? 🤨 you input two integers and return the sum value Functions use chesina direct + use chesina same ga ? Run time differ avvuda ? Memory differ untada? #justasking forgoted all the programming skills a decade back Quote
redsox Posted October 11, 2020 Report Posted October 11, 2020 16 minutes ago, Hydrockers said: Functions use chesina direct + use chesina same ga ? Run time differ avvuda ? Memory differ untada? #justasking forgoted all the programming skills a decade back Functions add additional overhead since you have to allocate additional memory and stack space. For a simple function like this, the additional overhead is pretty much negligible. The important use of a function is it's reusablility. Even if it adds additional overhead it's preferred. Ok, I misinterpreted your question. If you're asking about direct addition with a '+' vs this function, the answer is bitwise operations are FAST. Using a '+' sign takes more clock cycles than a bitwise operation. Quote
Hydrockers Posted October 11, 2020 Report Posted October 11, 2020 2 minutes ago, redsox said: Functions add additional overhead since you have to allocate additional memory and stack space. For a simple function like this, the additional overhead is pretty much negligible. The important use of a function is it's reusablility. Even if it adds additional overhead it's preferred. You can still put the same logic without a function (like below) and still get the result while x: x, y = ((x & y) << 1), (x ^ y) print (y) # no return statement as it's not in a function C language aa kaka ? Quote
redsox Posted October 11, 2020 Report Posted October 11, 2020 Just now, Hydrockers said: C language aa kaka ? kadu Python C aithe int x, y; ani mundu variables declare cheyali. Plus the operators are a little bit different Quote
Sucker Posted October 11, 2020 Report Posted October 11, 2020 1 hour ago, Hydrockers said: Nuvvu rayi chudham Yooo vuncle. Nenu program raasthe Oscar award kuda vasthadi. Quote
Sucker Posted October 11, 2020 Report Posted October 11, 2020 1 hour ago, Tdpabhimaani said: Nee lanti freeloader gallani ye bongu radu ga 😂😂😂 Oho ee ID la thiruguthunnava. Nice ra. Carry on ra nee yedupu. Quote
Hydrockers Posted October 11, 2020 Report Posted October 11, 2020 1 hour ago, Sucker said: Oho ee ID la thiruguthunnava. Nice ra. Carry on ra nee yedupu. Who is he ? Quote
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.