Next: , Previous: , Up: iklib   [Index]


6.51 Debugging utilities

Function: integer->machine-word exact-integer
Function: machine-word->integer word

Convert between an exact integer and a machine word. This operation shows at the Scheme level the internal representation of values. Care must be taken when using these functions because it is very easy to cause undefined behaviour.

;; on 32-bit platforms
(integer->machine-word #b11100) ⇒ #b111

;; on 64-bit platforms
(integer->machine-word #b111000) ⇒ #b111

(integer->machine-word #x3F)    ⇒ #t
(integer->machine-word #x2F)    ⇒ #f

(machine-word->integer #t)      ⇒ #x3F
(machine-word->integer #f)      ⇒ #x2F
Function: flonum->bytevector flo
Function: bytevector->flonum bv

Convert a flonum to a bytevector and vice versa. The flonum’s memory block is copied byte by byte in the data area of the bytevector; and vice versa.

For bytevector->flonum: if the bytevector does not have the length of a flonum’s memory block, the return value is #f.

Function: bignum->bytevector flo
Function: bytevector->bignum bv

Convert a bignum to a bytevector and vice versa. The bignum’s memory block is copied byte by byte in the data area of the bytevector; and vice versa.