MCPcopy Create free account
hub / github.com/BasisResearch/lean.py / lean_box_float

Function lean_box_float

lean_py/_runtime.py:600–610  ·  view source on GitHub ↗
(self, v)

Source from the content-addressed store, hash-verified

598 return self.lean_unbox(o)
599
600 def lean_box_float(self, v):
601 # `lean_box_float` is `static inline` in lean.h, so it's not a
602 # linkable symbol — inline it: alloc a ctor with one double of
603 # scalar payload and store the value at offset 0 of the
604 # post-m_objs region.
605 ctor = self.lean_alloc_ctor(0, 0, ctypes.sizeof(c_double))
606 ctor_cls = structs.get("lean_ctor_object")
607 c = ctypes.cast(ctor, POINTER(ctor_cls))
608 addr = ctypes.addressof(c.contents) + ctor_cls.m_objs.offset
609 ctypes.cast(addr, POINTER(c_double))[0] = v
610 return ctor
611
612 def lean_unbox_float(self, o):
613 ctor_cls = structs.get("lean_ctor_object")

Callers 2

leanpy_box_floatFunction · 0.85
lean_py_to_floatFunction · 0.85

Calls 1

getMethod · 0.45

Tested by

no test coverage detected