31

I'm a programmer. I'm so sick of writing documentation for things that should be explainable in a word.

When you write a function in a programming language, you get to name its parameters. Most things I can name easy enough, such as "Name" or "URL" or "MaxSizeN". The first 2 are self explanatory, the last one is the maximum size of something in relevant data units(as opposed to bytes or some other unit) but that one is easily understood by other programmers too.

Very often though, there is a parameter that is a floating point type (float) that needs an input in the range of 0 to 1 (inclusive). This is problematic since I have no idea what to call those things so I have to write function descriptors (assuming the language has them) or document it some other way which is annoying.

Lets say this float needs to define the accuracy of something so I declare it:

function FuncName(float Accuracy)

This is very ambiguous since the type float itself can contain a ridiculously large variety of numbers. Meanwhile if I were to declare it as such:

function FuncName(float AccuracyPercent)

Then its immediately obvious that the input should be a value from 0 to 100.

Percentages aren't useful for math however, they are more like a "human friendly" markup for fractions and have no place in actual program logic and I'd rather avoid unnecessary overhead.

I'm looking for a word that I could mangle into my parameter names so that they would convey "this should be from 0 to 1".

I don't even care if the word is unknown to most people, I'll just start using it and tell others to read the dictionary :D

Is there any word for that?

closed as off-topic by RegDwigнt Nov 4 '16 at 11:58

  • This question does not appear to be about English language and usage within the scope defined in the help center.
If this question can be reworded to fit the rules in the help center, please edit the question.

  • 4
    probabilities meet this criterion, but I guess not all things that meet this criterion are probabilities... – sumelic Sep 24 '15 at 0:34
  • 5
    What's wrong with, e.g. function FuncName(float RealNum0to1) or something like that? It can't be looked up in a dictionary but then neither can 'MaxSizeN' – chasly from UK Sep 24 '15 at 0:41
  • 2
    It's not a single word, but try "proper fraction" If you were concerned that the values weren't fraction, you could try "proper decimal". – DJClayworth Sep 24 '15 at 0:43
  • 7
    The formal mathematical term for this is the [closed] unit interval. But I too have wished for a more common/accessible word for such an ubiquitous concept (how often do you mention or think in terms of percentages? Well, that's just the unit interval * 100 (capped at 100%, of course)). – Dan Bron Sep 24 '15 at 1:04
  • 3
    I tend to use either "Fraction" or "Proportion" for this. The words don't in themselves indicate that the number has to be on the unit interval, but then neither does the word "Percentage" indicate that a a parameter has to be in the interval (0,100). One needs to distinguish between how such a parameter is used and what its bounds are (the latter often being determined by the former). From a coding perspective, it is usually more important that a parameter name reflects its functionality than its bounds. – Rupe Nov 11 '15 at 13:12

14 Answers 14

14

How about unit interval?

From Wikipedia:

In mathematics, the unit interval is the closed interval [0,1], that is, the set of all real numbers that are greater than or equal to 0 and less than or equal to 1. It is often denoted I (capital letter I). In addition to its role in real analysis, the unit interval is used to study homotopy theory in the field of topology.

In the literature, the term "unit interval" is sometimes applied to the other shapes that an interval from 0 to 1 could take: (0,1], [0,1), and (0,1). However, the notation I is most commonly reserved for the closed interval [0,1].

The word you're seeking may be UnitInterval:

function FuncName(float UnitInterval)

Note for other users: Many numbers in the unit interval are not fractions, i.e., rational numbers. They may be irrational numbers, e.g., square root of 1/2 and pi/4, neither of which can be expressed as a ratio of two integers. At the same time, all numbers with a finite number of digits are rational numbers.

Acknowledgement: I changed my original UnitInt to UnitInterval based @ChrisH's comment. Thanks, Chris.

  • I wouldn't abbreviate "interval" to "int". That name is already taken in a programing context. def UnitInt: return 1. As the trend these days seems to be for longer function names, just go for UnitInterval. – Chris H Nov 3 '16 at 19:26
  • @Richard Kayser Here I was enjoying your suggestion: UnitInt And then it hit me... I can just see myself trying to differentiate Unitint from that zoo of integer types in glib with sleepy eyes! – Terry Wendt Nov 3 '16 at 19:34
  • @Richard Kayser unsigned int, int, gint, guint, gintptr, guintptr, gint8, guint8, gint16, guint16, gint32, guint32, gint64, guint64, UnitInt... – Terry Wendt Nov 3 '16 at 19:44
  • @ChrisH I agree. I didn't put a lot of thought into it, as it's a programming choice. I'm going to edit my answer to reflect your comment. Thanks. – Richard Kayser Nov 3 '16 at 20:39
  • @TerryWendt Wow. I didn't realize there was such a zoo of integer types. UnitInterval (see response to Chris H's comment) should be easier to pick out than UnitInt, even with sleepy eyes. Thanks. – Richard Kayser Nov 3 '16 at 20:51
11

Proportion or primantissa, from generic to novel words.

"Proportion" is my first generic choice, especially in its "percent" acception (acceptation). Apparently, before the decimal system, fractions in the form of 1/100 were common. The "%" sign evolved from Italian "per cento", cento being contracted into two circles separated by a bar.

From chemistry, I would like to rejuvenate the term "stoichiometry" (from Greek words στοιχεῖον, stoicheion "element" and μέτρον, metron "measure").

From order statistics, with a twisted use, "fractile" could be easy to understand (usual derivatives are percentile, centile, quartile, quantile).

From computer-based representations, the term "mantissa" could be fine, alas its use is discouraged by many authorities (IEEE floating-point standard, D. Knuth). Finally, the one I prefer could be "significand", the significant digits of a number in scientific notation or a floating-point number.

Finally, I asked a friend with a huge knowledge in scientific terminology (author for instance of Le manuel du système international d'unités : lexique et conversions, in French only). He claims that one should invent new names for such concepts, and proposed a nice "primantissa".

  • Mantissa in this meaning would be correct, but it does not meet OP's criteria for inclusiveness of 0 and 1. – macraf Nov 11 '15 at 21:31
  • Indeed. A friend with huge vocabulary suggested primantissa, as he believed the word did not exist, and called for a neologism. – Laurent Duval Nov 11 '15 at 21:38
  • 1
    A think proportion is the correct term here. – dwjohnston Apr 17 '16 at 22:59
2

In the 3D graphics programming world, values such as color components that are scaled to the range [0, 1] are referred to as normalized.

So you can use:

function FuncName(float AccuracyNormalized)

when you're expecting an argument in the range [0.0, 1.0].

1

Edit: I came back to this and lamented my original answer's failure to win people over. I thought it was a good answer. Then I set about thinking of more ideas. Coming up with one, I went to add an alternate answer, only to realize the question had been closed. I'll note it here, as it may be better than my original answer (below the cut) and perhaps it will be useful to someone who comes along in the future. If not, oh well.

portion

noun

  1. A part of any whole

I think this is exactly what we're trying to describe. It's somewhere between none and all of a whole, inclusive. A portion is never more than all of the whole, and it's never less than none, so that fits with the "unit interval" theme, without being quite so awkward as literally saying "unit interval".


Original answer:

It's not quite the specific word you're looking for, but if you want a word that a reader will intuit the way you want, you could reference a physical input like a dial or a slider. The mental image of a physical device may provide the caller with a much clearer idea of the parameter's usage.

That being said, words like "dial" and "slider" feel inelegant and might imply too great an association with UI elements/objects, rather than values.

In engineering terms, those inputs are potentiometers. I don't think you'd want to use such a long word as "potentiometer", but they do have a nice abbreviation for that class of inputs:

Pot

For example:

VolumePot
AccuracyPot
ContrastPot

It's a sufficiently distinctive and specific word that it would be unlikely to be mis-intuited. Either a person would know what it was and what it implied, or they would be forced to ask about it and learn the implications.

I've actually seen this used in the past, by the way. I'd forgotten about it until just now. I recall thinking it was quirky, but I did understand the meaning.

  • Sigh. I'm sad that this did not appeal to anyone, and even encouraged someone to downvote it. "Pot" is such a simple, unique, concise, un-confusable term that it would do well for this purpose if it were popularized. The other options are all so wordy or inelegant (e.g., while accurate, the top answer of "UnitInterval" is anything but convenient). Oh, well. – Aiken Drum Jan 3 '18 at 7:07
  • "mis-intuited" is a word? Is that supposed to be a pun? I think writing un-confusable with a hyphen is un-conventional :) To a layperson such as myself, your suggestion "pot" does not suggest that it is an abbreviation, but rather a vessel for plants or for cooking. Or even a soft drug. You probably got the anonymous downvote for that reason. I'm sure the downvoter, who was probably a computer software engineer who posts on StackOverflow, believed the suggestion was inappropriate. – Mari-Lou A Jan 3 '18 at 8:57
  • Citations and references should always be clearly attributed by the way. – Mari-Lou A Jan 3 '18 at 9:00
  • @Mari-LouA - Really? I criticize a question you post, and you start stalking my comments? That's not creepy at all. – Aiken Drum Jan 4 '18 at 23:08
  • 1
    what's the difference between portion and proportion? – Adrian Mar 7 at 22:37
0

In common English, I'd probably use decimal. I could imagine that could be confusing if you're using binary, octal, or hexadecimal numbers, though.

0

A unit ratio is a fraction with a denominator of 1. Not perfect, but it's what I use.

unit ratio

Alternatively, if we're looking for absolute precision:

unit interval ratio

  • You have suggested a noun phrase, not a single word as specifically requested by the OP. – Mari-Lou A Jan 3 '18 at 9:02
0

I used to have this same problem. I standardized on using "scalar". It's not perfect, but once I have explained it in one place in the code, its meaning is obvious elsewhere. One problem with this word is that by itself it doesn't imply the range 0 to 1, but I use it consistently to be 0 to 1 and never anything else so it works pretty well. I, too, would like a single (and preferably short) word that more accurately describes this range, but this works for me.

0

Range0-1 would work as part of a parameter name, particularly as you are going to define the term anyway. If you are going to use it as a prefix or suffix you could even shorten it to rng0-1

As an alternative you could use domain0-1 or dom0-1 as the domain of a mathematical function is the range of input values over which it is defined.

-1

My suggestion would be "fractional". While not perfect you didn't sound like you were going for perfection. It hints at the need for the float to be a fraction (a value between 0 and 1). The downside is it seems to exclude 0 and 1 but you can use your definitions to clear that up I'd imagine.

-1

0 to 1 implies only 0.1, 0.2..0.9? or also 0.01, 0.02..0.99?

In any case I myself am a programmer and an SQL database administrator and I prefer to use the term "a scale of a number" which means "the number of digits to the right of the decimal point in a number."

In the first case you a have a scale of 1 whereas in the second case you have a scale of 2.

A "scale" is - a succession or progression of steps or degrees; graduated series; a sequence of marks either at regular intervals or else representing equal steps, used as a reference in making measurements;

https://msdn.microsoft.com/en-us/library/ms190476.aspx

In this case you get a range from 0 to 1 with a scale of [scale] (a step of [scale]).

It is easier to say Scale 0 to 1 (Scale -1 to 1 if with negative) if you want to imply tenth, hundredth, thousandths and e.t.c withing a range between 0 and 1 including 0 and 1.

-2

I've just finished a year long programming project for university with this everywhere.

I went with:

percentNormalized

p.s. I like long descriptive variable names and methods, sometimes they can even lead to very nice self-commenting code.

(sometimes they can lead to lines being way to long though... espcially in conditionals)

  • 3
    Naming of variables is off-topic, but this answer can be rescued by explaining normalised. So far, nothing in this answer explains why normalised works; your educational history and likes and dislikes are not really relevant, I'm afraid. – Andrew Leach Sep 27 '15 at 11:57
  • 1
    Well, you can vote/suggest/flag or do whatever you feel 'afraid' to do. But I personally think that user81993 will understand my answer with no further explanation, they may even appreciate the context. – Lamar Latrell Sep 27 '15 at 12:20
  • To me, this is like giving the number 1 the name "half of two". A percentage is simply a fraction multiplied by 100. If one wants a word for a percentage divided by 100 then the word "fraction" serves perfectly. – Rupe Nov 11 '15 at 13:19
  • 'Fraction' was the word that came to my mind as soon as I read the original question. The issue is that fractions can be bigger than one and can also be negative. Of course, that also happens to percentages. – Pablo Straub Feb 24 '16 at 3:16
  • 1
    I just ran into OP's situation yesterday and without thinking about it too much, I used "Normalized" (e.g. costNormalized, chanceNormalized). "Normalized" per se is too general a term, but when numbers are normalized in practice, it's usually to a 0-1 scale. I don't know if that'll meet ANSI standards or anything, but it was clear enough for my script. – Jacktose Sep 9 '16 at 14:02
-2

In your context how about PerUnit. The phrase "per unit x" is commonplace which gives a helpful layer of familiarity, though it's easily understood from the individual words. In "electrical engineering, a per-unit system is the expression of system quantities as fractions of a defined base unit quantity" (Wikipedia). While this may be a completely unrelated field to yours it has that fraction of something quality you're looking for.

  • This is an already established term for this, as documented in Wikipedia. It also relates to the author's comment regarding the use of 'accuracyPercent' as a possible name for the variable. – Pablo Straub Feb 23 '16 at 13:13
-3

I refer to numbers like that as "homogeneous components," but I work in games, and our terms are in the idiom of a very small circle.

-4

There is a word that describes the values between and inclusive of 0 and 1 in my vocabulary, but there is evidence that its meaning varies depending on which part of the world you were educated in. So even though we are speaking of math, the answer to a linguistic question is subjective:

The word I would immediately assign to a function you defined is gradient in the meaning of a linear representation of a rate of change of a function, thus possible to express as a value from 0 to 1.

Equivalent to what Wikipedia defines as a Grade (slope). Gradient is listed as one of the alternative words and is explicitly differentiated as a subset of a more broad gradient in calculus. Unlike other synonyms, ie. slope, incline, pitch or rise, it does not have strong relation to a notion of a physical slope.

  • A gradient goes from 0 to 1 if you are going up (it would be negative if going down) and the slope is less that 45 degrees. This is evident in the same reference given in Wikipedia given. 'Gradient' is not a good term for a number from 0 to 1. – Pablo Straub Feb 23 '16 at 13:09
  • @PabloStraub Frankly, I don't understand what you are trying to say. – macraf Feb 23 '16 at 13:14
  • 1
    In mathematics, 'gradient' is the slope of a curve or surface. A gradient of zero means flat; a positive gradient means a slope upwards; a negative gradient means a slope downwards. A very steep slope can have a gradient arbitrarily large. A 45 degree slope will have a gradient of exactly 1. As it gets steeper the gradient grows more to the point that a vertical would have an infinite gradient. So at least in a mathematical context, 'gradient' has nothing to do with a number between 0 and 1. – Pablo Straub Feb 24 '16 at 3:22
  • You are referring to this meaning of slope, I referred to another one which I referenced and explained. What's the point? – macraf Feb 24 '16 at 3:30
  • 1
    Yet in none of these meanings of slope the gradient in never constrained to be between 0 and 1. – Pablo Straub Feb 24 '16 at 3:53

Not the answer you're looking for? Browse other questions tagged or ask your own question.