4 ms·
That doesn't seem to be true, unless I'm misunderstanding something. https://go.dev/play/p/ymM0tD3aGYg?v=gotip https://go.dev/play/p/ymM0tD3aGYg?v=gotip Obviou
by Hakkin 3y ago
That doesn't seem to be true, unless I'm misunderstanding something.
https://go.dev/play/p/ymM0tD3aGYg?v=gotip https://go.dev/play/p/ymM0tD3aGYg?v=gotip
Obviously these sample functions don't take into account all the intricacies of float min/max functions.
- klodolph 3y agoYou can const x = min(a, b) assuming a and b are const.
- onionisafruit 3y agoI can't think of a use case for that. If all the inputs are consts, then you know the values and can just assign it to be the less of a or b. Am I missing something here?
- nordsieck 3y ago> I can't think of a use case for that. It helps to document intent. Probably not so useful for min, but it can be more useful for more complex functions.
- klodolph 3y agoConst are build-time constants, they are not necessarily the same value across all build configurations.
- onionisafruit 3y agoThat’s a good point.