With Radare when I do ?, I get a list of answers in the result,

[0x00400a04]> ? -0x120 + 0x110
hex     0xfffffffffffffff0
octal   01777777777777777777760
unit    17179869184.0G
segment fffff000:0ff0
int64   -16
string  "\xf0\xff\xff\xff\xff\xff\xff\xff"
binary  0b1111111111111111111111111111111111111111111111111111111111110000
fvalue: -16.0
float:  nanf
double: nan
trits   0t11112220022122120101211020120210210211100

All of these I understand, except a trit -- the last one. What is this used for?


It's simply the value of the expression shown in the base of 3.

[0x100001200]> ? 3
hex     0x3
octal   03
unit    3
segment 0000:0003
int32   3
string  "\x03"
binary  0b00000011
fvalue: 3.0
float:  0.000000f
double: 0.000000
trits   0t10

The implementation of it is in the unum.c file.

Trit is just an equivalent of bit in the base of 2. Have a look at ternary numeral system on Wiki.

  • But is this used at all ever, or is it there for just novelty? – Evan Carroll Oct 6 '18 at 15:32
  • it's just for convenience. If you need the value in base 3 you have it there. Not sure if I've ever used it ;) – Paweł Łukasik Oct 6 '18 at 16:07
  • I think it's there more for amusement than functionality. Seeing it there is funny, if you're into that kind of humor :D – NirIzr Nov 20 '18 at 5:23

Apparently this is used for binary-coded ternary stuff, or would be anyway if anyone ever used it.

You can find a library which this may actually be used for here.

I think it's total novelty.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.