I know I had done it in the past, but now I forgot
I want to round up a number when the last 5' digit is greater than 0
1.34561 = 1.3457
1.34566 = 1.3457
1.34560 = 1.3456
I did try
Code: Select all
round( 1.34564,5):
Martin
Code: Select all
round( 1.34564,5):
just add 0.0004 to the number before rounding.Hello
I know I had done it in the past, but now I forgot
I want to round up a number when the last 5' digit is greater than 0
1.34561 = 1.3457
1.34566 = 1.3457
1.34560 = 1.3456
I did trybut not the good result. The result is rounded low when the last digit is < 5Code: Select all
round( 1.34564,5):
Martin
One line for you.... Add .0004 to the value... wow!Inputs: ValueNumber(Numeric), Lastdigit(Numeric);
//OneMorePip (TrueFalse);
Variables: PowerValue(1);
PowerValue = ( power(10, Lastdigit)); // 10 to power 1 = 10, power2 = 100, Power 3 = 1000, power 4 = 10000
Value2 = Valuenumber *PowerValue; //Multiply the fraction number to the 10' power Value. 1.23456 X (10 power 4) = 1.2345.6
//The result is a bigger number with the least significant vnumber is after the " ."
Value3 =ceiling(Value2); // The least significant fraction is raise to the first integer 12 345.6= 12 346.00
PowerValue = ( power(10, (Lastdigit)*-1)); //The result is then put back tio the original level 12 346 X (10 power(-4) = 1.2346
MT_RoundUp = value3 *PowerValue;