Hacker News new | ask | show | jobs
by RicoElectrico 1650 days ago
I wish that fixed point numbers (as in Qx.y) was a first class citizen in programming languages. As well as saturation arithmetic.

Actually I wonder if anybody did a performance/power comparison of using floating point vs fixed point math in some common tasks using modern CPUs with extensive FP support.

2 comments

They are a first class citizen in Ada, you even get two (three) varieties: http://www.ada-auth.org/standards/12rm/html/RM-3-5-9.html / http://www.ada-auth.org/standards/12rm/html/RM-3-5-7.html
Julia has this https://github.com/JuliaMath/FixedPointNumbers.jl. In general, fixed point is a little slower, but it's not awful. Fixed point is really good for small bit-widths in hardware though.