zug is there a not stupid way to round to the not nearest number. like 8.1 rounds to 9. 8.9 rounds to 8
like i guess you could do trunc(trunc(x) + (1 - (x - trunc(x))) + 0.5) but like. this feels silly. this is silly
flipping the fraction part and doing a standard rounding algorithm feels wrong. surely theres a simpler way
trunc(x+0.5)
assuming trunc removes the fractional part
oh wait i read that wrong
mmmm thatâs an interesting problem
no that rounds to nearest
8.6 + 0.5 = 9.1
trunc(9.1) = 9
im looking for 8.6 outputting 8
all the ways iâm thinking of are probably equally complicated thbhtbhtbthbthbththb
what are you cooking
What practical use this has, if you find a solution?
trunc(x) + ((trunc(2x) + 1) % 2)
this does break integers though
practical uses are boring
i love impractical math
I wonder what real life practice even exists for root square numbers?
If youâre doing Java, you can just cast it to an integer.
Oh, wait, I see what youâre doing.
You might laugh, but we used pythagoras principle, when we made the garage in our garden, so we will make sure it becomes a perfect rectangle. (Pythagoras uses square root, just for giving you an IRL example.)
Maybe then something like:
public int roundWrong(double number) {return -((int) -8.6);}
Thatâs still gives 9, doesnât it?
I suppose! But besides geometry?
I think it rounds up to -8?