Math Engine Reference: Math Functions
문서 탐색
개요
Version이 고정된 scalar 수학 함수와 함수 inventory C ABI를 선언한다.
이 component는 elementary·special·combinatorial·distribution value 계산을 소유한다. RNG state와 sampling은 RNG component가 소유하며 expression 이름은 이 header의 안정된 inventory를 소비한다. 모든 output 함수는 failure-atomic하고 성공 시 선택된 구현과 오차 추정치를 함께 제공한다. 입력과 결과의 수학적 값은 별도 표기가 없으면 무차원이다.
- 실행 원본:
include/math_engine/math_engine_math_functions.h - 분류: 일반 수학·수치 알고리즘
관련 public header
공개 API
Header 사용 시작
이 module의 public declaration을 사용하려면 installed SDK의 다음 header를 include한다.
#include <math_engine/math_engine_math_functions.h>
Type과 callback
math_engine_math_function_group_t
Expression registry와 inventory가 공유하는 안정된 함수 family다.
typedef enum math_engine_math_function_group {
/** 유효한 함수 family가 없음을 나타내는 sentinel이다. */
MATH_ENGINE_MATH_GROUP_INVALID = 0,
/** Root, exponential, logarithm, power와 absolute-value 함수 family다. */
MATH_ENGINE_MATH_GROUP_ELEMENTARY = 1,
/** Circular trigonometric 함수와 inverse 함수 family다. */
MATH_ENGINE_MATH_GROUP_TRIGONOMETRIC = 2,
/** Hyperbolic 함수와 inverse 함수 family다. */
MATH_ENGINE_MATH_GROUP_HYPERBOLIC = 3,
/** Gamma, beta와 error-function family다. */
MATH_ENGINE_MATH_GROUP_SPECIAL = 4,
/** Factorial과 binomial coefficient family다. */
MATH_ENGINE_MATH_GROUP_COMBINATORIAL = 5,
/** Probability mass/density, CDF와 quantile 함수 family다. */
MATH_ENGINE_MATH_GROUP_DISTRIBUTION = 6
} math_engine_math_function_group_t;
math_engine_math_function_group_t.MATH_ENGINE_MATH_GROUP_INVALID
유효한 함수 family가 없음을 나타내는 sentinel이다.
/** 유효한 함수 family가 없음을 나타내는 sentinel이다. */ MATH_ENGINE_MATH_GROUP_INVALID = 0,math_engine_math_function_group_t.MATH_ENGINE_MATH_GROUP_ELEMENTARY
Root, exponential, logarithm, power와 absolute-value 함수 family다.
/** Root, exponential, logarithm, power와 absolute-value 함수 family다. */ MATH_ENGINE_MATH_GROUP_ELEMENTARY = 1,math_engine_math_function_group_t.MATH_ENGINE_MATH_GROUP_TRIGONOMETRIC
Circular trigonometric 함수와 inverse 함수 family다.
/** Circular trigonometric 함수와 inverse 함수 family다. */ MATH_ENGINE_MATH_GROUP_TRIGONOMETRIC = 2,math_engine_math_function_group_t.MATH_ENGINE_MATH_GROUP_HYPERBOLIC
Hyperbolic 함수와 inverse 함수 family다.
/** Hyperbolic 함수와 inverse 함수 family다. */ MATH_ENGINE_MATH_GROUP_HYPERBOLIC = 3,math_engine_math_function_group_t.MATH_ENGINE_MATH_GROUP_SPECIAL
Gamma, beta와 error-function family다.
/** Gamma, beta와 error-function family다. */ MATH_ENGINE_MATH_GROUP_SPECIAL = 4,math_engine_math_function_group_t.MATH_ENGINE_MATH_GROUP_COMBINATORIAL
Factorial과 binomial coefficient family다.
/** Factorial과 binomial coefficient family다. */ MATH_ENGINE_MATH_GROUP_COMBINATORIAL = 5,math_engine_math_function_group_t.MATH_ENGINE_MATH_GROUP_DISTRIBUTION
Probability mass/density, CDF와 quantile 함수 family다.
/** Probability mass/density, CDF와 quantile 함수 family다. */ MATH_ENGINE_MATH_GROUP_DISTRIBUTION = 6,
math_engine_math_function_t
Append-only 함수 식별자다. 이름·arity·domain은 inventory descriptor에서 조회한다.
typedef enum math_engine_math_function {
/** 유효한 catalog function이 없음을 나타내는 sentinel이다. */
MATH_ENGINE_MATH_FUNCTION_INVALID = 0,
/** =sqrt(x)=. Arity 1이며 domain은 =x >= 0=이다. */
MATH_ENGINE_MATH_FUNCTION_SQRT = 1,
/** 실수 cube root =cbrt(x)=. Arity 1이며 모든 finite =x=를 허용한다. */
MATH_ENGINE_MATH_FUNCTION_CBRT = 2,
/** 자연 exponential =exp(x)=. Arity 1; game-fast에서는 =|x| <= 80=이다. */
MATH_ENGINE_MATH_FUNCTION_EXP = 3,
/** 작은 =x=에도 정확한 =exp(x)-1=. Arity 1; game-fast에서는 =|x| <= 80=이다. */
MATH_ENGINE_MATH_FUNCTION_EXPM1 = 4,
/** Natural logarithm =ln(x)=. Arity 1이며 =x > 0=이다. */
MATH_ENGINE_MATH_FUNCTION_LOG = 5,
/** 작은 =x=에도 정확한 =ln(1+x)=. Arity 1이며 =x > -1=이다. */
MATH_ENGINE_MATH_FUNCTION_LOG1P = 6,
/** Radian angle =x=의 sine. Arity 1; game-fast에서는 =|x| <= 10^6=이다. */
MATH_ENGINE_MATH_FUNCTION_SIN = 7,
/** Radian angle =x=의 cosine. Arity 1; game-fast에서는 =|x| <= 10^6=이다. */
MATH_ENGINE_MATH_FUNCTION_COS = 8,
/** Radian =tan(x)=. Arity 1, pole 제외; game-fast에서는 =|x| <= 10^6=이다. */
MATH_ENGINE_MATH_FUNCTION_TAN = 9,
/** Principal arcsine. Arity 1, =-1 <= x <= 1=, 결과 단위는 radian이다. */
MATH_ENGINE_MATH_FUNCTION_ASIN = 10,
/** Principal arccosine. Arity 1, =-1 <= x <= 1=, 결과 단위는 radian이다. */
MATH_ENGINE_MATH_FUNCTION_ACOS = 11,
/** Principal arctangent. Arity 1, finite =x=, 결과 단위는 radian이다. */
MATH_ENGINE_MATH_FUNCTION_ATAN = 12,
/** Quadrant-aware =atan2(y,x)=. Arity 2, 두 값이 동시에 0일 수 없고 결과는 radian이다. */
MATH_ENGINE_MATH_FUNCTION_ATAN2 = 13,
/** Real =pow(base,exponent)=. 음의 base는 integer 지수만, =0^0=은 오류, =0^negative=는 pole이다. */
MATH_ENGINE_MATH_FUNCTION_POW = 14,
/** Hyperbolic sine =sinh(x)=. Arity 1이며 finite =x=를 허용한다. */
MATH_ENGINE_MATH_FUNCTION_SINH = 15,
/** Hyperbolic cosine =cosh(x)=. Arity 1이며 finite =x=를 허용한다. */
MATH_ENGINE_MATH_FUNCTION_COSH = 16,
/** Hyperbolic tangent =tanh(x)=. Arity 1이며 finite =x=를 허용한다. */
MATH_ENGINE_MATH_FUNCTION_TANH = 17,
/** Refined-mode gamma =Γ(x)=. Arity 1이며 nonpositive integer pole을 제외한다. */
MATH_ENGINE_MATH_FUNCTION_GAMMA = 18,
/** Refined-mode =log(|Γ(x)|)=. Arity 1이며 nonpositive integer pole을 제외한다. */
MATH_ENGINE_MATH_FUNCTION_LOG_GAMMA = 19,
/** Refined-mode Euler beta =B(x,y)=. Arity 2이며 =x > 0=, =y > 0=이다. */
MATH_ENGINE_MATH_FUNCTION_BETA = 20,
/** Gauss error function =erf(x)=. Arity 1이며 finite =x=를 허용한다. */
MATH_ENGINE_MATH_FUNCTION_ERF = 21,
/** Complementary error function =1-erf(x)=. Arity 1이며 finite =x=를 허용한다. */
MATH_ENGINE_MATH_FUNCTION_ERFC = 22,
/** Factorial =n!=. Arity 1이며 integer =0 <= n <= 170=이다. */
MATH_ENGINE_MATH_FUNCTION_FACTORIAL = 23,
/** Binomial coefficient =C(n,k)=. Arity 2이며 integer =0 <= k <= n <= 1024=다. */
MATH_ENGINE_MATH_FUNCTION_BINOMIAL = 24,
/** Normal PDF =(x, mean, sigma)=. Arity 3이며 =sigma > 0=이다. */
MATH_ENGINE_MATH_FUNCTION_NORMAL_PDF = 25,
/** Normal CDF =(x, mean, sigma)=. Arity 3이며 =sigma > 0=이다. */
MATH_ENGINE_MATH_FUNCTION_NORMAL_CDF = 26,
/** Refined-mode normal quantile =(p,mean,sigma)=. Arity 3, =p in (0,1)=, =sigma>0=이다. */
MATH_ENGINE_MATH_FUNCTION_NORMAL_QUANTILE = 27,
/** Exponential PDF =(x, lambda)=. Arity 2, =lambda > 0=이며 =x < 0=에서는 0이다. */
MATH_ENGINE_MATH_FUNCTION_EXPONENTIAL_PDF = 28,
/** Exponential CDF =(x, lambda)=. Arity 2, =lambda > 0=이며 =x < 0=에서는 0이다. */
MATH_ENGINE_MATH_FUNCTION_EXPONENTIAL_CDF = 29,
/** Exponential quantile =(p, lambda)=. Arity 2이며 =0 <= p < 1=, =lambda > 0=이다. */
MATH_ENGINE_MATH_FUNCTION_EXPONENTIAL_QUANTILE = 30,
/** Continuous-uniform PDF =(x,min,max)=. Arity 3이며 =min < max=이다. */
MATH_ENGINE_MATH_FUNCTION_UNIFORM_PDF = 31,
/** Continuous-uniform CDF =(x,min,max)=. Arity 3이며 =min < max=이다. */
MATH_ENGINE_MATH_FUNCTION_UNIFORM_CDF = 32,
/** Continuous-uniform quantile =(p,min,max)=. Arity 3이며 =0 <= p <= 1=, =min < max=다. */
MATH_ENGINE_MATH_FUNCTION_UNIFORM_QUANTILE = 33,
/** Triangular PDF =(x,min,max,mode)=. Arity 4이며 =min < mode < max=다. */
MATH_ENGINE_MATH_FUNCTION_TRIANGULAR_PDF = 34,
/** Triangular CDF =(x,min,max,mode)=. Arity 4이며 =min < mode < max=다. */
MATH_ENGINE_MATH_FUNCTION_TRIANGULAR_CDF = 35,
/** Triangular quantile =(p,min,max,mode)=. Arity 4, =p in [0,1]=, =min<mode<max=다. */
MATH_ENGINE_MATH_FUNCTION_TRIANGULAR_QUANTILE = 36,
/** Bernoulli PMF =(k,p)=. Arity 2이며 integer =k in {0,1}=, =p in [0,1]=이다. */
MATH_ENGINE_MATH_FUNCTION_BERNOULLI_PMF = 37,
/** Bernoulli CDF =(x,p)=. Arity 2이며 finite =x=, =p in [0,1]=이다. */
MATH_ENGINE_MATH_FUNCTION_BERNOULLI_CDF = 38,
/** Bernoulli quantile =(q,p)=. Arity 2이며 =q,p in [0,1]=이다. */
MATH_ENGINE_MATH_FUNCTION_BERNOULLI_QUANTILE = 39,
/** Poisson PMF =(k,lambda)=. Arity 2, integer =k in [0,4096]=, =lambda in (0,256]=다. */
MATH_ENGINE_MATH_FUNCTION_POISSON_PMF = 40,
/** Poisson CDF =(k,lambda)=. Arity 2, integer =k in [0,4096]=, =lambda in (0,256]=다. */
MATH_ENGINE_MATH_FUNCTION_POISSON_CDF = 41,
/** Poisson quantile =(p,lambda)=. Arity 2이며 =p in [0,1)=, =lambda in (0,256]=다. */
MATH_ENGINE_MATH_FUNCTION_POISSON_QUANTILE = 42,
/** Inverse hyperbolic sine =asinh(x)=. Arity 1이며 finite =x=를 허용한다. */
MATH_ENGINE_MATH_FUNCTION_ASINH = 43,
/** Inverse hyperbolic cosine =acosh(x)=. Arity 1이며 =x >= 1=이다. */
MATH_ENGINE_MATH_FUNCTION_ACOSH = 44,
/** Inverse hyperbolic tangent =atanh(x)=. Arity 1이며 =-1 < x < 1=이다. */
MATH_ENGINE_MATH_FUNCTION_ATANH = 45,
/** Base-10 logarithm =log10(x)=. Arity 1이며 =x > 0=이다. */
MATH_ENGINE_MATH_FUNCTION_LOG10 = 46,
/** Absolute value =|x|=. Arity 1이며 finite =x=를 허용한다. */
MATH_ENGINE_MATH_FUNCTION_ABS = 47
} math_engine_math_function_t;
math_engine_math_function_t.MATH_ENGINE_MATH_FUNCTION_INVALID
유효한 catalog function이 없음을 나타내는 sentinel이다.
/** 유효한 catalog function이 없음을 나타내는 sentinel이다. */ MATH_ENGINE_MATH_FUNCTION_INVALID = 0,math_engine_math_function_t.MATH_ENGINE_MATH_FUNCTION_SQRT
sqrt(x). Arity 1이며 domain은x >0=이다./** =sqrt(x)=. Arity 1이며 domain은 =x >= 0=이다. */ MATH_ENGINE_MATH_FUNCTION_SQRT = 1,math_engine_math_function_t.MATH_ENGINE_MATH_FUNCTION_CBRT
실수 cube root
cbrt(x). Arity 1이며 모든 finitex를 허용한다./** 실수 cube root =cbrt(x)=. Arity 1이며 모든 finite =x=를 허용한다. */ MATH_ENGINE_MATH_FUNCTION_CBRT = 2,math_engine_math_function_t.MATH_ENGINE_MATH_FUNCTION_EXP
자연 exponential
exp(x). Arity 1; game-fast에서는|x| <80=이다./** 자연 exponential =exp(x)=. Arity 1; game-fast에서는 =|x| <= 80=이다. */ MATH_ENGINE_MATH_FUNCTION_EXP = 3,math_engine_math_function_t.MATH_ENGINE_MATH_FUNCTION_EXPM1
작은
x에도 정확한exp(x)-1. Arity 1; game-fast에서는|x| <80=이다./** 작은 =x=에도 정확한 =exp(x)-1=. Arity 1; game-fast에서는 =|x| <= 80=이다. */ MATH_ENGINE_MATH_FUNCTION_EXPM1 = 4,math_engine_math_function_t.MATH_ENGINE_MATH_FUNCTION_LOG
Natural logarithm
ln(x). Arity 1이며x > 0이다./** Natural logarithm =ln(x)=. Arity 1이며 =x > 0=이다. */ MATH_ENGINE_MATH_FUNCTION_LOG = 5,math_engine_math_function_t.MATH_ENGINE_MATH_FUNCTION_LOG1P
작은
x에도 정확한ln(1+x). Arity 1이며x > -1이다./** 작은 =x=에도 정확한 =ln(1+x)=. Arity 1이며 =x > -1=이다. */ MATH_ENGINE_MATH_FUNCTION_LOG1P = 6,math_engine_math_function_t.MATH_ENGINE_MATH_FUNCTION_SIN
Radian angle
x의 sine. Arity 1; game-fast에서는|x| <10^6=이다./** Radian angle =x=의 sine. Arity 1; game-fast에서는 =|x| <= 10^6=이다. */ MATH_ENGINE_MATH_FUNCTION_SIN = 7,math_engine_math_function_t.MATH_ENGINE_MATH_FUNCTION_COS
Radian angle
x의 cosine. Arity 1; game-fast에서는|x| <10^6=이다./** Radian angle =x=의 cosine. Arity 1; game-fast에서는 =|x| <= 10^6=이다. */ MATH_ENGINE_MATH_FUNCTION_COS = 8,math_engine_math_function_t.MATH_ENGINE_MATH_FUNCTION_TAN
Radian
tan(x). Arity 1, pole 제외; game-fast에서는|x| <10^6=이다./** Radian =tan(x)=. Arity 1, pole 제외; game-fast에서는 =|x| <= 10^6=이다. */ MATH_ENGINE_MATH_FUNCTION_TAN = 9,math_engine_math_function_t.MATH_ENGINE_MATH_FUNCTION_ASIN
Principal arcsine. Arity 1,
-1 <x <= 1=, 결과 단위는 radian이다./** Principal arcsine. Arity 1, =-1 <= x <= 1=, 결과 단위는 radian이다. */ MATH_ENGINE_MATH_FUNCTION_ASIN = 10,math_engine_math_function_t.MATH_ENGINE_MATH_FUNCTION_ACOS
Principal arccosine. Arity 1,
-1 <x <= 1=, 결과 단위는 radian이다./** Principal arccosine. Arity 1, =-1 <= x <= 1=, 결과 단위는 radian이다. */ MATH_ENGINE_MATH_FUNCTION_ACOS = 11,math_engine_math_function_t.MATH_ENGINE_MATH_FUNCTION_ATAN
Principal arctangent. Arity 1, finite
x, 결과 단위는 radian이다./** Principal arctangent. Arity 1, finite =x=, 결과 단위는 radian이다. */ MATH_ENGINE_MATH_FUNCTION_ATAN = 12,math_engine_math_function_t.MATH_ENGINE_MATH_FUNCTION_ATAN2
Quadrant-aware
atan2(y,x). Arity 2, 두 값이 동시에 0일 수 없고 결과는 radian이다./** Quadrant-aware =atan2(y,x)=. Arity 2, 두 값이 동시에 0일 수 없고 결과는 radian이다. */ MATH_ENGINE_MATH_FUNCTION_ATAN2 = 13,math_engine_math_function_t.MATH_ENGINE_MATH_FUNCTION_POW
Real
pow(base,exponent). 음의 base는 integer 지수만, =0^0=은 오류, =0^negative=는 pole이다./** Real =pow(base,exponent)=. 음의 base는 integer 지수만, =0^0=은 오류, =0^negative=는 pole이다. */ MATH_ENGINE_MATH_FUNCTION_POW = 14,math_engine_math_function_t.MATH_ENGINE_MATH_FUNCTION_SINH
Hyperbolic sine
sinh(x). Arity 1이며 finitex를 허용한다./** Hyperbolic sine =sinh(x)=. Arity 1이며 finite =x=를 허용한다. */ MATH_ENGINE_MATH_FUNCTION_SINH = 15,math_engine_math_function_t.MATH_ENGINE_MATH_FUNCTION_COSH
Hyperbolic cosine
cosh(x). Arity 1이며 finitex를 허용한다./** Hyperbolic cosine =cosh(x)=. Arity 1이며 finite =x=를 허용한다. */ MATH_ENGINE_MATH_FUNCTION_COSH = 16,math_engine_math_function_t.MATH_ENGINE_MATH_FUNCTION_TANH
Hyperbolic tangent
tanh(x). Arity 1이며 finitex를 허용한다./** Hyperbolic tangent =tanh(x)=. Arity 1이며 finite =x=를 허용한다. */ MATH_ENGINE_MATH_FUNCTION_TANH = 17,math_engine_math_function_t.MATH_ENGINE_MATH_FUNCTION_GAMMA
Refined-mode gamma
Γ(x). Arity 1이며 nonpositive integer pole을 제외한다./** Refined-mode gamma =Γ(x)=. Arity 1이며 nonpositive integer pole을 제외한다. */ MATH_ENGINE_MATH_FUNCTION_GAMMA = 18,math_engine_math_function_t.MATH_ENGINE_MATH_FUNCTION_LOG_GAMMA
Refined-mode
log(|Γ(x)|). Arity 1이며 nonpositive integer pole을 제외한다./** Refined-mode =log(|Γ(x)|)=. Arity 1이며 nonpositive integer pole을 제외한다. */ MATH_ENGINE_MATH_FUNCTION_LOG_GAMMA = 19,math_engine_math_function_t.MATH_ENGINE_MATH_FUNCTION_BETA
Refined-mode Euler beta
B(x,y). Arity 2이며x > 0,y > 0이다./** Refined-mode Euler beta =B(x,y)=. Arity 2이며 =x > 0=, =y > 0=이다. */ MATH_ENGINE_MATH_FUNCTION_BETA = 20,math_engine_math_function_t.MATH_ENGINE_MATH_FUNCTION_ERF
Gauss error function
erf(x). Arity 1이며 finitex를 허용한다./** Gauss error function =erf(x)=. Arity 1이며 finite =x=를 허용한다. */ MATH_ENGINE_MATH_FUNCTION_ERF = 21,math_engine_math_function_t.MATH_ENGINE_MATH_FUNCTION_ERFC
Complementary error function
1-erf(x). Arity 1이며 finitex를 허용한다./** Complementary error function =1-erf(x)=. Arity 1이며 finite =x=를 허용한다. */ MATH_ENGINE_MATH_FUNCTION_ERFC = 22,math_engine_math_function_t.MATH_ENGINE_MATH_FUNCTION_FACTORIAL
Factorial
n!. Arity 1이며 integer0 <n <= 170=이다./** Factorial =n!=. Arity 1이며 integer =0 <= n <= 170=이다. */ MATH_ENGINE_MATH_FUNCTION_FACTORIAL = 23,math_engine_math_function_t.MATH_ENGINE_MATH_FUNCTION_BINOMIAL
Binomial coefficient
C(n,k). Arity 2이며 integer0 <k <= n <= 1024=다./** Binomial coefficient =C(n,k)=. Arity 2이며 integer =0 <= k <= n <= 1024=다. */ MATH_ENGINE_MATH_FUNCTION_BINOMIAL = 24,math_engine_math_function_t.MATH_ENGINE_MATH_FUNCTION_NORMAL_PDF
Normal PDF
(x, mean, sigma). Arity 3이며sigma > 0이다./** Normal PDF =(x, mean, sigma)=. Arity 3이며 =sigma > 0=이다. */ MATH_ENGINE_MATH_FUNCTION_NORMAL_PDF = 25,math_engine_math_function_t.MATH_ENGINE_MATH_FUNCTION_NORMAL_CDF
Normal CDF
(x, mean, sigma). Arity 3이며sigma > 0이다./** Normal CDF =(x, mean, sigma)=. Arity 3이며 =sigma > 0=이다. */ MATH_ENGINE_MATH_FUNCTION_NORMAL_CDF = 26,math_engine_math_function_t.MATH_ENGINE_MATH_FUNCTION_NORMAL_QUANTILE
Refined-mode normal quantile
(p,mean,sigma). Arity 3,p in (0,1),sigma>0이다./** Refined-mode normal quantile =(p,mean,sigma)=. Arity 3, =p in (0,1)=, =sigma>0=이다. */ MATH_ENGINE_MATH_FUNCTION_NORMAL_QUANTILE = 27,math_engine_math_function_t.MATH_ENGINE_MATH_FUNCTION_EXPONENTIAL_PDF
Exponential PDF
(x, lambda). Arity 2,lambda > 0이며x < 0에서는 0이다./** Exponential PDF =(x, lambda)=. Arity 2, =lambda > 0=이며 =x < 0=에서는 0이다. */ MATH_ENGINE_MATH_FUNCTION_EXPONENTIAL_PDF = 28,math_engine_math_function_t.MATH_ENGINE_MATH_FUNCTION_EXPONENTIAL_CDF
Exponential CDF
(x, lambda). Arity 2,lambda > 0이며x < 0에서는 0이다./** Exponential CDF =(x, lambda)=. Arity 2, =lambda > 0=이며 =x < 0=에서는 0이다. */ MATH_ENGINE_MATH_FUNCTION_EXPONENTIAL_CDF = 29,math_engine_math_function_t.MATH_ENGINE_MATH_FUNCTION_EXPONENTIAL_QUANTILE
Exponential quantile
(p, lambda). Arity 2이며0 <p < 1=,lambda > 0이다./** Exponential quantile =(p, lambda)=. Arity 2이며 =0 <= p < 1=, =lambda > 0=이다. */ MATH_ENGINE_MATH_FUNCTION_EXPONENTIAL_QUANTILE = 30,math_engine_math_function_t.MATH_ENGINE_MATH_FUNCTION_UNIFORM_PDF
Continuous-uniform PDF
(x,min,max). Arity 3이며min < max이다./** Continuous-uniform PDF =(x,min,max)=. Arity 3이며 =min < max=이다. */ MATH_ENGINE_MATH_FUNCTION_UNIFORM_PDF = 31,math_engine_math_function_t.MATH_ENGINE_MATH_FUNCTION_UNIFORM_CDF
Continuous-uniform CDF
(x,min,max). Arity 3이며min < max이다./** Continuous-uniform CDF =(x,min,max)=. Arity 3이며 =min < max=이다. */ MATH_ENGINE_MATH_FUNCTION_UNIFORM_CDF = 32,math_engine_math_function_t.MATH_ENGINE_MATH_FUNCTION_UNIFORM_QUANTILE
Continuous-uniform quantile
(p,min,max). Arity 3이며0 <p <= 1=,min < max다./** Continuous-uniform quantile =(p,min,max)=. Arity 3이며 =0 <= p <= 1=, =min < max=다. */ MATH_ENGINE_MATH_FUNCTION_UNIFORM_QUANTILE = 33,math_engine_math_function_t.MATH_ENGINE_MATH_FUNCTION_TRIANGULAR_PDF
Triangular PDF
(x,min,max,mode). Arity 4이며min < mode < max다./** Triangular PDF =(x,min,max,mode)=. Arity 4이며 =min < mode < max=다. */ MATH_ENGINE_MATH_FUNCTION_TRIANGULAR_PDF = 34,math_engine_math_function_t.MATH_ENGINE_MATH_FUNCTION_TRIANGULAR_CDF
Triangular CDF
(x,min,max,mode). Arity 4이며min < mode < max다./** Triangular CDF =(x,min,max,mode)=. Arity 4이며 =min < mode < max=다. */ MATH_ENGINE_MATH_FUNCTION_TRIANGULAR_CDF = 35,math_engine_math_function_t.MATH_ENGINE_MATH_FUNCTION_TRIANGULAR_QUANTILE
Triangular quantile
(p,min,max,mode). Arity 4,p in [0,1],min<mode<max다./** Triangular quantile =(p,min,max,mode)=. Arity 4, =p in [0,1]=, =min<mode<max=다. */ MATH_ENGINE_MATH_FUNCTION_TRIANGULAR_QUANTILE = 36,math_engine_math_function_t.MATH_ENGINE_MATH_FUNCTION_BERNOULLI_PMF
Bernoulli PMF
(k,p). Arity 2이며 integerk in {0,1},p in [0,1]이다./** Bernoulli PMF =(k,p)=. Arity 2이며 integer =k in {0,1}=, =p in [0,1]=이다. */ MATH_ENGINE_MATH_FUNCTION_BERNOULLI_PMF = 37,math_engine_math_function_t.MATH_ENGINE_MATH_FUNCTION_BERNOULLI_CDF
Bernoulli CDF
(x,p). Arity 2이며 finitex,p in [0,1]이다./** Bernoulli CDF =(x,p)=. Arity 2이며 finite =x=, =p in [0,1]=이다. */ MATH_ENGINE_MATH_FUNCTION_BERNOULLI_CDF = 38,math_engine_math_function_t.MATH_ENGINE_MATH_FUNCTION_BERNOULLI_QUANTILE
Bernoulli quantile
(q,p). Arity 2이며q,p in [0,1]이다./** Bernoulli quantile =(q,p)=. Arity 2이며 =q,p in [0,1]=이다. */ MATH_ENGINE_MATH_FUNCTION_BERNOULLI_QUANTILE = 39,math_engine_math_function_t.MATH_ENGINE_MATH_FUNCTION_POISSON_PMF
Poisson PMF
(k,lambda). Arity 2, integerk in [0,4096],lambda in (0,256]다./** Poisson PMF =(k,lambda)=. Arity 2, integer =k in [0,4096]=, =lambda in (0,256]=다. */ MATH_ENGINE_MATH_FUNCTION_POISSON_PMF = 40,math_engine_math_function_t.MATH_ENGINE_MATH_FUNCTION_POISSON_CDF
Poisson CDF
(k,lambda). Arity 2, integerk in [0,4096],lambda in (0,256]다./** Poisson CDF =(k,lambda)=. Arity 2, integer =k in [0,4096]=, =lambda in (0,256]=다. */ MATH_ENGINE_MATH_FUNCTION_POISSON_CDF = 41,math_engine_math_function_t.MATH_ENGINE_MATH_FUNCTION_POISSON_QUANTILE
Poisson quantile
(p,lambda). Arity 2이며p in [0,1),lambda in (0,256]다./** Poisson quantile =(p,lambda)=. Arity 2이며 =p in [0,1)=, =lambda in (0,256]=다. */ MATH_ENGINE_MATH_FUNCTION_POISSON_QUANTILE = 42,math_engine_math_function_t.MATH_ENGINE_MATH_FUNCTION_ASINH
Inverse hyperbolic sine
asinh(x). Arity 1이며 finitex를 허용한다./** Inverse hyperbolic sine =asinh(x)=. Arity 1이며 finite =x=를 허용한다. */ MATH_ENGINE_MATH_FUNCTION_ASINH = 43,math_engine_math_function_t.MATH_ENGINE_MATH_FUNCTION_ACOSH
Inverse hyperbolic cosine
acosh(x). Arity 1이며x >1=이다./** Inverse hyperbolic cosine =acosh(x)=. Arity 1이며 =x >= 1=이다. */ MATH_ENGINE_MATH_FUNCTION_ACOSH = 44,math_engine_math_function_t.MATH_ENGINE_MATH_FUNCTION_ATANH
Inverse hyperbolic tangent
atanh(x). Arity 1이며 =-1 < x < 1=이다./** Inverse hyperbolic tangent =atanh(x)=. Arity 1이며 =-1 < x < 1=이다. */ MATH_ENGINE_MATH_FUNCTION_ATANH = 45,math_engine_math_function_t.MATH_ENGINE_MATH_FUNCTION_LOG10
Base-10 logarithm
log10(x). Arity 1이며x > 0이다./** Base-10 logarithm =log10(x)=. Arity 1이며 =x > 0=이다. */ MATH_ENGINE_MATH_FUNCTION_LOG10 = 46,math_engine_math_function_t.MATH_ENGINE_MATH_FUNCTION_ABS
Absolute value
|x|. Arity 1이며 finitex를 허용한다./** Absolute value =|x|=. Arity 1이며 finite =x=를 허용한다. */ MATH_ENGINE_MATH_FUNCTION_ABS = 47,
math_engine_math_implementation_t
성공한 값과 함께 반환되는 실제 계산 구현의 provenance다.
typedef enum math_engine_math_implementation {
/** 실제 implementation이 없거나 아직 선택되지 않은 sentinel이다. */
MATH_ENGINE_MATH_IMPLEMENTATION_INVALID = 0,
/** System binary64 math-library를 사용하는 implementation이다. */
MATH_ENGINE_MATH_IMPLEMENTATION_BINARY64_LIBM = 1,
/** 제한된 domain에서 polynomial/closed-form fast approximation을 사용하는 구현이다. */
MATH_ENGINE_MATH_IMPLEMENTATION_FAST_POLYNOMIAL = 2,
/** Long-double intermediate 뒤 binary64로 변환하는 refined implementation이다. */
MATH_ENGINE_MATH_IMPLEMENTATION_REFINED_LONG_DOUBLE = 3,
/** Integer-domain 공식을 계산한 뒤 binary64로 표현하는 combinatorial implementation이다. */
MATH_ENGINE_MATH_IMPLEMENTATION_EXACT_INTEGER = 4
} math_engine_math_implementation_t;
math_engine_math_implementation_t.MATH_ENGINE_MATH_IMPLEMENTATION_INVALID
실제 implementation이 없거나 아직 선택되지 않은 sentinel이다.
/** 실제 implementation이 없거나 아직 선택되지 않은 sentinel이다. */ MATH_ENGINE_MATH_IMPLEMENTATION_INVALID = 0,math_engine_math_implementation_t.MATH_ENGINE_MATH_IMPLEMENTATION_BINARY64_LIBM
System binary64 math-library를 사용하는 implementation이다.
/** System binary64 math-library를 사용하는 implementation이다. */ MATH_ENGINE_MATH_IMPLEMENTATION_BINARY64_LIBM = 1,math_engine_math_implementation_t.MATH_ENGINE_MATH_IMPLEMENTATION_FAST_POLYNOMIAL
제한된 domain에서 polynomial/closed-form fast approximation을 사용하는 구현이다.
/** 제한된 domain에서 polynomial/closed-form fast approximation을 사용하는 구현이다. */ MATH_ENGINE_MATH_IMPLEMENTATION_FAST_POLYNOMIAL = 2,math_engine_math_implementation_t.MATH_ENGINE_MATH_IMPLEMENTATION_REFINED_LONG_DOUBLE
Long-double intermediate 뒤 binary64로 변환하는 refined implementation이다.
/** Long-double intermediate 뒤 binary64로 변환하는 refined implementation이다. */ MATH_ENGINE_MATH_IMPLEMENTATION_REFINED_LONG_DOUBLE = 3,math_engine_math_implementation_t.MATH_ENGINE_MATH_IMPLEMENTATION_EXACT_INTEGER
Integer-domain 공식을 계산한 뒤 binary64로 표현하는 combinatorial implementation이다.
/** Integer-domain 공식을 계산한 뒤 binary64로 표현하는 combinatorial implementation이다. */ MATH_ENGINE_MATH_IMPLEMENTATION_EXACT_INTEGER = 4,
math_engine_math_function_descriptor_t
한 inventory 항목의 immutable metadata를 복사해 받는 versioned POD다.
typedef struct math_engine_math_function_descriptor {
/** Exact ABI byte size; caller sets =sizeof(math_engine_math_function_descriptor_t)=. */
uint32_t struct_size;
/** ABI version; caller sets =MATH_ENGINE_MATH_FUNCTION_DESCRIPTOR_VERSION_1=. */
uint32_t struct_version;
/** Append-only =math_engine_math_function_t= ID다. */
uint32_t function_id;
/** 이 함수가 속한 =math_engine_math_function_group_t= 값이다. */
uint32_t group;
/** 사용 argument 수이며 범위는 1부터 =MATH_ENGINE_MATH_MAX_ARGUMENTS=까지다. */
uint32_t arity;
/** 함수 domain/성질을 기술하는 =MATH_ENGINE_MATH_DESCRIPTOR_FLAG_*= bitset이다. */
uint32_t flags;
/** 제품 계약상 지원하는 =MATH_ENGINE_MATH_MODE_*= bitset이다. */
uint32_t canonical_mode_mask;
/** 현재 build에 실제 포함된 mode bitset이며 =canonical_mode_mask=의 subset이다. */
uint32_t compiled_mode_mask;
/** 현재 build가 이 함수에 사용할 수 있는 =MATH_ENGINE_MATH_BACKEND_*= bitset이다. */
uint64_t backend_mask;
/** Game-fast의 nonnegative =abs(error)<=factor*max(1,abs(value))= factor; 0은 추가 allowance 없음이다. */
double game_scaled_error_bound;
/** Refined path의 nonnegative =abs(error)<=factor*max(1,abs(value))= factor; 보증 없음은 0이다. */
double refined_relative_error_bound;
/** NUL-terminated lower-case ASCII inventory name의 32-byte zero-padded storage다. */
char name[32];
/** NUL-terminated ASCII real-domain 설명의 64-byte zero-padded storage다. */
char domain[64];
/** Version 1에서는 두 element 모두 0이어야 하는 future-use storage다. */
uint64_t reserved[2];
} math_engine_math_function_descriptor_t;
math_engine_math_function_descriptor_t.struct_size
Exact ABI byte size; caller sets
sizeof(math_engine_math_function_descriptor_t)./** Exact ABI byte size; caller sets =sizeof(math_engine_math_function_descriptor_t)=. */ uint32_t struct_size;math_engine_math_function_descriptor_t.struct_version
ABI version; caller sets
MATH_ENGINE_MATH_FUNCTION_DESCRIPTOR_VERSION_1./** ABI version; caller sets =MATH_ENGINE_MATH_FUNCTION_DESCRIPTOR_VERSION_1=. */ uint32_t struct_version;math_engine_math_function_descriptor_t.function_id
Append-only
math_engine_math_function_tID다./** Append-only =math_engine_math_function_t= ID다. */ uint32_t function_id;math_engine_math_function_descriptor_t.group
이 함수가 속한
math_engine_math_function_group_t값이다./** 이 함수가 속한 =math_engine_math_function_group_t= 값이다. */ uint32_t group;math_engine_math_function_descriptor_t.arity
사용 argument 수이며 범위는 1부터
MATH_ENGINE_MATH_MAX_ARGUMENTS까지다./** 사용 argument 수이며 범위는 1부터 =MATH_ENGINE_MATH_MAX_ARGUMENTS=까지다. */ uint32_t arity;math_engine_math_function_descriptor_t.flags
함수 domain/성질을 기술하는
MATH_ENGINE_MATH_DESCRIPTOR_FLAG_*bitset이다./** 함수 domain/성질을 기술하는 =MATH_ENGINE_MATH_DESCRIPTOR_FLAG_*= bitset이다. */ uint32_t flags;math_engine_math_function_descriptor_t.canonical_mode_mask
제품 계약상 지원하는
MATH_ENGINE_MATH_MODE_*bitset이다./** 제품 계약상 지원하는 =MATH_ENGINE_MATH_MODE_*= bitset이다. */ uint32_t canonical_mode_mask;math_engine_math_function_descriptor_t.compiled_mode_mask
현재 build에 실제 포함된 mode bitset이며
canonical_mode_mask의 subset이다./** 현재 build에 실제 포함된 mode bitset이며 =canonical_mode_mask=의 subset이다. */ uint32_t compiled_mode_mask;math_engine_math_function_descriptor_t.backend_mask
현재 build가 이 함수에 사용할 수 있는
MATH_ENGINE_MATH_BACKEND_*bitset이다./** 현재 build가 이 함수에 사용할 수 있는 =MATH_ENGINE_MATH_BACKEND_*= bitset이다. */ uint64_t backend_mask;math_engine_math_function_descriptor_t.game_scaled_error_bound
Game-fast의 nonnegative
abs(error)<=factor*max(1,abs(value))factor; 0은 추가 allowance 없음이다./** Game-fast의 nonnegative =abs(error)<=factor*max(1,abs(value))= factor; 0은 추가 allowance 없음이다. */ double game_scaled_error_bound;math_engine_math_function_descriptor_t.refined_relative_error_bound
Refined path의 nonnegative
abs(error)<=factor*max(1,abs(value))factor; 보증 없음은 0이다./** Refined path의 nonnegative =abs(error)<=factor*max(1,abs(value))= factor; 보증 없음은 0이다. */ double refined_relative_error_bound;math_engine_math_function_descriptor_t.name
NUL-terminated lower-case ASCII inventory name의 32-byte zero-padded storage다.
/** NUL-terminated lower-case ASCII inventory name의 32-byte zero-padded storage다. */ char name[32];math_engine_math_function_descriptor_t.domain
NUL-terminated ASCII real-domain 설명의 64-byte zero-padded storage다.
/** NUL-terminated ASCII real-domain 설명의 64-byte zero-padded storage다. */ char domain[64];math_engine_math_function_descriptor_t.reserved
Version 1에서는 두 element 모두 0이어야 하는 future-use storage다.
/** Version 1에서는 두 element 모두 0이어야 하는 future-use storage다. */ uint64_t reserved[2];
math_engine_math_request_f64_t
Scalar 값 하나를 요청하는 fixed-capacity, pointer-free versioned POD다.
typedef struct math_engine_math_request_f64 {
/** Exact ABI byte size; 반드시 =sizeof(math_engine_math_request_f64_t)=이다. */
uint32_t struct_size;
/** =MATH_ENGINE_MATH_REQUEST_F64_VERSION_1=인 ABI version이다. */
uint32_t struct_version;
/** 계산할 non-sentinel =math_engine_math_function_t= ID다. */
uint32_t function_id;
/** =function_id= descriptor의 arity와 같아야 하며 범위는 1부터 4까지다. */
uint32_t argument_count;
/** Version 1에서는 0이어야 하는 request policy flag storage다. */
uint32_t flags;
/** Version 1에서는 0이어야 하는 alignment/future-use field다. */
uint32_t reserved32;
/** 앞 =argument_count=개 finite 인자다. 나머지 element는 의미가 없으며 0 초기화를 권장한다. */
double arguments[MATH_ENGINE_MATH_MAX_ARGUMENTS];
/** Version 1에서는 두 element 모두 0이어야 하는 future-use storage다. */
uint64_t reserved[2];
} math_engine_math_request_f64_t;
math_engine_math_request_f64_t.struct_size
Exact ABI byte size; 반드시
sizeof(math_engine_math_request_f64_t)이다./** Exact ABI byte size; 반드시 =sizeof(math_engine_math_request_f64_t)=이다. */ uint32_t struct_size;math_engine_math_request_f64_t.struct_version
MATH_ENGINE_MATH_REQUEST_F64_VERSION_1인 ABI version이다./** =MATH_ENGINE_MATH_REQUEST_F64_VERSION_1=인 ABI version이다. */ uint32_t struct_version;math_engine_math_request_f64_t.function_id
계산할 non-sentinel
math_engine_math_function_tID다./** 계산할 non-sentinel =math_engine_math_function_t= ID다. */ uint32_t function_id;math_engine_math_request_f64_t.argument_count
function_iddescriptor의 arity와 같아야 하며 범위는 1부터 4까지다./** =function_id= descriptor의 arity와 같아야 하며 범위는 1부터 4까지다. */ uint32_t argument_count;math_engine_math_request_f64_t.flags
Version 1에서는 0이어야 하는 request policy flag storage다.
/** Version 1에서는 0이어야 하는 request policy flag storage다. */ uint32_t flags;math_engine_math_request_f64_t.reserved32
Version 1에서는 0이어야 하는 alignment/future-use field다.
/** Version 1에서는 0이어야 하는 alignment/future-use field다. */ uint32_t reserved32;math_engine_math_request_f64_t.arguments
앞
argument_count개 finite 인자다. 나머지 element는 의미가 없으며 0 초기화를 권장한다./** 앞 =argument_count=개 finite 인자다. 나머지 element는 의미가 없으며 0 초기화를 권장한다. */ double arguments[MATH_ENGINE_MATH_MAX_ARGUMENTS];math_engine_math_request_f64_t.reserved
Version 1에서는 두 element 모두 0이어야 하는 future-use storage다.
/** Version 1에서는 두 element 모두 0이어야 하는 future-use storage다. */ uint64_t reserved[2];
math_engine_math_result_f64_t
성공 시 값·오차 추정치·backend trace가 함께 commit되는 versioned POD다.
typedef struct math_engine_math_result_f64 {
/** Exact ABI byte size; caller sets =sizeof(math_engine_math_result_f64_t)=. */
uint32_t struct_size;
/** ABI version; caller sets =MATH_ENGINE_MATH_RESULT_F64_VERSION_1=. */
uint32_t struct_version;
/** 성공한 request의 =math_engine_math_function_t= ID다. */
uint32_t function_id;
/** 실제 계산에 사용한 =math_engine_mode_t= 값이다. */
uint32_t mode;
/** 실제 계산 경로인 =math_engine_math_implementation_t= 값이다. */
uint32_t implementation;
/** 공통 quality bit와 =MATH_ENGINE_MATH_RESULT_FLAG_*= provenance bit의 조합이다. */
uint32_t flags;
/** 성공 시 finite binary64 계산 결과다. 단위는 해당 함수의 수학적 결과 단위다. */
double value;
/** 반환값에 대한 nonnegative absolute-error estimate. 단위는 =value=와 같다. */
double absolute_error;
/** 반환값에 대한 nonnegative dimensionless relative-error estimate다. */
double relative_error;
/** 선택 implementation의 significand/intermediate precision. 단위는 bit다. */
uint32_t effective_precision_bits;
/** Version 1에서는 0이어야 하는 alignment/future-use field다. */
uint32_t reserved32;
/** 계산 path가 수행했다고 기록한 algorithm work-unit/iteration 수다. */
uint64_t iterations;
/** Function ID, mode, implementation, 사용 인자와 result bit의 canonical FNV-1a64 값이다. */
uint64_t evaluation_fingerprint;
/** Version 1에서는 두 element 모두 0이어야 하는 future-use storage다. */
uint64_t reserved[2];
} math_engine_math_result_f64_t;
math_engine_math_result_f64_t.struct_size
Exact ABI byte size; caller sets
sizeof(math_engine_math_result_f64_t)./** Exact ABI byte size; caller sets =sizeof(math_engine_math_result_f64_t)=. */ uint32_t struct_size;math_engine_math_result_f64_t.struct_version
ABI version; caller sets
MATH_ENGINE_MATH_RESULT_F64_VERSION_1./** ABI version; caller sets =MATH_ENGINE_MATH_RESULT_F64_VERSION_1=. */ uint32_t struct_version;math_engine_math_result_f64_t.function_id
성공한 request의
math_engine_math_function_tID다./** 성공한 request의 =math_engine_math_function_t= ID다. */ uint32_t function_id;math_engine_math_result_f64_t.mode
실제 계산에 사용한
math_engine_mode_t값이다./** 실제 계산에 사용한 =math_engine_mode_t= 값이다. */ uint32_t mode;math_engine_math_result_f64_t.implementation
실제 계산 경로인
math_engine_math_implementation_t값이다./** 실제 계산 경로인 =math_engine_math_implementation_t= 값이다. */ uint32_t implementation;math_engine_math_result_f64_t.flags
공통 quality bit와
MATH_ENGINE_MATH_RESULT_FLAG_*provenance bit의 조합이다./** 공통 quality bit와 =MATH_ENGINE_MATH_RESULT_FLAG_*= provenance bit의 조합이다. */ uint32_t flags;math_engine_math_result_f64_t.value
성공 시 finite binary64 계산 결과다. 단위는 해당 함수의 수학적 결과 단위다.
/** 성공 시 finite binary64 계산 결과다. 단위는 해당 함수의 수학적 결과 단위다. */ double value;math_engine_math_result_f64_t.absolute_error
반환값에 대한 nonnegative absolute-error estimate. 단위는
value와 같다./** 반환값에 대한 nonnegative absolute-error estimate. 단위는 =value=와 같다. */ double absolute_error;math_engine_math_result_f64_t.relative_error
반환값에 대한 nonnegative dimensionless relative-error estimate다.
/** 반환값에 대한 nonnegative dimensionless relative-error estimate다. */ double relative_error;math_engine_math_result_f64_t.effective_precision_bits
선택 implementation의 significand/intermediate precision. 단위는 bit다.
/** 선택 implementation의 significand/intermediate precision. 단위는 bit다. */ uint32_t effective_precision_bits;math_engine_math_result_f64_t.reserved32
Version 1에서는 0이어야 하는 alignment/future-use field다.
/** Version 1에서는 0이어야 하는 alignment/future-use field다. */ uint32_t reserved32;math_engine_math_result_f64_t.iterations
계산 path가 수행했다고 기록한 algorithm work-unit/iteration 수다.
/** 계산 path가 수행했다고 기록한 algorithm work-unit/iteration 수다. */ uint64_t iterations;math_engine_math_result_f64_t.evaluation_fingerprint
Function ID, mode, implementation, 사용 인자와 result bit의 canonical FNV-1a64 값이다.
/** Function ID, mode, implementation, 사용 인자와 result bit의 canonical FNV-1a64 값이다. */ uint64_t evaluation_fingerprint;math_engine_math_result_f64_t.reserved
Version 1에서는 두 element 모두 0이어야 하는 future-use storage다.
/** Version 1에서는 두 element 모두 0이어야 하는 future-use storage다. */ uint64_t reserved[2];
Macro와 constant
MATH_ENGINE_MATH_BACKEND_BINARY64_LIBM
System binary64 math-library implementation을 사용할 수 있음을 나타낸다.
#define MATH_ENGINE_MATH_BACKEND_BINARY64_LIBM (UINT64_C(1) << 0u)
MATH_ENGINE_MATH_BACKEND_FAST_APPROXIMATION
Game-fast polynomial/approximation implementation을 사용할 수 있음을 나타낸다.
#define MATH_ENGINE_MATH_BACKEND_FAST_APPROXIMATION (UINT64_C(1) << 1u)
MATH_ENGINE_MATH_BACKEND_REFINED_LONG_DOUBLE
Long-double intermediate를 사용하는 refined implementation을 사용할 수 있음을 나타낸다.
#define MATH_ENGINE_MATH_BACKEND_REFINED_LONG_DOUBLE (UINT64_C(1) << 2u)
MATH_ENGINE_MATH_DESCRIPTOR_FLAG_FINITE_ARGUMENTS
모든 사용 argument가 finite binary64여야 함을 나타낸다.
#define MATH_ENGINE_MATH_DESCRIPTOR_FLAG_FINITE_ARGUMENTS (UINT32_C(1) << 0u)
MATH_ENGINE_MATH_DESCRIPTOR_FLAG_HAS_DOMAIN_BOUNDARY
Descriptor의 real domain에 포함/제외 경계가 있음을 나타낸다.
#define MATH_ENGINE_MATH_DESCRIPTOR_FLAG_HAS_DOMAIN_BOUNDARY (UINT32_C(1) << 1u)
MATH_ENGINE_MATH_DESCRIPTOR_FLAG_HAS_POLE
Domain 경계 또는 내부에 명시적으로 거부되는 singular pole이 있음을 나타낸다.
#define MATH_ENGINE_MATH_DESCRIPTOR_FLAG_HAS_POLE (UINT32_C(1) << 2u)
MATH_ENGINE_MATH_DESCRIPTOR_FLAG_MONOTONIC_INTERVALS
Domain을 하나 이상의 monotonic interval로 기술할 수 있음을 나타낸다.
#define MATH_ENGINE_MATH_DESCRIPTOR_FLAG_MONOTONIC_INTERVALS (UINT32_C(1) << 4u)
MATH_ENGINE_MATH_DESCRIPTOR_FLAG_PRINCIPAL_REAL_BRANCH
다가 함수에서 documented principal real branch만 반환함을 나타낸다.
#define MATH_ENGINE_MATH_DESCRIPTOR_FLAG_PRINCIPAL_REAL_BRANCH (UINT32_C(1) << 3u)
MATH_ENGINE_MATH_DESCRIPTOR_FLAG_PURE_VALUE
같은 request/context에 같은 값이 나오며 외부 mutable state나 RNG를 소비하지 않는다.
#define MATH_ENGINE_MATH_DESCRIPTOR_FLAG_PURE_VALUE (UINT32_C(1) << 5u)
MATH_ENGINE_MATH_FUNCTION_CATALOG_FINGERPRINT
현재 append-only 함수 catalog의 canonical FNV-1a64 fingerprint다.
#define MATH_ENGINE_MATH_FUNCTION_CATALOG_FINGERPRINT UINT64_C(0xacd9b084012e2b1c)
MATH_ENGINE_MATH_FUNCTION_DESCRIPTOR_VERSION_1
math_engine_math_function_descriptor_t 의 최초 ABI version 값이다.
#define MATH_ENGINE_MATH_FUNCTION_DESCRIPTOR_VERSION_1 UINT32_C(1)
MATH_ENGINE_MATH_MAX_ARGUMENTS
한 함수 호출이 수용하는 고정 argument storage의 원소 수인 4다.
#define MATH_ENGINE_MATH_MAX_ARGUMENTS UINT32_C(4)
MATH_ENGINE_MATH_MODE_FINANCE_FIXED
Descriptor가 MATH_ENGINE_MODE_FINANCE_FIXED 에서 함수를 지원함을 나타내는 bit다.
#define MATH_ENGINE_MATH_MODE_FINANCE_FIXED (UINT32_C(1) << 2u)
MATH_ENGINE_MATH_MODE_FULL
Descriptor가 MATH_ENGINE_MODE_FULL 에서 함수를 지원함을 나타낸다.
#define MATH_ENGINE_MATH_MODE_FULL (UINT32_C(1) << 3u)
MATH_ENGINE_MATH_MODE_GAME_FAST
Descriptor가 MATH_ENGINE_MODE_GAME_FAST 에서 함수를 지원함을 나타낸다.
#define MATH_ENGINE_MATH_MODE_GAME_FAST (UINT32_C(1) << 0u)
MATH_ENGINE_MATH_MODE_PC_PRECISION
Descriptor가 MATH_ENGINE_MODE_PC_PRECISION 에서 함수를 지원함을 나타낸다.
#define MATH_ENGINE_MATH_MODE_PC_PRECISION (UINT32_C(1) << 1u)
MATH_ENGINE_MATH_MODE_UNLIMITED
- Deprecated:
MATH_ENGINE_MATH_MODE_FULL과 값과 의미가 같은 source-compatibility alias다.
#define MATH_ENGINE_MATH_MODE_UNLIMITED MATH_ENGINE_MATH_MODE_FULL
MATH_ENGINE_MATH_REQUEST_F64_VERSION_1
math_engine_math_request_f64_t 의 최초 ABI version 값이다.
#define MATH_ENGINE_MATH_REQUEST_F64_VERSION_1 UINT32_C(1)
MATH_ENGINE_MATH_RESULT_F64_VERSION_1
math_engine_math_result_f64_t 의 최초 ABI version 값이다.
#define MATH_ENGINE_MATH_RESULT_F64_VERSION_1 UINT32_C(1)
MATH_ENGINE_MATH_RESULT_FLAG_EXACT
반환된 binary64 값이 해당 계산 경로에서 exact하다고 판정되었음을 나타낸다.
#define MATH_ENGINE_MATH_RESULT_FLAG_EXACT (UINT32_C(1) << 8u)
MATH_ENGINE_MATH_RESULT_FLAG_FAST_APPROXIMATION
Game-fast approximation path가 실제로 선택되었음을 나타낸다.
#define MATH_ENGINE_MATH_RESULT_FLAG_FAST_APPROXIMATION (UINT32_C(1) << 10u)
MATH_ENGINE_MATH_RESULT_FLAG_INEXACT
반환값에 rounding 또는 approximation 오차가 있을 수 있음을 나타낸다.
#define MATH_ENGINE_MATH_RESULT_FLAG_INEXACT (UINT32_C(1) << 9u)
MATH_ENGINE_MATH_RESULT_FLAG_PRINCIPAL_REAL_BRANCH
이 결과가 documented principal real branch 값임을 나타낸다.
#define MATH_ENGINE_MATH_RESULT_FLAG_PRINCIPAL_REAL_BRANCH (UINT32_C(1) << 13u)
MATH_ENGINE_MATH_RESULT_FLAG_REFINED
Long-double intermediate refined path가 실제로 선택되었음을 나타낸다.
#define MATH_ENGINE_MATH_RESULT_FLAG_REFINED (UINT32_C(1) << 11u)
MATH_ENGINE_MATH_RESULT_FLAG_SYSTEM_LIBM
System binary64 math-library path가 실제로 선택되었음을 나타낸다.
#define MATH_ENGINE_MATH_RESULT_FLAG_SYSTEM_LIBM (UINT32_C(1) << 12u)
Function
math_engine_math_function_count
Append-only public 함수 inventory의 항목 수를 반환한다.
- 반환: 현재 build에 포함된 descriptor 수. 단위는 항목이다.
- Math Engine thread_safety:
safe
MATH_ENGINE_API uint32_t math_engine_math_function_count(void);
math_engine_math_function_catalog_fingerprint
함수 ID·이름·arity·domain·canonical mode mask의 안정된 fingerprint를 반환한다.
- 반환: 현재 compiled inventory의 deterministic 64-bit FNV fingerprint.
- Math Engine thread_safety:
safe
MATH_ENGINE_API uint64_t math_engine_math_function_catalog_fingerprint(void);
math_engine_math_function_at
Zero-based inventory index로 descriptor 하나를 조회한다.
- 매개변수
index: 조회할 항목의 zero-based index. - 매개변수
out_descriptor: 호출 전에struct_size와struct_version을 설정하고 성공한 descriptor를 받을 caller-owned storage. - 반환: 성공하면
MATH_ENGINE_STATUS_OK. Index 범위, NULL, size 또는 version 오류면 해당 status를 반환하고out_descriptor전체를 보존한다. - Math Engine ownership:
out_descriptor=caller - Math Engine nullable:
out_descriptor=false - Math Engine thread_safety:
safe
MATH_ENGINE_API math_engine_status_t math_engine_math_function_at(
uint32_t index,
math_engine_math_function_descriptor_t* out_descriptor);
math_engine_math_function_find
정확한 lower-case ASCII inventory 이름으로 descriptor를 찾는다.
- 매개변수
name: 함수 호출 동안만 읽는 이름 byte sequence. NUL terminator는 읽지 않는다. - 매개변수
name_size:name의 byte 수. 1 이상 31 이하이어야 한다. - 매개변수
out_descriptor: 호출 전에struct_size와struct_version을 설정하고 성공한 descriptor를 받을 caller-owned storage. - 반환: 성공하면
MATH_ENGINE_STATUS_OK. 이름·길이·pointer가 유효하지 않으면MATH_ENGINE_STATUS_INVALID_ARGUMENT, 일치 항목이 없으면MATH_ENGINE_STATUS_OUT_OF_RANGE이며 실패 시out_descriptor를 보존한다. - Math Engine ownership:
name=borrowed out_descriptor=caller - Math Engine nullable:
name=false out_descriptor=false - Math Engine thread_safety:
safe
MATH_ENGINE_API math_engine_status_t math_engine_math_function_find(
const char* name,
uint64_t name_size,
math_engine_math_function_descriptor_t* out_descriptor);
math_engine_math_evaluate_f64
context 가 선택한 mode로 pure scalar 함수 하나를 계산한다.
- 매개변수
request: 호출 동안만 읽는 versioned request. 모든 사용 argument는 finite여야 하며function_id의 descriptor arity와argument_count가 같아야 한다. - 매개변수
context: mode, tolerance와 수치 정책을 제공하는 borrowed context. - 매개변수
out_result: 호출 전에struct_size와struct_version을 설정하고 성공한 값·오차· provenance를 받을 caller-owned storage. - 반환: 성공하면
MATH_ENGINE_STATUS_OK. Domain 위반은MATH_ENGINE_STATUS_DOMAIN_ERROR, 정확한 singularity는MATH_ENGINE_STATUS_POLE, 표현 범위 초과·소실은 각각MATH_ENGINE_STATUS_OVERFLOW와MATH_ENGINE_STATUS_UNDERFLOW다. 모든 실패에서out_result전체를 보존한다.
Finance-fixed mode는 fixed decimal API의 책임이므로 지원하지 않는다. 성공 결과는 실제 implementation과 effective precision을 항상 기록하므로 refined 요청이 fast 구현으로 조용히 fallback하지 않는다. 함수는 입력 pointer를 보관하지 않는다.
- Math Engine ownership:
request=borrowed context=borrowed out_result=caller - Math Engine nullable:
request=false context=false out_result=false - Math Engine thread_safety:
safe
MATH_ENGINE_API math_engine_status_t math_engine_math_evaluate_f64(
const math_engine_math_request_f64_t* request,
const math_engine_context_t* context,
math_engine_math_result_f64_t* out_result);