URI:
       ── so how do i solve... ──
       /tech/ thread 1718781264   posts: 21
       
   DIR ← back to /tech/
   DIR [reply to this thread]
       
       >> 1  Anonymous Techie  2024-06-19 07:14 ID:s77YUVUT
         basically i need something like abs(x)+abs(y) in my code, like |x|+|y|
         to divide a certain vector/x y values i have
         but i dont wanna use || or abs or sign, log,exp, so on,(even >< or >=!) only +-/ to model a similar amount
         
         like x+y, but x+y will cause 0 when x is +2 and y is -2, and i need x+y=0 when x,y is 0,0 because of reasons,
         so, it basically an |x|+|y| but built some other way simpler. 
         
         how do i do that?
       
       >> 2  Anonymous Techie  2024-06-19 09:24 ID:Heaven
         Has anyone really been far even as decided to use even go want to do look more like?
       
       >> 3  Anonymous Techie  2024-07-07 11:09 ID:lEDNmbsq
         pseudocode that works:
         
         function easyAbsolute(x,y):
         
         if x<0: x=x+(-x)+(-x)
         if y<0: y=y+(-y)+(-y)
         return x+y
         easyAbsolute(x=5,y=-2)
         # returns 5+2=7
         
         easyAbsolute(x=-10,y=-5)
         # returns 10+5=15
         
         easyAbsolute(x=5,y=7)
         # returns 5+7=12
         
         easyAbsolute(x=0,y=0)
         # returns 0+0=0
       
       >> 4  Anonymous Techie  2024-07-12 10:06 ID:Heaven
         why not... 
         
         if x < 0: x = 0 - x
       
       >> 5  Anonymous Techie  2025-10-30 04:37 ID:fGTsZBvk
         How do I "solve" Windows 11?
         https://news.ycombinator.com/item?id=45744503
       
       >> 6  Anonymous Techie  2025-11-11 12:41 ID:Heaven
         >>4
         
         couldn't it just be 
         
         if x < 0: x = -x
       
       >> 7  Anonymous Techie  2025-12-05 05:18 ID:S5lCMRPA
         Oh hey didn't notice ya. No this is not it either. Thanks for trying
       
       >> 8  Anonymous Techie  2026-01-14 09:48 ID:Heaven
         I sincerely can't tell if people are trolling or not, lmao
         
         also OP, I think your requirements are... a bit too ambiguous
         
         if |x| + |y| = a is what you want, >>3,4,6 does it
         
         but you mentioned when x = 2, y =-2, |2| + |-2| = 0? that's just weird, and wrong honestly
       
       >> 9  Anonymous Techie  2026-06-04 07:56 ID:85JiiyVb
         >>8 Yeah i need something else.
       
       >> 10  Anonymous Techie  2026-06-06 16:53 ID:Heaven
         >>9
         requirements seem odd as well, might be an XY problem?
         and does x=y y=-2 resulting in 0 mean result has to be 0 when |x|=|y|?
         whichever it is, there should be hardly any reason to limit code to addition, subtraction, and division
       
       >> 11  Anonymous Techie  2026-09-04 05:45 ID:gbXpJhv/
         >>10 nvm, it's  akind of allergy.
       
       >> 12  Anonymous Techie  2026-09-09 09:25 ID:U+pefmkF
         Your specifications are awful. This might solve the problem. Erm, if you still have this after all these years...
         
         
         int vec_abs(int x, int y)
         {
           if (-1*x == y) {
             return 0;
           }
           else {
             return abs(x) + abs(y);
           }
         }
       
       >> 13  Anonymous Techie  2026-09-10 04:00 ID:qtCfFkl6
         >>12 i still do, and thats an abs() whch i just dont feel like using. also if, {}, return, etcet. im a very human codemonkey,ig. also wow, else, return...shesh, fancy.
       
       >> 14  Anonymous Techie  2026-09-10 14:09 ID:U+pefmkF
         >>13
         So you "don't feel like using abs()" but can't figure out how to do it yourself. Okay buddy, throw this in instead of the abs() function/macro, <code>((x<0)?-1.0*x:x)</code>. Congratulations, your code will henceforth look like shit.
       
       >> 15  Anonymous Techie  2026-09-11 11:18 ID:Heaven
         inb4 OP shits on >>14 for trying to be helpful
       
       >> 16  Anonymous Techie  2026-09-12 05:08 ID:m+4wwKR0
         >>14 ,nah, thats also ...as ugly.
         >>15 did i? which one, you, ah fuck you, go back to 4chan where nobody reads anything but rezero and some, pseudo human interpersonality they got from, rezero? or was it danmachi, i, i,.... nevermind, why still put vagina? you do think metal is, everyones song, but it's just y- aw nvm, whos anyone, lil putin?
       
       >> 17  Anonymous Techie  2026-09-12 10:24 ID:Heaven
         >>16 Uh... right!! :)
       
       >> 18  Anonymous Techie  2026-09-12 13:34 ID:U+pefmkF
         >>16
         Mr tululo, you may notice that was the point I was making.
       
       >> 19  Anonymous Techie  2026-09-13 05:45 ID:IUHhedBO
         >>18 ...I don't know what Yer talking about and I really can't continue this thread anymore
       
       >> 20  Anonymous Techie  2026-09-13 12:29 ID:Heaven
         >>19 You're going to start another thread on the same topic pretty soon I bet
       
       >> 21  Anonymous Techie  2026-09-13 14:20 ID:oqs4Ak6b
         >>20 yeah I just did
         https://4-ch.net/tech/kareha.pl/1789309124/l50
         This is more of your level
       
       
   DIR [reply to this thread]
   DIR ← back to /tech/
  HTML Open this thread on the web