Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6974511
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 27, 20262026-05-27T17:14:48+00:00 2026-05-27T17:14:48+00:00

I have functions that conceptually all return the same thing, but the result can

  • 0

I have functions that conceptually all return the same thing, but the result can take different forms:

function GetThingy()

There are four different functions, each can return different things:

  • 0.071 (a float value representing an increase of 7.1%)
  • 7.1 (a float value representing an increase of 7.1%)
  • 1.071 (a float value representing an increase of 7.1%)
  • "7.1%" (a string value representing a percentage of 7.1%)

What terms can I use to help document these functions return values?

I’ve come up with my own terminology:

  • fraction: A fraction of one; where the value is understood to be between 0..1 (e.g. 0.07 represents 7%)
  • percent: A per-one-hundred value; where the value is understood to be between 0..100 (e.g. 7 represents 7%) Note: This contrasts with a fraction, with is per-one, rather than per-hundred
  • factor: A scale factor, that can be used to directly multiply; understood to be equivalent to 1+fraction (e.g. 1.07 implies an increase of 7%)
  • percentage: A string that contains the actual percent character (i.e. %), suitable for display to the user, or cases that prefer the localized text (e.g. "7%" implies 7%)

So applying my own naming scheme to the functions:

  • GetThingyFraction() = 0.071
  • GetThingyPercent() = 7.1
  • GetThingyFactor() = 1.071
  • GetThingyPercentage()= "7.1%"

What say you?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-27T17:14:49+00:00Added an answer on May 27, 2026 at 5:14 pm

    Not really sure there is an “answer” to this, but naming the functions as you have demonstrated makes it very easy for the consumer to understand what they are getting back. I like the terms you have chosen as well.

    Are you planning on implementing all four (or n) flavors of each function, or is this strictly a naming question for when different operations process the result differently?

    I am not so sure about the utility of the “percentage” version. Typically making strings for UI of messages should be handled in the presentation, not in the computation. The presentation would determine how many decimal places, “%” vs. “pct” vs “percent”, etc.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have two functions that have different enough logic but pretty much the same
So I have two jquery functions that bassically do the same, but on 2
Say I have two functions that expect ...rest parameters private function a(...myParams):void { trace(myParams.length);
I have functions that contribute to small parts of a figure generation. I'm trying
I have several functions that I wrote and I use regularly on my servers,
I have 2 functions that needs to be executed one after the other. In
I have functions in place that will convert the results of sql queries into
I have certain initializing functions that I use to set up audit logging on
I've been writing some jQuery functions that have JavaScript variables and looping, etc inside
I have a couple of functions that loop around the surrounding cells of a

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.