Live data from Hacker News

A word for a value between 0 and 1 (inclusive)

english.stackexchange.com

231–240 of 325 posts

Re: A word for a value between 0 and 1 (inclusive)

#231
post #70
post #67

Earlier quoted context omitted.

While percentages are denoted as numbers between 0-100, they actually represent numbers between 0-1. Though you can have things like 120% so it's not perfect.

I did not mean it cannot exceed 1/100/1000. > they actually represent numbers between 0-1 Not really. The often represents, for instance, a population of 100M, then 0 means 0, 1 (or 100%) means 100M and 1.2 (or 120%) means 120M (in case of population growth).

We are really arguing unimportant semantics here but I don't agree with you, when you say 50% of the population, you are saying 0.5 of the population or 0.5 of 100M. The 50% always represents 0.5 when used correctly, in fact the % sign is a different way of writing "/100" (with some artistic freedoms).

Re: A word for a value between 0 and 1 (inclusive)

#232
post #90

I 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…

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.

Re: A word for a value between 0 and 1 (inclusive)

#234
post #90

I 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…

I think this is right, but it's still IMO basically a natural language semantics issue. For instance in haskell (which has a pretty advanced static type system), I would still probably be satisfied with:

  -- A float between 0 and 1, inclusive.
  type UnitInterval = Float
  
  foo :: UnitInterval -> SomeResultPresumably
  foo accuracy = ...
i.e. I think the essential problem in the SO question is solved, even though we have no additional type safety.

A language without type synonyms could do just as well with CPP defines

Re: A word for a value between 0 and 1 (inclusive)

#235
post #90

I 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…

I'm envisioning a programming language in which variable names and type names can become one. So instead of func call(Person person){} you just have func call(person){} where person is a known type AND the variable name. In that scenario 'accuracy' would be a type with known value between 0 and 1.

Combine with the JS/TS syntax sugar for objects and

{person}

Is an object person with key person and value person of type Person

Re: A word for a value between 0 and 1 (inclusive)

#236

Earlier quoted context omitted.

One of the answers was edited to “portion”, which is the same idea, I think either portion or proportion is elegant and simple. If anyone has been using proportion then I’d stick with that, though portion is nice and succinct.

In general usage, 'proportion' is not limited to the unit interval [1][2]. Offhand, however, I cannot think of a use of 'portion' that does not refer to part of a whole [3]. I think this is the best suggestion so far. [1] https://www.dictionary.com/browse/proportion [2] https://www.merriam-webster.com/dictionary/proportion (3rd. entry) [3] https://www.merriam-webster.com/dictionary/portion

This is weird, someone in the OP thread said what you have.

A portion of fries can be 80 individuals, the proportion of all fries in the fryer might be 0.1; proportions are often expressed in percentages.

So "the proportion of the population using my tool is 1%" means 1/100, ie 0.01 of a population normalised to unity.

Pro-portion is like pro-rated, it's taken as in comparison to the whole (normalised to the whole, if you like).

"What proportion did you contribute" == what share of the whole did you contribute.

[en-gb native]

Re: A word for a value between 0 and 1 (inclusive)

#237
post #226

I've called this 'unit real' in the past, but wasn't happy with it. 'Portion' is good, from one of the answers. ('Proportion' and 'fraction' unfortunately both suggest a ratio of integers instead of a unit real. It'd sure be convenient if these two different words weren't fixed to that same meaning.) For neologisms, 'tweening' comes to mind. (Think of the coefficient of a convex combination. 'Tweenness' feels just a…

>'Proportion' and 'fraction' unfortunately both suggest a ratio of integers instead of a unit real. I don't mean to pick on you in particular abecedarius, but I find it amusing to be worried about signalling that irrational numbers are OK given the context is computing and all the numbers are rational anyway.

You got me there, but I think this kind of discussion is "you know what I mean" territory: ratios aren't limited to 0..1, and the central examples the terms evoke involve small integers.

Re: A word for a value between 0 and 1 (inclusive)

#239
post #185

Earlier quoted context omitted.

I'm genuinely sorry if I came across as condescending, that was not my intention at all. I merely wanted to point out that, in my opinion, this property should be reflected in parameter type, rather than the name. Just like, if we wanted a parameter that should only be a whole number, we wouldn't declare it as a float and name it "MyVariableInteger" and hope that the callers would only send integers. You mentioned th…

So, then the user calling the library with foo(3.5) will get a runtime error (or, ok, maybe even a compile time error). To avoid that, you need to document that the value should be between 0 and 1, and you could do that with a comment line (which the OP wanted to avoid), or by naming the variable or type appropriately: And that takes us back to the original question. (Whether the concept is expressed in the parameter…

> So, then the user calling the library with foo(3.5) will get a runtime error (or, ok, maybe even a compile time error).

I'm not sure I understand this. See below, but the larger point here is that the type can never lie -- names can and often do because there's no checking on names.

I think what is being proposed is something similar to

    newtype Accuracy = Accuracy Float
and then to have the only(!) way to construct such a value be a function

    mkAccuracy :: Float -> Maybe Accuracy
which does the range checking, failing if outside the allowable range.

Any functions which needs this Accuracy parameter then just take a parameter of that type.

That way you a) only have to do the check at the 'edges' of your program (e.g. when reading config files or user input), and b) ensure that functions that take an Accuracy parameter never fail because of out-of-range values.

It's still a runtime-check, sure, but but having a strong type instead of just Float, you can ensure that you only need that checking at the I/O edges of your program and absolute assurance that any Accuracy handed to a function will always be in range.

You can do a similar thing in e.g. C with a struct, but unfortunately I don't think you can hide the definition such that it's impossible to build an accuracy_t without going through a "blessed" constructor function. I guess you could do something with a struct containing a void ptr where only the implementation translation unit knows the true type, but for such a "trivial" case it's a lot of overhead, both code-wise and because it would require heap allocations.

Re: A word for a value between 0 and 1 (inclusive)

#240
I propose "pun", as a neologism, for brevity. Easy to postfix.

"Proportion of Unity" "Proportion of Unity, Normalized". "P(er) Un" or "Perunage" contracted.

Short, doesn't clash hard with other meanings, is its own mnemonic.

AccuracyPun would be accuracy as a proportion of one. femPop might be 8000, but femPopPun would have to be [0,1].

Post reply on HN