code wiki / (root) / nx_bvh_nearest_precision_gate_t284.nx

nx_bvh_nearest_precision_gate_t284.nx source

↩ module page · 12 lines · 829 B

1import "nx_bvh_nearest_candidate_t284.nx" 2import "nx_gate_verdict.nx" 3func main()->i64{ 4 let ctr:*i64=gv_ctr();let o:*f64=sys_mmap(32) as *f64;let s:*f64=sys_mmap(32) as *f64 5 // P = A/4 + B/2 + C/4, exactly representable and strictly interior. 6 let rc:i64=bq_triangle(o,s,75000000.0,75000001.0,0.0,0.0,0.0,0.0,100000000.0,100000000.0,0.0,100000000.0,100000004.0,0.0) 7 gv_check_eq("thin triangle is not degenerate" as *u8,rc,0,ctr) 8 gv_check_eq("known interior point x" as *u8,nx_f64_to_i64(o[0] as i64),75000000,ctr) 9 gv_check_eq("known interior point y" as *u8,nx_f64_to_i64(o[1] as i64),75000001,ctr) 10 gv_check_eq("known interior distance exactly zero" as *u8,o[3] as i64,0,ctr) 11 return gv_verdict("nx_bvh_nearest_precision_gate_t284" as *u8,ctr,"integer-defined thin triangle; explicit Gram cancellation adversary" as *u8) 12}