Skip to content

Commit

Permalink
Merge branch 'master' into black_format_master
Browse files Browse the repository at this point in the history
  • Loading branch information
lihuoran committed Jun 13, 2022
2 parents 1901820 + 17ad489 commit 842ae00
Showing 1 changed file with 6 additions and 6 deletions.
12 changes: 6 additions & 6 deletions maro/backends/raw_backend.pyx
Original file line number Diff line number Diff line change
Expand Up @@ -517,7 +517,7 @@ cdef class AttributeFloatAccessor(AttributeAccessor):
cdef void set_value(self, NODE_INDEX node_index, SLOT_INDEX slot_index, object value) except +:
n_val = float(f"{value:e}")
assert abs(n_val - value) < 1, f"Value {value} out of range (AttributeType.Float)"
if n_val != value:
if abs(n_val - value) > 0.00001:
warnings.warn(f"[Precision lost] Value {value} would be converted to {n_val}")
self._backend._frame.set_value[ATTR_FLOAT](node_index, self._attr_type, slot_index, value)

Expand All @@ -527,14 +527,14 @@ cdef class AttributeFloatAccessor(AttributeAccessor):
cdef void append_value(self, NODE_INDEX node_index, object value) except +:
n_val = float(f"{value:e}")
assert abs(n_val - value) < 1, f"Value {value} out of range (AttributeType.Float)"
if n_val != value:
if abs(n_val - value) > 0.00001:
warnings.warn(f"[Precision lost] Value {value} would be converted to {n_val}")
self._backend._frame.append_to_list[ATTR_FLOAT](node_index, self._attr_type, value)

cdef void insert_value(self, NODE_INDEX node_index, SLOT_INDEX slot_index, object value) except +:
n_val = float(f"{value:e}")
assert abs(n_val - value) < 1, f"Value {value} out of range (AttributeType.Float)"
if n_val != value:
if abs(n_val - value) > 0.00001:
warnings.warn(f"[Precision lost] Value {value} would be converted to {n_val}")
self._backend._frame.insert_to_list[ATTR_FLOAT](node_index, self._attr_type, slot_index, value)

Expand All @@ -543,7 +543,7 @@ cdef class AttributeDoubleAccessor(AttributeAccessor):
cdef void set_value(self, NODE_INDEX node_index, SLOT_INDEX slot_index, object value) except +:
n_val = float(f"{value:.15e}")
assert abs(n_val - value) < 1, f"Value {value} out of range (AttributeType.Double)"
if n_val != value:
if abs(n_val - value) > 0.00001:
warnings.warn(f"[Precision lost] Value {value} would be converted to {n_val}")
self._backend._frame.set_value[ATTR_DOUBLE](node_index, self._attr_type, slot_index, value)

Expand All @@ -553,13 +553,13 @@ cdef class AttributeDoubleAccessor(AttributeAccessor):
cdef void append_value(self, NODE_INDEX node_index, object value) except +:
n_val = float(f"{value:.15e}")
assert abs(n_val - value) < 1, f"Value {value} out of range (AttributeType.Double)"
if n_val != value:
if abs(n_val - value) > 0.00001:
warnings.warn(f"[Precision lost] Value {value} would be converted to {n_val}")
self._backend._frame.append_to_list[ATTR_DOUBLE](node_index, self._attr_type, value)

cdef void insert_value(self, NODE_INDEX node_index, SLOT_INDEX slot_index, object value) except +:
n_val = float(f"{value:.15e}")
assert abs(n_val - value) < 1, f"Value {value} out of range (AttributeType.Double)"
if n_val != value:
if abs(n_val - value) > 0.00001:
warnings.warn(f"[Precision lost] Value {value} would be converted to {n_val}")
self._backend._frame.insert_to_list[ATTR_DOUBLE](node_index, self._attr_type, slot_index, value)

0 comments on commit 842ae00

Please sign in to comment.