Given that no existing word is quite right for this common problem, a neologism is best. And "primantissa" delights: I will smile every time I use it.
A word for a value between 0 and 1 (inclusive)
291–300 of 325 posts
Re: A word for a value between 0 and 1 (inclusive)
#292Is there a resource for "help naming stuff"? Naming is hard. Especially so when you dabble in domains you're not learned in. I have almost no math background so sometimes I really struggle to know what to name things. My latest example is, "I need to provide a flag to switch if this element is positive or negative. What do I name the flag?" (came up with simply: sign, or polarity)
(evenp x) would return true if x was even.
So, "positivep". Though, yeah, that would be the name for a function that checks whether the argument was positive, not a flag.
Re: A word for a value between 0 and 1 (inclusive)
#293> between 0 and 1 (inclusive) [closed] Why yes.
Re: A word for a value between 0 and 1 (inclusive)
#294I would love to have a symbol that represents this unit scale as an analogue to '%'. I.e. you could say 33% or 0.33x where where 'x' indicates a normalized decimal from 0.0 to 1.0.
https://en.wikipedia.org/wiki/Parts-per_notation#Uno
I'm glad it never caught on.
Re: A word for a value between 0 and 1 (inclusive)
#295Earlier 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-...
Re: A word for a value between 0 and 1 (inclusive)
#296Earlier quoted context omitted.
Sure, but then you still have to name the type.
UnitInterval Represent it internally as either fixed or floating point and divide to convert in and out if needed. With a nice type system you could even genericize the type over integer constants
Re: A word for a value between 0 and 1 (inclusive)
#297Does 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…
> Does anyone know of a good site for these kind of questions other than the English stack exchange. Well, I was inspired enough by this idea to create a sub-reddit for the discussion of specific variable naming challenges. Hopefully it catches on. https://www.reddit.com/r/namemyvariable/
r/namemyvariable
Hmm feels a bit weird, maybe r/namingvariables haha already think'n bout re-naming the naming sub lolz
Re: A word for a value between 0 and 1 (inclusive)
#298Earlier quoted context omitted.
> 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…
You're solution is the ideal one and safest, although in the interest of maximum flexibility since the goal here seems more documentative than prescriptive, it could also be as simple as creating a type alias. In C for example a simple `#define UnitInterval float`, and then actual usage would be `function FuncName(UnitInterval accuracy)`. That accomplishes conveying both the meaning of the value (it represents accura…
There's a place for type aliases, but IMO that place is shrinking in most languages that support them, e.g. Haskell. With DerivingVia, newtypes are extremely low-cost. Type aliases can be useful for abbreviation, but for adding 'semantics' for the reader/programmer... not so much. Again, IMO. I realize this is not objective truth or anything.
Of course, if you don't have newtypes or similarly low-cost abstractions, then the valuation shifts a lot.
EDIT: Another example: Scala supports type aliases, but it's very rare to see any usage outside of the 'abbreviation' use case where you have abstract types and just want to make a few of the type parameters concrete.