MCPcopy Create free account
hub / github.com/apache/singa / DistanceBetweenSignAndMagnitudeNumbers

Method DistanceBetweenSignAndMagnitudeNumbers

test/gtest/gtest.h:7331–7336  ·  view source on GitHub ↗

Given two numbers in the sign-and-magnitude representation, returns the distance between them as an unsigned number.

Source from the content-addressed store, hash-verified

7329 // Given two numbers in the sign-and-magnitude representation,
7330 // returns the distance between them as an unsigned number.
7331 static Bits DistanceBetweenSignAndMagnitudeNumbers(const Bits &sam1,
7332 const Bits &sam2) {
7333 const Bits biased1 = SignAndMagnitudeToBiased(sam1);
7334 const Bits biased2 = SignAndMagnitudeToBiased(sam2);
7335 return (biased1 >= biased2) ? (biased1 - biased2) : (biased2 - biased1);
7336 }
7337
7338 FloatingPointUnion u_;
7339};

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected