nx_affine_q30_api_gate_t34.nx source
↩ module page · 12 lines · 511 B
1import "nx_fixq30_lib.nx"
2import "nx_nxa_bind.nx"
3func main()->i64 {
4 if fq_mul(100*FQ_ONE,100*FQ_ONE)!=10000*FQ_ONE{return 3}
5 if fq_div(FQ_ONE,100*FQ_ONE)!=FQ_ONE/100{return 4}
6 if fq_mul(0-100*FQ_ONE,100*FQ_ONE)!=(0-10000*FQ_ONE){return 5}
7 let inverse:i64=fq_div(FQ_ONE,100*FQ_ONE)
8 let residual:i64=FQ_ONE-fq_mul(100*FQ_ONE,inverse)
9 if residual<0||residual>=100{return 6}
10 nb_text("PASS existing Q30 multiply/divide bind-scale API; residual_q30=" as *u8);nb_num(residual);nb_text("\n" as *u8)
11 return 0
12}