Source/Packages

Runtime.NativePointwisePlan

packages/execution/src/Runtime/NativePointwisePlan.alpha

436 lines23 declarations18.6 KiBSHA-256 fd2fbc317365

def · lines 148–165

nativePointwiseNegate

Full file
Adding the sign bit modulo 2^64 flips it without rounding and preserves both zero signs. Subtracting from +0 would not implement negation of +0 correctly.
148def nativePointwiseNegate =
149  (lambda unrestricted scratch : Nat .
150    (lambda unrestricted destination : Nat .
151      (lambda unrestricted source : Nat .
152        (lambda unrestricted tail : (family NativePhysicalCommands) .
153          (nativeFloat64RequireFinite
154            (nativeMemoryLoad source)
155            scratch
156            b"pointwise-nonfinite"
157            (nativeLaunchRecipeCommand
158              (constructor
159                NativePhysicalOperation
160                NativePhysicalAddWord64
161                (nativeMemoryState destination)
162                (nativeMemoryLoad source)
163                (nativeLaunchRecipeImmediate (naturalPowerOfTwo 63)))
164              b"pointwise-negate"
165              tail))))))

The compiler supplied declaration spans and resolved links from this source snapshot. This page does not assert that this file belongs to a checked closure.