Quantcast
Channel: User CPlus - Programming Language Design and Implementation Stack Exchange
Viewing all articles
Browse latest Browse all 65

Answer by CPlus for Why do so many programming languages not have a "built-in" way to do simple math functions?

$
0
0

One possible reason why C does this is because C has a concept of hosted and freestanding implementations. If an implementation is freestanding, then the standard libraries do not need to be provided. This leaves only the syntax of the language to perform tasks.

One reason for this is, while virtually any CPU is going to be able to add or subtract or multiply, not all of them, or at least, not all of the ones that C aims to support, are necessarily going to have capabilities to take the sin or cos or other complex functions of numbers. These implementations can just be freestanding and not need to include the standard libraries, and still be standards compliant.


Viewing all articles
Browse latest Browse all 65

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>