Skip to main content

function

bin

bin(b: SIMD[bool, 1], /) -> String

Returns the binary representation of a scalar bool.

Args:

  • b (SIMD[bool, 1]): A scalar bool value.

Returns:

The binary string representation of b.

bin[type: DType](num: SIMD[type, 1], /) -> String

Return the binary string representation an integral value.

print(bin(123))
print(bin(-123))
'0b1111011'
'-0b1111011'

Parameters:

  • type (DType): The data type of the integral scalar.

Args:

  • num (SIMD[type, 1]): An integral scalar value.

Returns:

The binary string representation of num.

bin[T: Indexer](num: T, /) -> String

Returns the binary representation of an indexer type.

Parameters:

  • T (Indexer): The Indexer type.

Args:

  • num (T): An indexer value.

Returns:

The binary string representation of num.