« first day (2116 days earlier)      last day (1097 days later) » 

5:47 AM
This is (mildly) interesting:
>> int64(4611695988848162845)
ans =
  int64
   4611695988848162845

>> int64(4611695988848162845.3)
ans =
  int64
   4611695988848162816
So int64(00000000) is not the same as x=00000000; int64(x). int64 doesn't cast its input if the input is explicit digits, instead it causes the interpreter to read those digits as a 64-bit integer. But if those digits are not an integer, it does actual casting.
I somehow expected either an error or the .3 to be ignored. Instead it ignores not only the .3 but also the two digits before the .!
 
 
2 hours later…
8:19 AM
@CrisLuengo I don't understand what's going on there, can you explain?
Oh, because double precision loses those integers. Got it.
In [158]: 4611695988848162845.3
Out[158]: 4.611695988848163e+18

In [159]: int(4611695988848162845.3)
Out[159]: 4611695988848162816
so your point is that it's parsed as an integer
octave:1> int64(4611695988848162845)
ans = 4611695988848162816
 
Yeah, props for the interpreter there
I noticed this a while ago, as I was expecting that MATLAB would save that big number in a double before passing it to int64
 
that's what int64(4611695988848162845) would normally mean
same as how for i in 1:1e100 would have to create a large array normally
you can't pass a value to a function without parsing it first
 
yeah but the interpreter needs to save that number somehow, so I guess under the hood it just parses that string carefully
@flawr will have a look, thanks a lot!
 
 
5 hours later…
1:29 PM
posted on April 16, 2021 by Johanna Pingel

The following is a post from Shounak Mitra, Product Manager for Deep Learning Toolbox, here to talk about practical ways to work with TensorFlow and MATLAB. In release R2021a, a converter for... read more >>

 
2:11 PM
@AndrasDeak indeed. But it seems that the MATLAB interpreter doesn’t see int64 as a regular function, its argument is parsed differently than for other functions.
 
Your nickname is Dev-iL but you are a God — Carlos Borau 4 hours ago
2
😊☺️
 
go-D
solid answer btw
 
2:53 PM
ah finally. @AndrasDeak now you got "tests" in TIGRE, but not real tests. They are demos showcasing the features. Still need a GPU for most things :D
not that there is anything inherently I need help with, its more of a "hurray, finally" and you have seen me suffer the most :D
 
heh, congratulations
now write a library that emulates cuda on a CPU
 
hahaha some people have asked me for that, but for CT, that means that instead of 5 minutes, the code can take 20h
and I kinda not sure why adding that is a good idea
 
Of course! That's definitely not your responsibility. And odds are someone somewhere has tried doing that.
 
3:41 PM
@CrisLuengo Interesting! But
@cris I always thought an interpreter executed statements independently of each other. I find its lack of discreetness disturbing — Luis Mendo Sep 16 '19 at 18:24
 
4:26 PM
@LuisMendo Oh, but in this case it is independent. You don't see each number in your code as a separate statement, do you? int64(0) is a different statement than 0. int64 is just not a regular function, it's a way to tell the interpreter to generate a 64-bit integer out of the argument. Just like in C you'd do 0LL.
...actually expression, not statement.
 
@AndrasDeak That was a weird question... glad it's gone already. I love how it's tagged with !
 
4:47 PM
@CrisLuengo that's actually a legit tag there :P
 
5:10 PM
Who knew!
 
@CrisLuengo I do see each number as an statement. To me, int64(0) is the function int64 applied to 0, which is a double number. That's why I find these things disturbing. What's the next step? x = int64(zeros(1e5,1e5); clear x runs in zero time because there's a clear so the interpreter skips the x = ... statement? I think there's something fundamentally wrong with that. But maybe it's me
 
5:28 PM
I think C's 0LL is different, because LL is part of the literal, not a function LL applied to literal 0, am I right?
 
 
1 hour later…
6:45 PM
Yeah, I agree that syntactically int64(literal) looks like two expressions. For instance if something instead of the literal raised an error, I would expect it to happen before int64 is called.
 
7:36 PM
I understand the reasoning, but I think it makes sense to treat int64(0) as a literal. It is much easier than to come up with a new syntax for integer literals larger than flintmax. And it's more efficient than to parse the literal as a double and then cast to integer.
"LL is part of the literal, not a function LL applied to literal 0" In modern C++ you can write functions that are applied to a literal with a postfix: en.cppreference.com/w/cpp/language/user_literal
 
I see why they do it, and it's a pragmatic choice, I'm just saying that it's a hack
 
I'll agree with that.
A lot of the MATLAB language is a hack.
 
7:58 PM
@CrisLuengo Ah, so the distinction is also blurry in C++
I see our point of int64(0) being a convenient way instead of a new literal syntax. But it looks totally like a function call, so one would expect it to behave like one!
@AndrasDeak Exactly!
 

« first day (2116 days earlier)      last day (1097 days later) »