Round equation to the nearest 0.5

Hi all

As part of my business, I am asked to convert family tables into equations in SolidWorks. However, I have a problem: some of the resulting values end in 0.33, but they are automatically rounded to 0.5.

I would like to know if it is possible to obtain this same behavior directly via equations in SolidWorks.

I noticed that it's possible to round up or down, but I couldn't find an option to systematically round up to the nearest 0.5 .

Thank you in advance for your answers.

Hello

Then the answer is " Yes but no ", or " No, but yes ".
In the equations, the rounding function is not available.
But by extracting the integer part ( int() function), and treating the decimal part with an " if " function, it is possible to arrive at the desired behavior.

Basically the syntax: IIF(X-int(X)<0.5; Int(X); IIF(X-int(X)>0.5; Int(X)+1; Int(X)+0.5)).

5 Likes

Thank you for your answer, after research and testing, I succeeded in a formula that rounded up to the nearest 0.5 but not the top 0.5.

Here it is: = INT(Value * 2 + 0.5) / 2

For 3.33 → (3.33 * 2) + 0.5 = 7.16 → INT(7.16) = 7 → 7 / 2 = 3.5
But 3.66 → (3.66 * 2) + 0.5 = 7.82 → INT(7.82) = 7 → 7 / 2 = 3.5

The formula for the top 0.5.

= INT(Value * 2 + 0.999) / 2

Hello @Anthony_RIBEIRO

Out of conscience, what is the box ticked at the bottom for you?

2 Likes

Exactly the same configuration