v icon indicating copy to clipboard operation
v copied to clipboard

[Bug] `println` refuses to print large number

Open guekho64 opened this issue 4 years ago • 2 comments

What did you do?


module main

fn main () {
 println(i64(0x8000000000000000))
}

What did you expect to see?


-9223372036854775808

What did you see instead?

Literally nothing

Additional Info

  • No warnings / errors when executing with v run Test.v nor v Test.v && ./Test
  • Tested against Weekly V 0.2.2 7664964 and Stable V 0.2.2 46cdf4f
  • Using Ubuntu 20.04.2 LTS -> Kernel: 5.8.0-48-lowlatency
  • Possibly related to #3751 (Although this bug persists even when executing a successfully compiled binary)

guekho64 avatar Mar 29 '21 10:03 guekho64

I'm not a fan of vlang, I found this issue in VLang Memes (wip), so I don't known if vlang compiles also to LLVM Bitcode, anyway the problem is linked to native version of binary, it seems to work "perfectly" (I don't know what the correct output should be) in playground with wasm interpreter (executed in msedge) image

EDIT: ah okay with "LLVM" he meant that the c code in output was compiled with clang... mhh so you could try to compile it with gcc if not already done

carpall avatar Mar 31 '21 16:03 carpall

Apparently, you've just discovered a new/related bug: Playground seems to be broken as well, probably even more than native v. Haven't checked on Windows, but this doesn't look promising...

These should be the correct results:


int(0xffffffff) == -1
i64(0x8000000000000000) == -9223372036854775808

Firefox

image

guekho64 avatar Apr 01 '21 16:04 guekho64

Actual V (0.3.2):

module main

fn main() {
	println(i64(0x8000000000000000) == -9223372036854775808)
}
true

Fixed

ArtemkaKun avatar Jan 16 '23 18:01 ArtemkaKun