code wiki / (root) / nx_f32_div.nx

nx_f32_div.nx

buildroot/runtime/nx_f32_div.nx

3774 B117 linesdepth 3pulls 3 transitivereach 215 importersview sourcekind librarytopic f32
docsdependenciesstructsconstsfunctions

about

nx_f32_div.nx -- IEEE 754 binary32 division (standalone). Separated from runtime/nx_f32.nx because having division code in the same file as nx_f32_mul triggers the nxc2 codegen quirk tracked in Task #10 (negative-literal sign-extension regression in earlier mul KAT after certain patterns added). Isolating this brick in its own file sidesteps the quirk while preserving the L4 bits-up tower's contract. Composes: nx_f32.nx -- classify / sign / exp_field / mant_field / constants Algorithm: 1. NaN/Inf/Zero special cases per IEEE 754. 2. Build 24-bit significands. 3. (a_sig << 24) / b_sig gives 24- or 25-bit quotient. 4. Normalize to 24-bit mantissa, extract guard from dropped bit, sticky from remainder. 5. Round-to-nearest-even. 6. Overflow → inf, underflow → subnormal/zero. v1 limitations: subnormal input/output conservatively zero/inf.

dependencies 3 imports · 88 importers

nx_syscalls.nx nx_tier.nx nx_f32.nx nx_f32_div.nx _autograd_authored.nx _tensor_grad_authored.nx nx_autograd.nx nx_autograd_tensor.nx nx_coco_oks.nx nx_embed_train.nx nx_exp_ab.nx nx_exploop_test.nx nx_f32_activations.nx nx_f32_activations_test.nx

diagram shows first 10 each side; +0 more imports, +78 more importers in the complete lists below.

imports: nx_syscalls.nxnx_tier.nxnx_f32.nx

imported by: _autograd_authored.nx_tensor_grad_authored.nxnx_autograd.nxnx_autograd_tensor.nxnx_coco_oks.nxnx_embed_train.nxnx_exp_ab.nxnx_exploop_test.nxnx_f32_activations.nxnx_f32_activations_test.nxnx_f32_attention.nxnx_f32_bn_fold.nxnx_f32_dit_block_linear.nxnx_f32_dit_block_simd.nxnx_f32_div_test.nxnx_f32_embed_gate.nxnx_f32_exp.nxnx_f32_exp_test.nxnx_f32_gelu.nxnx_f32_gelu_gate.nxnx_f32_gqa_attention.nxnx_f32_groupnorm.nxnx_f32_image_to_bmp.nxnx_f32_layernorm.nxnx_f32_layernorm_lib_gate.nxnx_f32_linear_attention.nxnx_f32_linear_simd.nxnx_f32_llm_serve.nxnx_f32_log.nxnx_f32_log_test.nxnx_f32_lora_linear.nxnx_f32_parity.nxnx_f32_qwen_encoder.nxnx_f32_qwen_layer.nxnx_f32_rectflow_denoise.nxnx_f32_rmsnorm.nxnx_f32_rmsnorm_test.nxnx_f32_rope.nxnx_f32_rope_test.nxnx_f32_sampler.nxnx_f32_softmax.nxnx_f32_softmax_test.nxnx_f32_upsample_bilinear.nxnx_f32_vae_decode_tiny.nxnx_f32prim_test.nxnx_f32x8_dot_bench.nxnx_f32x8_probe.nxnx_fft_f32.nxnx_flashattn_scale.nxnx_linear_attn_bench.nxnx_lowrank_weight_spectrum.nxnx_moe.nxnx_moe_gate.nxnx_nofloat_qwen_rope_h2h_gate.nxnx_pose_distill_gate.nxnx_pose_preprocess.nxnx_pose_student_distill.nxnx_q4k_ggml_kat.nxnx_q4k_linear.nxnx_q4k_linear_hp.nxnx_q4k_real_gemm.nxnx_q5_k_ggml_kat.nxnx_q5k_dot_row_col.nxnx_q8_0_from_f32.nxnx_qwen_hybrid_attn.nxnx_qwen_hybrid_ffn.nxnx_qwen_hybrid_qkv.nxnx_tgrad_core.nxnx_train_int_vs_softfloat_gate.nxnx_vcodec_neural_entropy_gate.nxnx_vcodec_stdseq_gate.nxnx_vit_encoder_layer_gate.nxnx_vitpose_prep.nxnx_vitpose_preprocess.nxnx_vitpose_preprocess_gate.nxnx_vocops.nxnx_zimage_adaln_verify.nxnx_zimage_attn_verify.nxnx_zimage_ffn_down_verify.nxnx_zimage_ffn_norm_verify.nxnx_zimage_ffn_swiglu_verify.nxnx_zimage_flashattn_verify.nxnx_zimage_outproj_verify.nxnx_zimage_qknorm_verify.nxnx_zimage_qkv_verify.nxnx_zimage_real_op.nxnx_zimage_sdpa_verify.nxnx_zimage_sdpaonly_verify.nx

structs

none

consts

none

functions

28func nx_f32_div(a: i64, b: i64) -> i64