THE STATE OF COMPUTER """SCIENTISTS"""

THE STATE OF COMPUTER """SCIENTISTS""".

HAHAHAHAHAHAHAHA

*inhales*

HAHAHAHAHAHAHAHAHAHAHAHAHAHAHAHAHAHAHAHAHAHAHAHAHAHAHAHAHAHAHAHAHAHAHAHAHAHAHAHAHAHA

JUST

FUCK

KILL

his question has to do with type casting not with averages
it's still a brainlet question but still

simply pathetic, i have no other words to describe this

>/g/
>computer scientists
It's all about weebs phoneposting from their NN safespace whose entry code is Lisp fizzbuzz.

>he doesn't know the le average two ints in c maymay

the memes are real
computer """scientists""" are brainlets

Hes obv just a beginner coder.

c = (a+b)/2;

>abc
>i i i
>i i f
>i f i
>i f f
>f i i
>f i f
>f f i
>f f f
there are 8 ways to write c = (a+b)/2; only with ints and floats nevermind longs and doubles, and 7 of those produce the wrong answer.

OP is clearly a retard and doesn't know a single thing about numbers though. Literally even dumber than the linked thread.

it gets better:

It's just shitposting you autists.

Between ints, floats, longs and doubles, there are 64 ways to write c=(a+b)/2 and only 3 ways to get a correct result. If you're a dummie and dont know how to properly compose the question, you have a 61/64 chance of failing to get the desired result.

So again, only a math brainlet without any functional knowledge of coding as the practical application of math, would make this Veeky Forums thread.

>"At least I didn't waste my time with CS like that retard"

damage control isn't going to work now, pal

...

...

Memes aside, how do you do this without overflows / floating-point inaccuracies?

>overflows
low + (difference / 2) guarantees no overflow
>floating-point inaccuracies
you don't because decimal numbers can't always be represented in non-repeating binary so you just repeat it as much as possible

nice

...

>low + (difference / 2) guarantees no overflow
I'd been doing this but felt like there was a lot of overhead involved. Is there not a way to shift-with-carry?
Something like
[code]
Mov ax, number1
Adc number 2
Ror
Mov average, ax
[/code]

If floating point innacuracy worried you which it probably shouldn't depending on the usage, i'd suggest creating your own calculating algorithm that takes input numbers, does arithmetic on each digit as a whole byte, then outputs a String of integers representing the whole and mantissa where using that result for further arithmetic would then cast the string to a float or double.