Source/Packages

Learning.Numerics

packages/learning/src/Learning/Numerics.alpha

407 lines49 declarations15.7 KiBSHA-256 9d9e1eb74906

def · lines 364–407

numericalConversion

Full file
The caller passes the actual produced/consumed formats, including the accumulation format when crossing an arithmetic boundary. No-conversion admits only identical formats. These checks authorize a typed operation, never an implicit transport conversion or an unimplemented lowering.
364def numericalConversion =
365  (lambda unrestricted source : (family StdNumericFormat) .
366    (lambda unrestricted destination : (family StdNumericFormat) .
367      (lambda unrestricted requested : (family StdOption (family StdNumericConversion)) .
368        (eliminate
369          StdOption
370          (lambda unrestricted current : (family StdOption (family StdNumericConversion)) .
371            (family StdResult (family NumericalFailure) (family StdNumericConversion)))
372          requested
373          (branch
374            StdNone
375            .
376            (numericalRequire
377              (family StdNumericConversion)
378              (naturalEqual (stdNumericFormatCode source) (stdNumericFormatCode destination))
379              (constructor NumericalFailure NumericalMissingConversion)
380              (constructor
381                StdResult
382                StdSuccess
383                (family NumericalFailure)
384                (family StdNumericConversion)
385                (constructor StdNumericConversion StdNumericKeepFormat source))))
386          (branch
387            StdSome
388            conversion
389            .
390            (numericalRequire
391              (family StdNumericConversion)
392              (naturalEqual
393                (stdNumericFormatCode source)
394                (stdNumericFormatCode (stdNumericConversionSource conversion)))
395              (constructor NumericalFailure NumericalConversionSourceMismatch)
396              (numericalRequire
397                (family StdNumericConversion)
398                (naturalEqual
399                  (stdNumericFormatCode destination)
400                  (stdNumericFormatCode (stdNumericConversionDestination conversion)))
401                (constructor NumericalFailure NumericalConversionDestinationMismatch)
402                (constructor
403                  StdResult
404                  StdSuccess
405                  (family NumericalFailure)
406                  (family StdNumericConversion)
407                  conversion))))))))

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.