Rounding Negative Number Toward Zero
Tech Tip: Click here to run a free scan for Windows Errors and optimize PC performance
Hello,
Is there a way in VB6 to round negative numbers towards zero when the
deciding number is 5? For example, if my number is -0.245, and I would like
to round to 2 decimal places, I would like the number rounded to -0.24.
Currently, I'm using the formula below for asymmetric arithmetic rounding
which rounds the previously mentioned number to -0.25.
Formula:
CDbl(FormatNumber(myNum, desiredDecimalPlaces))
Thanks in advance!!
Jack
.
Relevant Pages
- Re: too many zeros and orbital mechanics.
... How do I tell Matlab not to do that? ... I can try round(e) which does round that to zero, ... exact value of zero, clear down to the least significant bit, you can ... (comp.soft-sys.matlab) - Rounding of integer divisions (was Re: linear interpolation / Assembler / ATMega32)
... The worst thing you may do is to unsignedify the number, round ... The function becomes dead around zero! ... int z, x, y; ... type casts and let the compiler get rid of the extra variables. ... (comp.arch.embedded) - Re: Rounding of integer divisions (was Re: linear interpolation / Assembler / ATMega32)
... The result is zero over ... Most high level languages round towards zero, ... Doing floored rounding makes ... I once designed a XY table that requires 24 bit math ... (comp.arch.embedded) - Re: .9 repeating
... regarding his mathematical theory and put them all together. ... | smallest round. ... | Its about the point next to zero on a number line. ... from MR to a rigorous theory, ... (sci.math) - Re: sin (M_PI)
... and getting 1.22461e-16 instead of zero. ... significant figure you wish to round it, and whether you wish to round ... Rather than storing a numeric approximation to pi, ... this symbolic value yields exactly zero (if the sine function is ... (comp.lang.c) |
|