How to construct Int512 data type?

Hello,

Can anyone give me an example of code that constructs Int512 data type with add, sub, mul, div, pow and sqrt function?

Unfortunately, I don’t think we have native support for 512-bit integers in the stdlib.

Can you show me the piece of code that Mojo constructed Int256, so I can learn to customize it to construct Int512?

Sure. I don’t think it will be as helpful as you might have hoped.

def main():
  var n = Int256(...)
  print(n * n)

Ref:

The idea is that you won’t get ops like add, etc., for free, even if you could well represent a Int512 as SIMD[uint128, 2] or similar.

I thought Mojo is open-source and free. Is it not?

The compiler itself is not yet open-source, though that is entirely irrelevant to this discussion. My point is that if you want to use a type like Int256, you have to implement it yourself. The fact that the standard library is open-source does not mean these features already exist for free.