Live data from Hacker News

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

english.stackexchange.com

91–100 of 325 posts

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

#92
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

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

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

There is an answer by someone who suggested a neologism, check the link for source.

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

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

yeah, right, so what do you call such a type? I believe that is the actual question.

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

#97

Depending on context I would use ratio saturated (if something is clamped to 0-1) normalized (if it is scaled down using a max value)

I don't like "ratio" because, though this might just be me, I already have a bad habit of assuming, incorrectly, that every ratio in my code is meant to stay smaller than +1.

That sounds valid, no reason for ratio to be <= 1. It usually is but not always I guess

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

#98
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 the best answer.

This got me thinking: What about a situation where the accuracy is given in a real-life unit. For example, the accuracy of a GPS measurement, given in meters. I've sometimes used names like 'accuracyInMeters' to represent this, but it felt a bit cumbersome.

Edit: Thinking more about it, I guess you could typealias Float to Meters, or something like that, but also feels weird to me.

Post reply on HN