Welcome to NexusFi: the best trading community on the planet, with over 150,000 members Sign Up Now for Free
Genuine reviews from real traders, not fake reviews from stealth vendors
Quality education from leading professional traders
We are a friendly, helpful, and positive community
We do not tolerate rude behavior, trolling, or vendors advertising in posts
We are here to help, just let us know what you need
You'll need to register in order to view the content of the threads and start contributing to our community. It's free for basic access, or support us by becoming an Elite Member -- see if you qualify for a discount below.
-- Big Mike, Site Administrator
(If you already have an account, login at the top of the page)
Hi everyone, I'm having trouble limiting a double to two decimal places but without rounding it. For example, I'd like to turn this double 0.2298 into this double 0.22
I tried things like: StrToNum(NumToStr(0.2298,4)) but StrToNum won't let you specify how many digits.
Can you help answer these questions from other members on NexusFi?
when you want to truncate a value basic math seems your best approach. Dividing the integer portion (using the reserved work IntPortion) of your value after you multiplied it with 100 by 100 will give you the result you are looking for.
It should be noted, that while this will remove the "98" from your value, it will not change the precision of decimal variables or the number of decimal places stored internally by the platform.