Live data from Hacker News

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

english.stackexchange.com

161–170 of 325 posts

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

#161

Earlier quoted context omitted.

Right but it’s specifically not, and liable to make people think “3” is an acceptable input

Again, this is bike shedding bait. I'm going by my own experience with basic mathematics in my American education where "percent" is something you multiply a number by, and usually ranges from 0 to 1. Ex. 50% of 12 marbles is 6 (*.5, 50%). But just looking at all the different answers in the comments here means there's no consensus on a "right" way. Hence bike shedding. A decent code base should be consistent so it c…

‘Per’ means ‘divided by’, ‘cent’ means 100. Units implicitly multiply, and x/100 == x*0.01.

Percent is a fancy way to 0.01, just as ‘dozen’ is a fancy way to say 12.

Percent has some strong norms around its usage (no-one buys 1200% eggs at the supermarket) but you can’t ignore the mathematical meaning.

In both cases, if someone used them as a type name, conversion to floats should involve multiplying by the unit.

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

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

More complex type systems absolutely support asserting the units of a value in the type system. For example, here's an implementation of SI types in C++: https://github.com/bernedom/SI

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

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

>However, I believe most of the more popular languages support creation of custom data types?

No, most don't, except if you go into building custom classes.

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

#164
post #44

Does anyone know of a good site for these kind of questions other than the English stack exchange. I frequently run into programming related naming issues (who doesn't eh?). But I struggle to find accurate search terms to help answer them...and the results are usually downed out by non-technical related language Q&A's E.g. I was trying to name a table yesterday that would store events related to boxes, pallets, conta…

> boxes, pallets, containers and vessels Woo, that's a tough one. Even as a native speaker, I'd be hard-pressed to find one word in English that describes all these similar but different terms. I looked up some of these in a dictionary for definitions and synonyms. OK, the word "holder" seems to be the most general term that includes all these types of objects. So I'd name it "holder_events_table", with a column "hol…

yeah I ended up leaning towards something similar, but avoided the whole issue of naming the "thing" by instead naming it based on the class of events contained in the table...ended up calling it tracking_events, and making it reference the "thing" as trackable_type,trackable_id (ala polymorphic relation in Rails world).

but yeah, naming things...wonder how much time I've spent pondering over names in my career (probably too much haha)

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

#165
post #44

Does anyone know of a good site for these kind of questions other than the English stack exchange. I frequently run into programming related naming issues (who doesn't eh?). But I struggle to find accurate search terms to help answer them...and the results are usually downed out by non-technical related language Q&A's E.g. I was trying to name a table yesterday that would store events related to boxes, pallets, conta…

I use Power Thesaurus[1], which is crowd-sourced and frequently has words that are well suited to technical use-cases.

In your case, I looked at synonyms for "containers" and found some likely candidates such as "holders" or "receptacles", so `receptacle_events`.

[1] https://powerthesaurus.com/

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

#166
post #73

Earlier quoted context omitted.

One problem with the word normalised is that it implies that there is some true original value from before normalisation that isn't necessarily between 0 and 1. Of course if that's true then the word is ideal, but if not then it's confusing.

Genuine question, i'm no math expert: if you're using the value by multiplying it with some other value, does that not imply it qualifies as normalised? i.e. say you have a width of 500 and you want to move half way across so you have this value of 0.5 to get 250. By dividing 250 by 500, aren't we in fact normalising it?

I think generally normalized quantities maintain their original units whereas in your ratio case the unit is dropped. Units in the abstract sense I guess, such as this is a measurement along this vector or this is a ratio of any vector.

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

#167

Earlier quoted context omitted.

The question was about the parameter name , though. The correct answer seems to be: function FuncName(UnitInterval accuracy)

UnitInterval seems to contains an interval , not a single float. I don't think it's a very good name. UnitIntervalNumber would be better, but it's too long. Something like UnitNumber or UnitFloat could maybe work.

Yes, UnitInterval is a really bad name for a single number. Astonishingly, it has 30 upvotes on SO.

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

#169
post #114
post #79

I use "alpha" for this, as in A in RGBA. Obviously won't work for everyone, but it's a simple convention that's easy to grok and explain.

Sounds a bit too much like alphabet or alphanumeric?

Not to me. Especially when preceded by "float".

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

#170
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?

Joel, on the original purpose of Hungarian notation: https://www.joelonsoftware.com/2005/05/11/making-wrong-code-...

[deleted]
Post reply on HN