Anonymous
somebody?
klimi
nope
Anonymous
Dani
I wonder why so many Linux distros come with such old gcc versions. Last time i had to compile gcc myself to get std::optional
数学の恋人
can someone tell what's wrong with this peice of code
数学の恋人
BinaryByter
everything
数学の恋人
everything
Whoa crazy
数学の恋人
Seriously, someone please tell.
BinaryByter
look
BinaryByter
you can't just take the name of a typeid and compare it to a string
BinaryByter
typeid isnt the name of your class
数学の恋人
I need to return ans if it is int
BinaryByter
you... don't?
Ariana
omt auto breaks my eyes
Mat
I need to return ans if it is int
Why it should not be an int?
数学の恋人
but on stdout it returns i
Mat
Just use int instead of auto
Ariana
then just int ans
Ariana
yeah
Ariana
auto is like var in js
BinaryByter
yes
Ariana
its nice, but doesnt help if you want the var to be a specific type
数学の恋人
Why it should not be an int?
if it isn't int then an impossible case has been given as input that's why but according to maths it will have answer in decimals
Ariana
what
数学の恋人
but generally answer received should be int
Ariana
???
Mat
A code is deterministic
数学の恋人
okay wait let me explain the problem itself
Mat
You can't have something you shouldn't🤔
数学の恋人
I know, but wait let me explain
数学の恋人
数学の恋人
last line tells it should be +ve integer
数学の恋人
not float or anything
Ariana
integer means int
数学の恋人
yep
Ariana
so could just do int ans
数学の恋人
then sorting impossible scenario wouldn't be possible
Ariana
use modulo
Anonymous
C# group?
Ariana
like if(v*blah % k==0
数学の恋人
Okay I'll try that
Mat
not float or anything
Yeah. Declare the stuff as int. You'll have int numbers
数学の恋人
Okay
数学の恋人
like if(v*blah % k==0
Hi, as you suggested I did same but instead I compared ans with floor(ans), if equal means int, else something else.
Ariana
nop
Ariana
floor(ans) will always equal ans
Ariana
Cuz ans is an int
Mat
Just int ans;
数学の恋人
You can't have something different from an int!
I didn't change it's datatype to int, I left it auto
Mat
You're overcomplicating your life
数学の恋人
why?
数学の恋人
but it works as expected
BinaryByter
#ot
Sasuke
What's the meaning of precision in data types?
BinaryByter
what does it sound like?
Sasuke
Sounds like "accurate"
Sasuke
But accurate I doesn't think fits
BinaryByter
it doesnt
BinaryByter
basically its how close a datatype gets to the actual value
Anonymous
It's perfectly fits bro
Sasuke
basically its how close a datatype gets to the actual value
Actual value? How they can be different. It's what we assign. If we do x = 10.5 it's 10.5
BinaryByter
not exactly
BinaryByter
you'd think that it is
BinaryByter
but floats aren't stored like that
BinaryByter
floats are stored like this: a * 2 ^ b
BinaryByter
the cpu searches two integers for a and b that most closely approximate your float
BinaryByter
but they don't always fit
Sasuke
Didn't understand
BinaryByter
google ieee754
BinaryByter
floats are stored like this: a * 2 ^ b
thats how the float is stored