Live data from Hacker News

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

english.stackexchange.com

131–140 of 325 posts

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

#131
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…

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...

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

#133
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…

Stan, a probabilistic programming language where this thing comes up a lot, makes it easy to declare such constrained parameters:

  real accuracy;

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

#134
post #20

Better languages will let you call the variable just "accuracy", but with type "float 0 to 1 inclusive" with some literal syntax; so from function FuncName(float AccuracySOMETHING) to function FuncName([0...1] accuracy)

Which languages allow this? It looks suspiciously like dependent typing to me

FWIW, that's not dependent typing, because the type doesn't depend on run-time values. A bool is either true or false, a [0...1] is either 0 or, ..., or 1.

As for which languages allow it. I'm not sure for floats, but Pascal let you do it for ints for sure. https://wiki.freepascal.org/subrange_types

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

#135
post #38

Is there a dictionary or thesaurus or something similar specifically designed to help programmers name things? I run into questions like this all the time. “There has to be a commonly used word for this concept, but I don’t know what it is”

Maybe there should be an IRC group #namingthings on Freenode?

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

#136
post #121
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…

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?

Usually that would go to the documentation of the parameter, plus a run-time assertion to check that received values are valid.

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

#137
post #121

Earlier 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?

Usually that would go to the documentation of the parameter, plus a run-time assertion to check that received values are valid.

But the best documentation is the code itself that is documentation. I mean, well that’s kind of a cliché, but names can carry a lot of meaning.

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

#138
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…

Stan, a probabilistic programming language where this thing comes up a lot, makes it easy to declare such constrained parameters: real accuracy;

[deleted]

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

#139
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…

Great that you like typed languages, and ones that allow for such constrained/dependent typing as well.

It seems disingenuous to me to suggest that anyone using other languages do not have this problem. And really, there are quite a few languages to not have this form of typing, and even some reasons for a language to not want this form of typing.

So please, don't answer a question by saying "your questions is wrong" it is condescending and unhelpful.

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

#140
post #2

“mantissa” ( https://en.wikipedia.org/wiki/Common_logarithm#Mantissa_and_... ) comes close, but excludes 1. IEEE 754 sort-of has that as a part of a float, too ( https://en.wikipedia.org/wiki/Significand ), and people use the term “mantissa” for it, but it has to special-case 0. ⇒ barring better suggestions, I think I would stretch the definition of mantissa a bit further.

Thing is, whilst a mantissa is indeed between 0 and 1, not every number between 0 and 1 is a mantissa. Specifically, a mantissa suggests the existence of a significant.
Post reply on HN