Francisco
Ludovic 'Archivist'
If automatically generated code is better than hand-written code, you suck at handwriting code
If your hand generated code is better than the one made by the compiler, you are coding in the wrong place
Mihail
and if you're going to claim that plain asm does everything just as well no it doesn't
BinaryByter
so is overly using stackframes and not using the correct opcodes :D
olli
"premature optimization is the root of all evil" Measure it, if it is to slow, improve it. There are so many things on modern CPU's you don't even think of
BinaryByter
this one?
Ludovic 'Archivist'
I think you were the one that said we should not insult anyone
BinaryByter
i'm not insulting him
BinaryByter
But his claim is a bit sketchy in my eyes
Mihail
@florianbAT you'll get another ot warning soon
Dima
Ok this gone #ot quickly
Ludovic 'Archivist'
But his claim is a bit sketchy in my eyes
Then show me the readability of an asm multiple binary search that is as fast as, say, one made using C++20 coroutines
Dima
@florianbAT you'll get another ot warning soon
the latest one ( ͡° ͜ʖ ͡°)
Mihail
But his claim is a bit sketchy in my eyes
your "argument" (that picture) totally isn't sketchy at all
Mihail
it makes perefect sense
BinaryByter
Then show me the readability of an asm multiple binary search that is as fast as, say, one made using C++20 coroutines
all he said is that asm cant do everything as well as C++ also, asm can be readable if you use it well
Mihail
all he said is that asm cant do everything as well as C++ also, asm can be readable if you use it well
readable, but then loop is slower than manually decrementing registers
Mihail
also i haven't said what you claimed i said
Mihail
i didnt imply that you should use loop
well the superior solution is very readable
Anonymous
just gimme admin and you can warn me all you want friends
BinaryByter
just gimme admin and you can warn me all you want friends
/warn doesnt think like we want our members to think
Ludovic 'Archivist'
Refering to the "Nano-Coroutines" ? :)
Yep, would love to see maxi try that in pure x86_64 asm
Mihail
...
Dima
Oh yes.
Mihail
yay
Dima
/warn doesnt think like we want our members to think
don’t you feel like you just stabbed your teammate?
Ludovic 'Archivist'
don’t you feel like you just stabbed your teammate?
He is German, I guess he says "TEIMMATE", there is no I in team but what about teim
olli
Honestly, he received 6 warns... time for him to go
Mihail
he already went through 7
Roxifλsz 🇱🇹
Dima
@BinaryByter are you moron
Dima
😕
Mihail
Wait what
got another chance
Mihail
i regret giving him that chance
Dima
yeah and 100 another chances while Maxi can burn their butts thru this all and by going to ot again /ot /closed
BinaryByter
in germany, we just shoot
but thats for OT or NSFW
un_known_
Hi rose can you rectify this? But don’t say that use Void main()
Mimi
Hi rose can you rectify this? But don’t say that use Void main()
Try casting your a to double before returning it
olli
Hi rose can you rectify this? But don’t say that use Void main()
Your function returns an int, so the result in truncated
un_known_
How to rectify
Coz i tried thya
un_known_
That
olli
How to rectify
you can't return either int or double based on the input
Mimi
Change it into double
Mimi
Or better, to x
olli
Also I don't think that's the best use case for templates
un_known_
Or better, to x
Yeah but I wanna different data type for both so i
Mimi
Yeah but I wanna different data type for both so i
Double will be the safest, will suit for them all
un_known_
Mimi
Double will be the safest, will suit for them all
Unless you're gonna have chars or strings there
un_known_
Double will be the safest, will suit for them all
Kk thanks both of you. I posted multiple places but didn’t get anywhere
olli
Why not
Because this template basically offers no benefits. It relies on the existance of the operator < and that the result is convertible to an int. A template would make sense to make sure both types are the same
olli
Yeah sure, but as he said, it's just for learning
Yeah sure - nothing wrong about that :)
Mimi
THE mistake
olli
And the int was a mistake
but then double would be also wrong in my opinion..
Mimi
but then double would be also wrong in my opinion..
For this specific case it'll be enough
olli
un_known_
but then double would be also wrong in my opinion..
I think so coz i used double and int here but it may be possible to use char and int Then will the double work ??
Mimi
Not in the way you expect it to
olli
Why is that
Because double is a floating point number. The range of floating point number is way bigger (given the same amount of bits) so there must be a precision loss
un_known_
Mimi
Then whats the solution here
There's no solution, what will you do if you have chars? Check if 'a' is bigger than 3? What are you getting from it?
Mimi
Because double is a floating point number. The range of floating point number is way bigger (given the same amount of bits) so there must be a precision loss
I mean, if int should be returned, it will be returned as a double: 5 as 5.0. And if it's a double it'll be returned as is: 3.14 as 3.14. Where's the loss? *~*
olli
If it's way bigger, shouldn't it be more accurate??
The difference (absolute) obviously increases, the relative error stays roughly the same. This explains how they are encoded https://en.wikipedia.org/wiki/Floating-point_arithmetic Try this to see the difference #include <iostream> template <class A, class B> double check(A && a, B && b) { if (a > b) { return a; } else { return b; } } int main() { std::cout << static_cast<long long>( check(2.0, 100000000000000013LL)) << '\n'; std::cout << 100000000000000013LL; }