4 ms·
Once more, this is _exactly_ why Ada has arbitrary precision decimal arithmetic. One merely needs to specify type Result is range -100 .. 100 delta 0.0001; an
by inamberclad 2y ago
Once more, this is _exactly_ why Ada has arbitrary precision decimal arithmetic. One merely needs to specify
type Result is range -100 .. 100 delta 0.0001;
and the compiler will figure out how to give you fast math with only the accuracy and resolution that you need!
- AlotOfReading 2y agoHow does that feature work without a solution to the tablemaker's dilemma? Does the compiler just give up and give you arbitrary precision every time you use transcendentals or does it give up and use lower precision if the estimate exceeds some arbitrary bound?
- LegionMammal978 2y agoLooking at the spec [0], it only demands 1 ULP of precision for the elementary operations, and 2, 4, or 8 ULPs for special functions. So there's no magic 1/2-ULP guarantee. [0] http://ada-auth.org/standards/22rm/html/RM-G-2-3.html http://ada-auth.org/standards/22rm/html/RM-G-2-3.html
- kragen 2y agohave you tested this? how fast and accurate were the results? or are you simply assuming that all compilers are perfect? my experience outside of ada is that decimal arithmetic is never fast on binary computers
- abecedarius 2y agoaaui that Ada line would declare a fixed-point type, so decimal/binary shouldn't really come up except for overflow handling, here. (Haven't tried it though.)