John McFarlane

Results 144 comments of John McFarlane

Right. The solution is not to return results with the wrong dimensions. But while concepts may help, they are not necessary. What is needed is simply a well designed generic...

I've never thought to check but it looks like CNL's types [are trivial](https://godbolt.org/g/ypZniv). They're certainly literal types which is pretty important for using them in constant expressions. Of course, if...

It's not the easiest thing to do but there's no theoretical barrier to making first class number types. It's just that the standard isn't prepared for people trying yet. That...

... including much of the standard library such as the aliases for metafunctions in [](https://en.cppreference.com/w/cpp/header/type_traits).

Is the exponent known at compile time? If so, you might do better by progressively halving the exponent, e.g.: n^9 = n*(n^4)^2 = n*((n^2)^2)^2 potentially some branches to test what...

Assuming that it is a bug to pass a negative value to a `sqrt` function, might it be best to assert this as a precondition and proceed on the assumption...

I would think twice about using this function because of that part of the contract. This raises three problems: 1. Correctness: I don't want the wrong value to be returned....

Firstly, it's important distinguish between errors and bugs. * An error is something that could occur in a bug-free program (e.g. missing file, dropped connection, bad command-line parameter or when...

Ah, that gets me thinking of numerical errors which are a special case of errors because they are incorrect by degree. I shall make sure to call those out and...

The first version of the article is available [here](https://github.com/johnmcfarlane/papers/blob/master/cpp/contractual-disappointment.md). Please let me know what you think and whether it's helpful.