ad9b39a762
This is useful for enforcing an upper-bound on fracs based on their total component. Technically possible via decomposing + min + recomposing, but... Well which one do you think is easier? - saturate(x) - frac(min(max(int(x), 0), total(x)), total(x)) And this assumes x is easily available and not some other expr (though chaining csv.py could work around that). --- The motivation for this was `make bench-widths`, where one read benchmark could ruin the entire column due to introducing infinities. Now: make bench # (squished a bit) probe readed progged erased b_wt_seq+w 1.0/1.0 (100.0%) 31.7/256.0 (12.4%) 4096.0/4096.0 (100.0%) b_wt_random+w 1.0/1.0 (100.0%) 15.3/256.0 (6.0%) 4096.0/4096.0 (100.0%) b_wt_logging+w 1.0/1.0 (100.0%) 15.4/256.0 (6.0%) 4096.0/4096.0 (100.0%) b_wt_many+w 1.0/1.0 (100.0%) 16.1/256.0 (6.3%) 4096.0/4096.0 (100.0%) b_rt_seq+r 1.0/1.0 (100.0%) 256.0/256.0 (100.0%) 4096.0/4096.0 (100.0%) b_rt_random+r 1.0/1.0 (100.0%) 256.0/256.0 (100.0%) 4096.0/4096.0 (100.0%) b_rt_many+r 1.0/1.0 (100.0%) 256.0/256.0 (100.0%) 4096.0/4096.0 (100.0%) TOTAL 1.0/1.0 (100.0%) 149.0/256.0 (58.2%) 4096.0/4096.0 (100.0%) # ^- notably not infinity