MegaLibm: A DSL for Implementing Math Functions (blog.sigplan.org)
from armchair_progamer@programming.dev to programming_languages@programming.dev on 10 Jun 03:28
https://programming.dev/post/15313394

Full Paper

Excerpt:

Typically, math library functions are written in a low-level language like C or raw assembler to maximize performance. But general purpose languages (like these) don’t help developers avoid semantic errors in mathematical code.

How many times has this happened to you: you’re writing some math computation, and you accidentally write a plus sign instead of a minus sign, or put in the wrong constant? Your programming language can’t catch these bugs for you because its types, like float and double, don’t distinguish between x and -x or between different constants.

But numerical code could really benefit from compiler assistance with precisely this task, especially since we expect the user to test out several different implementations of some mathematical expression and compare them for accuracy and performance. Numerical errors really throw a wrench in that process (through misleading performance or accuracy numbers) and MegaLibm therefore aims to prevent them.

#programming_languages

threaded - newest