MCPcopy Create free account
hub / github.com/ciphermodelabs/ciphercore / is_negative

Function is_negative

ciphercore-base/src/ops/long_division.rs:350–355  ·  view source on GitHub ↗

Returns 1 where signed number is negative, and 0 elsewhere.

(binary_num: Node)

Source from the content-addressed store, hash-verified

348
349// Returns 1 where signed number is negative, and 0 elsewhere.
350fn is_negative(binary_num: Node) -> Result<Node> {
351 binary_num.get_slice(vec![
352 SliceElement::Ellipsis,
353 SliceElement::SubArray(Some(-1), None, None),
354 ])
355}
356
357// Returns (is_negative(binary_num), abs(binary_num)).
358fn abs(binary_num: Node, is_signed: bool) -> Result<(Node, Node)> {

Callers 1

absFunction · 0.85

Calls 1

get_sliceMethod · 0.45

Tested by

no test coverage detected