Earlier quoted context omitted.
I agree that it's a question of type: what would you call that type though? I propose "pun" - proportion of unity, or "p(er) un".
Between0And1Inclusive I like verbosity! Or use a dependent type language. Maybe Idris? Then something like Between(0,1) I guess.
A word for a value between 0 and 1 (inclusive)
281–290 of 325 posts
Re: A word for a value between 0 and 1 (inclusive)
#282Re: A word for a value between 0 and 1 (inclusive)
#283I don't think this is a naming issue at all. In the provided example, 'Accuracy' is the correct name for the parameter, as that's what the parameter represents, accuracy. The fact that accuracy should be given as a value in an interval from 0 to 1 should be a property of parameter type . In other words, the parameter should not be a float, but a more constrained type that allows floats only in [0,1]. EDIT: Some of yo…
Is there an example, in any language, showing how you would represent this at the type level? I can’t see how you would do it.
It's the same question of, how can you convert a string to a Regexp type if not all strings are valid Regexps?
Re: A word for a value between 0 and 1 (inclusive)
#284Re: A word for a value between 0 and 1 (inclusive)
#285Earlier quoted context omitted.
While true, if your language doesn’t support such a type, then the burden for such a name goes to the parameter, does it not?
> While true, if your language doesn’t support such a type You'd be surprised where the support is. In C#, you would declare a struct type with one read only field of type double, and range validation (x this is the "value object" pattern. http://wiki.c2.com/?ValueObject Yes there's a bit of boilerplate - especially since you might want to override equality, cast operators etc. But there is support. And with a struct…
Re: A word for a value between 0 and 1 (inclusive)
#286I don't think this is a naming issue at all. In the provided example, 'Accuracy' is the correct name for the parameter, as that's what the parameter represents, accuracy. The fact that accuracy should be given as a value in an interval from 0 to 1 should be a property of parameter type . In other words, the parameter should not be a float, but a more constrained type that allows floats only in [0,1]. EDIT: Some of yo…
Unfortunately, creating a constrained type like this isn't easy (or even doable) in all programming languages. Fortunately, my preferred programming language, Raku, makes creating this sort of subset trivially easy[0]: subset UnitInterval of Real where 0 ≤ * ≤ 1 [0]: https://docs.raku.org/language/typesystem#index-entry-subset...
@Clamping(0...14) var pH: Double = 7.0
https://nshipster.com/propertywrapper/#implementing-a-value-...Re: A word for a value between 0 and 1 (inclusive)
#287I don't think this is a naming issue at all. In the provided example, 'Accuracy' is the correct name for the parameter, as that's what the parameter represents, accuracy. The fact that accuracy should be given as a value in an interval from 0 to 1 should be a property of parameter type . In other words, the parameter should not be a float, but a more constrained type that allows floats only in [0,1]. EDIT: Some of yo…
Re: A word for a value between 0 and 1 (inclusive)
#288Earlier quoted context omitted.
> While true, if your language doesn’t support such a type You'd be surprised where the support is. In C#, you would declare a struct type with one read only field of type double, and range validation (x this is the "value object" pattern. http://wiki.c2.com/?ValueObject Yes there's a bit of boilerplate - especially since you might want to override equality, cast operators etc. But there is support. And with a struct…
I don't think runtime validation is that special. You can bend most languages into this pattern one way or another. The real deal is having an actual compile-time-checked type that resembles a primitive.
"public Customer GetById(CustomerId id)" instead of "public Customer GetById(string id)" when only some strings (e.g. 64 chars A-Z and 1-9) are valid customer ids.
Compile-time validation would be ideal, but validation at the edges, well before that method, is good enough.
Re: A word for a value between 0 and 1 (inclusive)
#289"Normalized". That's what we call data that have been scaled to fit on a tidy axis.
That isn't the right term. The standard meaning of "normalisation" in most scientific and engineering domains is shifting and scaling to get the sample mean to 0 and sample standard deviation to 1. I.e. it will almost always include both negative numbers and numbers larger than 1.
Re: A word for a value between 0 and 1 (inclusive)
#290If 0-100 is a percent, then wouldn't 0-1 be a perun(something)? I don't know latin, but perun, perune, peruni?