wwdiary‎ > ‎

Point Formula

The formula that WWDiary uses to calculate the point values of foods can now be edited.  You can set this in the application settings.

The formula can be pretty complex math if you so desire, and for people not skilled in math, it could be a pretty daunting thing to figure out.  Don't worry, there are plenty of people willing and able to help with the crafting of a formula to suit your needs if you run into trouble.  Just head over to the forum and create a post in the Formulas category asking for help. Be sure to let people know what you've already tried and what you're aiming for.

I encourage you to share which formulas work best for you, in the country you happen to live in.


Formula Syntax

Variables
When creating a formula, there are a few variables available to you.  
You can choose to enable any of these values to be used in your custom formula:
  • Calories
  • Carbs
  • Fat
  • Fiber
  • Protein

Operators
Supported operators include:

+ Addition Example: "4 + 3" for 7
- Subtraction Example: "4 - 3" for 1
* Multiplication Example: "4 * 3" for 12
/ Division Example: "12 / 3" for 4 (Don't divide by zero, it will cause a crash)
^ Exponentiation Example: "5 ^ 2" for 25 

There are additional operators which can be explained in more detail upon request.  If you need more than what is listed here, create a thread on the forum.

Functions
You may also use functions in your formulas.  They are like special operators:

abs Absolute Value Example: "abs(-4.2)" for 4.2
ceil Ceiling - Closest integer larger than this number Example: "ceil(4.2)" for 5   or   "ceil(-4.2)" for -4
floor Floor - Closest integer less than this number Example: "floor(4.2) for 4   or   "floor(-4.2)" for -5 
max Max - The largest of the specified numbers Example: "max(5, 3)" for 5
min Min - The smallest of the specified numbers Example: "min(5, 3)" for 3
sqrt Square Root Example: "sqrt(25)" for 5

There are additional functions which can be explained in more detail upon request.  If you need more than what is listed here, create a thread on the forum.

Examples
Here are some silly examples of point formulas that you should not use, but will show the syntax of how to make a formula:
Do not use quotes when entering them into the WWDiary application.  You can use parenthesis to force order of operations.
  • "calories * fat - min(fiber, 5)" Calories multiplied by fat, minus whichever is smaller: fiber or 5.
  • "calories + fiber - fat"
  • "(calories * 20) - ((12 + fat) / fiber)"

Comments