HAIDOX
HAIDOX Help

Math Engine Reference: Pc Precision

개요

PC_PRECISION 정밀도 등급과 결정적 병렬 축약 계약을 선언한다.

이 API는 실제로 제공되는 정밀도와 보증만 공개한다. 현재 desktop SDK는 refined binary64, portable arbitrary decimal과 exact checked integer를 제공한다. Extended, quad, arbitrary binary와 exact rational은 등급으로 구분하지만 제공하지 않으며 요청 시 UNSUPPORTED로 닫힌다. 정밀도 한계를 넘는 요청은 OUT_OF_RANGE로 닫힌다.

관련 public header

공개 API

Header 사용 시작

이 module의 public declaration을 사용하려면 installed SDK의 다음 header를 include한다.

#include <math_engine/math_engine_pc_precision.h>

Type과 callback

math_engine_pc_precision_grade_t

PC 정밀 계산에서 구분하는 수 표현 등급이다.

typedef enum math_engine_pc_precision_grade {
    MATH_ENGINE_PC_PRECISION_GRADE_INVALID = 0, /**< Uninitialized or unsupported grade sentinel. */
    MATH_ENGINE_PC_PRECISION_GRADE_BINARY64_REFINED = 1, /**< Compensated 53-bit binary64 with reported bounds. */
    MATH_ENGINE_PC_PRECISION_GRADE_EXTENDED_BINARY = 2, /**< Nominal 64-bit binary precision grade; unavailable here. */
    MATH_ENGINE_PC_PRECISION_GRADE_QUAD_BINARY = 3, /**< IEEE-like 113-bit binary grade; unavailable here. */
    MATH_ENGINE_PC_PRECISION_GRADE_ARBITRARY_DECIMAL = 4, /**< Portable workspace-backed 64..4096-bit decimal grade. */
    MATH_ENGINE_PC_PRECISION_GRADE_ARBITRARY_BINARY = 5, /**< Variable binary precision grade; unavailable here. */
    MATH_ENGINE_PC_PRECISION_GRADE_EXACT_INTEGER = 6, /**< Checked exact signed/unsigned 64-bit integer grade. */
    MATH_ENGINE_PC_PRECISION_GRADE_EXACT_RATIONAL = 7 /**< Exact rational grade; unavailable here. */
} math_engine_pc_precision_grade_t;
  • math_engine_pc_precision_grade_t.MATH_ENGINE_PC_PRECISION_GRADE_INVALID

    Uninitialized or unsupported grade sentinel.

    MATH_ENGINE_PC_PRECISION_GRADE_INVALID = 0,
    
  • math_engine_pc_precision_grade_t.MATH_ENGINE_PC_PRECISION_GRADE_BINARY64_REFINED

    Compensated 53-bit binary64 with reported bounds.

    MATH_ENGINE_PC_PRECISION_GRADE_BINARY64_REFINED = 1,
    
  • math_engine_pc_precision_grade_t.MATH_ENGINE_PC_PRECISION_GRADE_EXTENDED_BINARY

    Nominal 64-bit binary precision grade; unavailable here.

    MATH_ENGINE_PC_PRECISION_GRADE_EXTENDED_BINARY = 2,
    
  • math_engine_pc_precision_grade_t.MATH_ENGINE_PC_PRECISION_GRADE_QUAD_BINARY

    IEEE-like 113-bit binary grade; unavailable here.

    MATH_ENGINE_PC_PRECISION_GRADE_QUAD_BINARY = 3,
    
  • math_engine_pc_precision_grade_t.MATH_ENGINE_PC_PRECISION_GRADE_ARBITRARY_DECIMAL

    Portable workspace-backed 64..4096-bit decimal grade.

    MATH_ENGINE_PC_PRECISION_GRADE_ARBITRARY_DECIMAL = 4,
    
  • math_engine_pc_precision_grade_t.MATH_ENGINE_PC_PRECISION_GRADE_ARBITRARY_BINARY

    Variable binary precision grade; unavailable here.

    MATH_ENGINE_PC_PRECISION_GRADE_ARBITRARY_BINARY = 5,
    
  • math_engine_pc_precision_grade_t.MATH_ENGINE_PC_PRECISION_GRADE_EXACT_INTEGER

    Checked exact signed/unsigned 64-bit integer grade.

    MATH_ENGINE_PC_PRECISION_GRADE_EXACT_INTEGER = 6,
    
  • math_engine_pc_precision_grade_t.MATH_ENGINE_PC_PRECISION_GRADE_EXACT_RATIONAL

    Exact rational grade; unavailable here.

    MATH_ENGINE_PC_PRECISION_GRADE_EXACT_RATIONAL = 7,
    

math_engine_pc_precision_backend_t

공개 구현 family다. 미지원 등급은 NONE이다.

typedef enum math_engine_pc_precision_backend {
    MATH_ENGINE_PC_PRECISION_BACKEND_NONE = 0, /**< No implementation is available for the grade. */
    MATH_ENGINE_PC_PRECISION_BACKEND_BINARY64_COMPENSATED = 1, /**< Deterministic compensated binary64 backend. */
    MATH_ENGINE_PC_PRECISION_BACKEND_PORTABLE_DECIMAL = 2, /**< Caller-workspace arbitrary-decimal backend. */
    MATH_ENGINE_PC_PRECISION_BACKEND_CHECKED_INTEGER = 3 /**< Overflow-checked exact 64-bit integer backend. */
} math_engine_pc_precision_backend_t;
  • math_engine_pc_precision_backend_t.MATH_ENGINE_PC_PRECISION_BACKEND_NONE

    No implementation is available for the grade.

    MATH_ENGINE_PC_PRECISION_BACKEND_NONE = 0,
    
  • math_engine_pc_precision_backend_t.MATH_ENGINE_PC_PRECISION_BACKEND_BINARY64_COMPENSATED

    Deterministic compensated binary64 backend.

    MATH_ENGINE_PC_PRECISION_BACKEND_BINARY64_COMPENSATED = 1,
    
  • math_engine_pc_precision_backend_t.MATH_ENGINE_PC_PRECISION_BACKEND_PORTABLE_DECIMAL

    Caller-workspace arbitrary-decimal backend.

    MATH_ENGINE_PC_PRECISION_BACKEND_PORTABLE_DECIMAL = 2,
    
  • math_engine_pc_precision_backend_t.MATH_ENGINE_PC_PRECISION_BACKEND_CHECKED_INTEGER

    Overflow-checked exact 64-bit integer backend.

    MATH_ENGINE_PC_PRECISION_BACKEND_CHECKED_INTEGER = 3,
    

math_engine_pc_precision_grade_info_t

등급 가용성, bit 범위, backend/version과 보증 집합이다.

typedef struct math_engine_pc_precision_grade_info {
    uint32_t struct_size; /**< Exact byte size supplied by the caller. */
    uint32_t struct_version; /**< =MATH_ENGINE_PC_PRECISION_GRADE_INFO_VERSION_1=. */
    uint32_t grade; /**< Described =math_engine_pc_precision_grade_t=. */
    uint32_t available; /**< Boolean: 1 only when the linked artifact can execute this grade. */
    uint32_t backend; /**< Selected =math_engine_pc_precision_backend_t= or NONE. */
    uint32_t backend_version; /**< Stable implementation algorithm version; currently 1. */
    uint32_t minimum_precision_bits; /**< Inclusive minimum supported/requestable precision. */
    uint32_t maximum_precision_bits; /**< Inclusive maximum, constrained by artifact capability. */
    uint32_t requested_precision_bits; /**< Original resolve request; 0 denotes the grade default. */
    uint32_t effective_precision_bits; /**< Precision actually selected by a successful resolve. */
    uint64_t guarantee_bits; /**< Bitwise =MATH_ENGINE_PC_PRECISION_GUARANTEE_*= set. */
    uint64_t backend_fingerprint; /**< Stable FNV identity of grade availability and backend contract. */
    char backend_name[32]; /**< Inline NUL-terminated backend or unavailability name, at most 31 bytes. */
    uint64_t reserved[2]; /**< Reserved words; written as 0. */
} math_engine_pc_precision_grade_info_t;
  • math_engine_pc_precision_grade_info_t.struct_size

    Exact byte size supplied by the caller.

    uint32_t struct_size;
    
  • math_engine_pc_precision_grade_info_t.struct_version

    MATH_ENGINE_PC_PRECISION_GRADE_INFO_VERSION_1.

    uint32_t struct_version;
    
  • math_engine_pc_precision_grade_info_t.grade

    Described math_engine_pc_precision_grade_t.

    uint32_t grade;
    
  • math_engine_pc_precision_grade_info_t.available

    Boolean: 1 only when the linked artifact can execute this grade.

    uint32_t available;
    
  • math_engine_pc_precision_grade_info_t.backend

    Selected math_engine_pc_precision_backend_t or NONE.

    uint32_t backend;
    
  • math_engine_pc_precision_grade_info_t.backend_version

    Stable implementation algorithm version; currently 1.

    uint32_t backend_version;
    
  • math_engine_pc_precision_grade_info_t.minimum_precision_bits

    Inclusive minimum supported/requestable precision.

    uint32_t minimum_precision_bits;
    
  • math_engine_pc_precision_grade_info_t.maximum_precision_bits

    Inclusive maximum, constrained by artifact capability.

    uint32_t maximum_precision_bits;
    
  • math_engine_pc_precision_grade_info_t.requested_precision_bits

    Original resolve request; 0 denotes the grade default.

    uint32_t requested_precision_bits;
    
  • math_engine_pc_precision_grade_info_t.effective_precision_bits

    Precision actually selected by a successful resolve.

    uint32_t effective_precision_bits;
    
  • math_engine_pc_precision_grade_info_t.guarantee_bits

    Bitwise MATH_ENGINE_PC_PRECISION_GUARANTEE_* set.

    uint64_t guarantee_bits;
    
  • math_engine_pc_precision_grade_info_t.backend_fingerprint

    Stable FNV identity of grade availability and backend contract.

    uint64_t backend_fingerprint;
    
  • math_engine_pc_precision_grade_info_t.backend_name

    Inline NUL-terminated backend or unavailability name, at most 31 bytes.

    char backend_name[32];
    
  • math_engine_pc_precision_grade_info_t.reserved

    Reserved words; written as 0.

    uint64_t reserved[2];
    

math_engine_pc_precision_reduction_request_t

결정적 binary64 합산 요청이다. 0 thread는 runtime 자동 선택이다.

typedef struct math_engine_pc_precision_reduction_request {
    uint32_t struct_size; /**< Exact byte size of this request. */
    uint32_t struct_version; /**< =MATH_ENGINE_PC_PRECISION_REDUCTION_REQUEST_VERSION_1=. */
    uint32_t requested_thread_count; /**< Worker count in [1, MAX_THREADS], or 0 for runtime selection. */
    uint32_t flags; /**< Reserved reduction policy bits; version 1 requires 0. */
    uint64_t memory_budget_bytes; /**< Maximum caller scratch bytes allowed for partial sums. */
    uint64_t reserved[2]; /**< Reserved words; both elements must be 0. */
} math_engine_pc_precision_reduction_request_t;
  • math_engine_pc_precision_reduction_request_t.struct_size

    Exact byte size of this request.

    uint32_t struct_size;
    
  • math_engine_pc_precision_reduction_request_t.struct_version

    MATH_ENGINE_PC_PRECISION_REDUCTION_REQUEST_VERSION_1.

    uint32_t struct_version;
    
  • math_engine_pc_precision_reduction_request_t.requested_thread_count

    Worker count in [1, MAX_THREADS], or 0 for runtime selection.

    uint32_t requested_thread_count;
    
  • math_engine_pc_precision_reduction_request_t.flags

    Reserved reduction policy bits; version 1 requires 0.

    uint32_t flags;
    
  • math_engine_pc_precision_reduction_request_t.memory_budget_bytes

    Maximum caller scratch bytes allowed for partial sums.

    uint64_t memory_budget_bytes;
    
  • math_engine_pc_precision_reduction_request_t.reserved

    Reserved words; both elements must be 0.

    uint64_t reserved[2];
    

math_engine_pc_precision_reduction_result_t

합, 검증 오차, 조건 추정치, backend provenance와 replay fingerprint다.

typedef struct math_engine_pc_precision_reduction_result {
    uint32_t struct_size; /**< Exact byte size supplied by the caller. */
    uint32_t struct_version; /**< =MATH_ENGINE_PC_PRECISION_REDUCTION_RESULT_VERSION_1=. */
    uint32_t flags; /**< Bitwise =MATH_ENGINE_PC_PRECISION_REDUCTION_FLAG_*= diagnostics. */
    uint32_t precision_grade; /**< =MATH_ENGINE_PC_PRECISION_GRADE_BINARY64_REFINED=. */
    uint32_t backend; /**< =MATH_ENGINE_PC_PRECISION_BACKEND_BINARY64_COMPENSATED=. */
    uint32_t effective_precision_bits; /**< Binary64 significand precision; currently 53 bits. */
    uint32_t selected_thread_count; /**< Actual workers in [1, min(block_count, limit)]. */
    uint32_t block_count; /**< =ceil(input_count/256)= deterministic block count. */
    double value; /**< Finite compensated sum in input-value units. */
    double absolute_error_bound; /**< Nonnegative absolute rounding-error bound. */
    double condition_estimate; /**< =sum(abs(values))/abs(value)=, possibly positive infinity. */
    uint64_t input_count; /**< Number of finite binary64 input elements reduced. */
    uint64_t workspace_used_bytes; /**< Partial-sum scratch prefix consumed, in bytes. */
    uint64_t work_units; /**< Deterministic =input_count + 2*block_count= count. */
    uint64_t replay_fingerprint; /**< Worker-count-independent identity of result/provenance. */
    uint64_t reserved[2]; /**< Reserved words; written as 0. */
} math_engine_pc_precision_reduction_result_t;
  • math_engine_pc_precision_reduction_result_t.struct_size

    Exact byte size supplied by the caller.

    uint32_t struct_size;
    
  • math_engine_pc_precision_reduction_result_t.struct_version

    MATH_ENGINE_PC_PRECISION_REDUCTION_RESULT_VERSION_1.

    uint32_t struct_version;
    
  • math_engine_pc_precision_reduction_result_t.flags

    Bitwise MATH_ENGINE_PC_PRECISION_REDUCTION_FLAG_* diagnostics.

    uint32_t flags;
    
  • math_engine_pc_precision_reduction_result_t.precision_grade

    MATH_ENGINE_PC_PRECISION_GRADE_BINARY64_REFINED.

    uint32_t precision_grade;
    
  • math_engine_pc_precision_reduction_result_t.backend

    MATH_ENGINE_PC_PRECISION_BACKEND_BINARY64_COMPENSATED.

    uint32_t backend;
    
  • math_engine_pc_precision_reduction_result_t.effective_precision_bits

    Binary64 significand precision; currently 53 bits.

    uint32_t effective_precision_bits;
    
  • math_engine_pc_precision_reduction_result_t.selected_thread_count

    Actual workers in [1, min(block_count, limit)].

    uint32_t selected_thread_count;
    
  • math_engine_pc_precision_reduction_result_t.block_count

    ceil(input_count/256) deterministic block count.

    uint32_t block_count;
    
  • math_engine_pc_precision_reduction_result_t.value

    Finite compensated sum in input-value units.

    double value;
    
  • math_engine_pc_precision_reduction_result_t.absolute_error_bound

    Nonnegative absolute rounding-error bound.

    double absolute_error_bound;
    
  • math_engine_pc_precision_reduction_result_t.condition_estimate

    sum(abs(values))/abs(value), possibly positive infinity.

    double condition_estimate;
    
  • math_engine_pc_precision_reduction_result_t.input_count

    Number of finite binary64 input elements reduced.

    uint64_t input_count;
    
  • math_engine_pc_precision_reduction_result_t.workspace_used_bytes

    Partial-sum scratch prefix consumed, in bytes.

    uint64_t workspace_used_bytes;
    
  • math_engine_pc_precision_reduction_result_t.work_units

    Deterministic input_count + 2*block_count count.

    uint64_t work_units;
    
  • math_engine_pc_precision_reduction_result_t.replay_fingerprint

    Worker-count-independent identity of result/provenance.

    uint64_t replay_fingerprint;
    
  • math_engine_pc_precision_reduction_result_t.reserved

    Reserved words; written as 0.

    uint64_t reserved[2];
    

Macro와 constant

MATH_ENGINE_PC_PRECISION_GRADE_INFO_VERSION_1

Initial layout version for math_engine_pc_precision_grade_info_t.

#define MATH_ENGINE_PC_PRECISION_GRADE_INFO_VERSION_1 UINT32_C(1)

MATH_ENGINE_PC_PRECISION_GUARANTEE_CERTIFIED

Backend provides a machine-checkable correctness or range certificate.

#define MATH_ENGINE_PC_PRECISION_GUARANTEE_CERTIFIED \
    (UINT64_C(1) << 5u)

MATH_ENGINE_PC_PRECISION_GUARANTEE_CONDITION

Backend reports a numerical conditioning estimate.

#define MATH_ENGINE_PC_PRECISION_GUARANTEE_CONDITION \
    (UINT64_C(1) << 3u)

MATH_ENGINE_PC_PRECISION_GUARANTEE_DETERMINISTIC

Identical inputs and policy produce identical values and provenance.

#define MATH_ENGINE_PC_PRECISION_GUARANTEE_DETERMINISTIC \
    (UINT64_C(1) << 7u)

MATH_ENGINE_PC_PRECISION_GUARANTEE_ERROR_BOUND

Backend reports an explicit absolute error bound.

#define MATH_ENGINE_PC_PRECISION_GUARANTEE_ERROR_BOUND \
    (UINT64_C(1) << 1u)

MATH_ENGINE_PC_PRECISION_GUARANTEE_EXACT

Backend result is mathematically exact within its declared domain.

#define MATH_ENGINE_PC_PRECISION_GUARANTEE_EXACT \
    (UINT64_C(1) << 6u)

MATH_ENGINE_PC_PRECISION_GUARANTEE_REFINED

Backend uses a refined path beyond an uncorrected baseline evaluation.

#define MATH_ENGINE_PC_PRECISION_GUARANTEE_REFINED \
    (UINT64_C(1) << 4u)

MATH_ENGINE_PC_PRECISION_GUARANTEE_RESIDUAL

Backend reports a convergence or algebraic residual.

#define MATH_ENGINE_PC_PRECISION_GUARANTEE_RESIDUAL \
    (UINT64_C(1) << 2u)

MATH_ENGINE_PC_PRECISION_GUARANTEE_ROBUST_PREDICATE

Backend handles near-boundary geometric predicates with a robust policy.

#define MATH_ENGINE_PC_PRECISION_GUARANTEE_ROBUST_PREDICATE \
    (UINT64_C(1) << 8u)

MATH_ENGINE_PC_PRECISION_GUARANTEE_VALUE

Backend commits a usable numerical or exact value on success.

#define MATH_ENGINE_PC_PRECISION_GUARANTEE_VALUE \
    (UINT64_C(1) << 0u)

MATH_ENGINE_PC_PRECISION_MAX_THREADS

Maximum worker count permitted by both the SDK and desktop capability contract.

#define MATH_ENGINE_PC_PRECISION_MAX_THREADS \
    MATH_ENGINE_DESKTOP_THREAD_COUNT_LIMIT

MATH_ENGINE_PC_PRECISION_REDUCTION_BLOCK_ITEMS

Fixed input count per deterministic compensated-sum block.

#define MATH_ENGINE_PC_PRECISION_REDUCTION_BLOCK_ITEMS UINT32_C(256)

MATH_ENGINE_PC_PRECISION_REDUCTION_FLAG_DETERMINISTIC

Fixed blocks and merge order make the result independent of worker count.

#define MATH_ENGINE_PC_PRECISION_REDUCTION_FLAG_DETERMINISTIC \
    (UINT32_C(1) << 2u)

MATH_ENGINE_PC_PRECISION_REDUCTION_FLAG_ERROR_BOUND

absolute_error_bound contains a validated nonnegative bound.

#define MATH_ENGINE_PC_PRECISION_REDUCTION_FLAG_ERROR_BOUND \
    (UINT32_C(1) << 4u)

MATH_ENGINE_PC_PRECISION_REDUCTION_FLAG_PARALLEL

More than one worker executed a block wave.

#define MATH_ENGINE_PC_PRECISION_REDUCTION_FLAG_PARALLEL \
    (UINT32_C(1) << 3u)

MATH_ENGINE_PC_PRECISION_REDUCTION_FLAG_REFINED

Neumaier compensation refined the block and merge sums.

#define MATH_ENGINE_PC_PRECISION_REDUCTION_FLAG_REFINED \
    (UINT32_C(1) << 1u)

MATH_ENGINE_PC_PRECISION_REDUCTION_FLAG_VALUE

A finite compensated sum value was committed.

#define MATH_ENGINE_PC_PRECISION_REDUCTION_FLAG_VALUE \
    (UINT32_C(1) << 0u)

MATH_ENGINE_PC_PRECISION_REDUCTION_REQUEST_VERSION_1

Initial layout version for math_engine_pc_precision_reduction_request_t.

#define MATH_ENGINE_PC_PRECISION_REDUCTION_REQUEST_VERSION_1 UINT32_C(1)

MATH_ENGINE_PC_PRECISION_REDUCTION_RESULT_VERSION_1

Initial layout version for math_engine_pc_precision_reduction_result_t.

#define MATH_ENGINE_PC_PRECISION_REDUCTION_RESULT_VERSION_1 UINT32_C(1)

Function

math_engine_pc_precision_grade_describe

Capability에 대한 정밀도 등급 matrix 한 행을 조회한다.

  • 매개변수 capabilities: 실제 linked artifact의 가용 backend를 나타내는 borrowed descriptor.
  • 매개변수 grade: 조회할 PC precision grade.
  • 매개변수 out_info: 성공 시 가용성·정밀도 범위·보증 bit를 받는 caller-owned storage.
  • 반환: descriptor와 grade가 유효하면 OK, 아니면 해당 음수 상태 code다.

@note 미지원 등급도 OK이며 available=0, backend=NONE으로 반환한다. @note 실패하면 out_info를 변경하지 않는다.

  • Math Engine ownership: capabilities=borrowed out_info=caller
  • Math Engine nullable: capabilities=false out_info=false
  • Math Engine thread_safety: safe
MATH_ENGINE_API math_engine_status_t math_engine_pc_precision_grade_describe(
    const math_engine_capability_descriptor_t* capabilities,
    math_engine_pc_precision_grade_t grade,
    math_engine_pc_precision_grade_info_t* out_info);

math_engine_pc_precision_grade_resolve

요청 bit 수와 보증을 실제 backend 등급으로 엄격하게 해석한다.

  • 매개변수 capabilities: 실제 linked artifact의 가용 backend를 나타내는 borrowed descriptor.
  • 매개변수 grade: 해석할 PC precision grade.
  • 매개변수 requested_precision_bits: 요청 정밀도. 0이면 해당 grade의 기본 정밀도다.
  • 매개변수 required_guarantee_bits: 모두 충족해야 하는 MATH_ENGINE_PC_PRECISION_GUARANTEE_* bit 집합.
  • 매개변수 out_info: 성공 시 선택된 backend와 effective precision을 받는 caller-owned storage.
  • 반환: 지원되면 OK, backend/보증이 없으면 UNSUPPORTED, bit 범위를 넘으면 OUT_OF_RANGE다.

@note 실패하면 out_info를 변경하지 않는다.

  • Math Engine ownership: capabilities=borrowed out_info=caller
  • Math Engine nullable: capabilities=false out_info=false
  • Math Engine thread_safety: safe
MATH_ENGINE_API math_engine_status_t math_engine_pc_precision_grade_resolve(
    const math_engine_capability_descriptor_t* capabilities,
    math_engine_pc_precision_grade_t grade,
    uint32_t requested_precision_bits,
    uint64_t required_guarantee_bits,
    math_engine_pc_precision_grade_info_t* out_info);

math_engine_pc_precision_reduction_workspace_size

count개 binary64 입력의 결정적 축약 workspace 크기를 계산한다.

  • 매개변수 count: 합산할 binary64 원소 수.
  • 매개변수 out_size: 성공 시 필요한 scratch 크기를 byte 단위로 받는 caller-owned storage.
  • 반환: 크기를 계산하면 OK, count가 범위를 넘거나 산술 overflow이면 해당 음수 상태 code다.

@note 실패하면 out_size를 변경하지 않는다.

  • Math Engine ownership: out_size=caller
  • Math Engine nullable: out_size=false
  • Math Engine thread_safety: safe
MATH_ENGINE_API math_engine_status_t
math_engine_pc_precision_reduction_workspace_size(
    uint64_t count,
    uint64_t* out_size);

math_engine_pc_precision_sum_f64

고정 256-item block과 Neumaier 보상 합산으로 결정적 병렬 합을 계산한다.

Block 경계와 최종 merge 순서는 thread 수와 무관하다. 취소 callback은 호출 thread에서 wave 사이에만 실행한다. 실패·취소·budget 소진 시 result와 workspace 외 입력을 보존한다. Workspace는 8-byte 정렬이어야 하며 values/result와 겹치면 안 된다.

  • 매개변수 values: count 개의 finite binary64 값을 담은 borrowed 배열.
  • 매개변수 count: 합산할 원소 수.
  • 매개변수 context: mode, budget과 cancellation을 제공하는 borrowed context.
  • 매개변수 request: thread 수와 memory budget을 지정하는 borrowed request.
  • 매개변수 workspace: block별 보상 합을 저장하는 caller-owned scratch span.
  • 매개변수 out_result: 성공 시 값·오차 bound·provenance를 받는 caller-owned storage.
  • 반환: 성공하면 OK, 비 PC mode는 UNSUPPORTED, 작은 workspace는 INSUFFICIENT_WORKSPACE, 작은 memory budget이나 evaluation budget은 BUDGET_EXHAUSTED, 취소는 CANCELLED다.
  • Math Engine ownership: values=borrowed context=borrowed request=borrowed workspace=caller out_result=caller
  • Math Engine nullable: values=false context=false request=false workspace.data=false out_result=false
  • Math Engine thread_safety: separate_workspace
MATH_ENGINE_API math_engine_status_t math_engine_pc_precision_sum_f64(
    const double* values,
    uint64_t count,
    const math_engine_context_t* context,
    const math_engine_pc_precision_reduction_request_t* request,
    math_engine_mutable_byte_span_t workspace,
    math_engine_pc_precision_reduction_result_t* out_result);