Interplane page as plain text, for reading tools and agents. English is the reference text: translate it with your own tool. Text in backticks and in ``` blocks (commands, fingerprints, file names) and link targets in <...> are exact: copy them, never translate them. Page: /drakestapleton/omega-mv/blob/main/aienux/crates/aienos-fpu-probe/fpu_probe_test.om # omega-mv Omega: a language for verified programs, semantic identity and machine realization. Seed-born work and existing implementations have distinct provenance. Brought by drakestapleton Sign in to star 1 stars 0 watching About Files History Releases Proposed changes Issues For developers branch `main` Branches Tags History `omega-mv / aienux / crates / aienos-fpu-probe / fpu_probe_test.om` 63 lines ยท 1504 bytes Raw Blame History 1 note SPDX-License-Identifier: Apache-2.0 2 note aienux/crates/aienos-fpu-probe/fpu_probe_test.om: Behavioral self-test for aienos-fpu-probe. 3 note Compose with: si/directives/om2.om aienux/crates/aienos-fpu-probe/fpu_probe.om aienux/crates/aienos-fpu-probe/fpu_probe_test.om 4 5 fn main to int 6 note 1. Short output buffer must be refused with -1 7 short_buf = new uint 5 0 8 if ne aienos_fpu_probe short_buf -1 9 ret 1 10 end 11 12 note 2. Full probe must return 0 and write exact IEEE-754 bit patterns 13 res = new uint 6 0 14 if ne aienos_fpu_probe res 0 15 ret 2 16 end 17 note 68.0f32 == 0x42880000 18 if ne get res 0 uint 0x42880000 19 ret 3 20 end 21 note Lanes: 11.0=0x41300000, 22.0=0x41b00000, 33.0=0x42040000, 44.0=0x42300000 22 if ne get res 2 uint 0x41300000 23 ret 4 24 end 25 if ne get res 3 uint 0x41b00000 26 ret 5 27 end 28 if ne get res 4 uint 0x42040000 29 ret 6 30 end 31 if ne get res 5 uint 0x42300000 32 ret 7 33 end 34 35 note 3. exp_approx(0.0) == 1.0 exactly 36 e0 = fpu_exp_approx 0.0f32 37 if ne e0 1.0f32 38 ret 8 39 end 40 41 note 4. exp_approx(-1.0) within 1e-4 of 1/e (0.`36787944`) 42 em1 = fpu_exp_approx -1.0f32 43 d1 = sub em1 0.`36787944f32` 44 if not and lt d1 FPU_PROBE_TOL gt d1 neg FPU_PROBE_TOL 45 ret 9 46 end 47 48 note 5. exp_approx(2.0) within 1e-3 of e^2 (7.`3890561`) 49 e2 = fpu_exp_approx 2.0f32 50 d2 = sub e2 7.`3890561f32` 51 if not and lt d2 0.001f32 gt d2 -0.001f32 52 ret 10 53 end 54 55 note 6. exp_approx(-2.5) exercises floor adjustment for negative non-integer t 56 em25 = fpu_exp_approx -2.5f32 57 d3 = sub em25 0.`0820850f32` 58 if not and lt d3 FPU_PROBE_TOL gt d3 neg FPU_PROBE_TOL 59 ret 11 60 end 61 62 ret 0 63 end