Some checks are pending
docs / build-and-deploy (push) Waiting to run
Finish the unblocked "Math / Ease" half of #25: the fixed-point transcendentals deferred from #2. Vec.* stays blocked on the vec2 type in #1. - Math.exp, Math.log (natural), Math.pow — deterministic Q16.16 via two new prelude fns in emit_math_prelude: @fn_fx_exp2 (range-reduced 5th-order Taylor 2^f, then a clamped shift by the integer part) and @fn_fx_log2 (llvm.ctlz for the exponent + an atanh series on (m-1)/(m+1) for the mantissa). exp=2^(x·log2 e), log=log2(x)·ln2, pow=2^(b·log2 a). - Ease.elastic — ease-out elastic 2^(-10t)·sin((10t-0.75)·2pi/3)+1. - Pure integer IR, so bit-identical on every platform. Results must fit the Q16.16 range (|x| < 32768); larger magnitudes saturate (documented). Test selfhost/tests/transcend.ludic (registered in the self-host suite) + docs for all four. Reseeded; the C-free bootstrap fixpoint holds. All suites green (24 self-host, 45 regression, 29 tool). Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
17 lines
989 B
Text
17 lines
989 B
Text
program T {
|
|
entry {
|
|
print(Math.round(Math.exp(1.0) * 1000)) # e -> 2718
|
|
print(Math.round(Math.exp(0.0))) # 1 -> 1
|
|
print(Math.floor(Math.exp(5.0))) # 148.41 -> 148
|
|
print(Math.round(Math.log(2.718281828) * 1000)) # ln e -> 1000
|
|
print(Math.round(Math.log(1.0))) # 0 -> 0
|
|
print(Math.round(Math.log(10.0) * 1000)) # ln 10 -> 2303
|
|
print(Math.round(Math.pow(2.0, 10.0))) # 1024 -> 1024
|
|
print(Math.round(Math.pow(2.0, 0.5) * 1000)) # sqrt 2 -> 1414
|
|
print(Math.round(Math.pow(9.0, 0.5))) # 3 -> 3
|
|
print(Math.round(Math.pow(2.0, 0.0 - 2.0) * 1000)) # 0.25 -> 250
|
|
print(Math.round(Ease.elastic(0.0) * 1000)) # anchored -> 0
|
|
print(Math.round(Ease.elastic(1.0) * 1000)) # settles -> 1000
|
|
print(Math.round(Ease.elastic(0.5) * 1000)) # overshoot -> 1016
|
|
}
|
|
}
|