Results 1 to 2 of 2

Thread: Target to Cost Question

  1. #1
    VBAX Newbie
    May 2020

    Question Target to Cost Question

    I have some code that targets a task to a desired cost. It adjusts each resource assignment using a ratio of the desired cost over current cost. In general, it works great except in a very specific situation.

    If the delta between the current cost and desired cost is very small, it is almost impossible to get the cost to the exact penny. It ends up being 1 or 2 cents above or below. Every time you run it, it flip flops between being 1-2 cents high and 1-2 cents low.

    I have tried changing the current cost, the number of units, and the initial cost at the beginning to achieve a greater delta so that it will work but the results are mixed.

    Does anyone know of a way to ensure that you can target to cost the first time every time?

  2. #2
    VBAX Sage SamT's Avatar
    Oct 2006
    Near Columbia
    Maybe try: Change all your "Double" variables to "Currency" variables.

    Uncertainty like that is a known issue of digitized math.

    Alternately, Round the result of every step of every calculation to the fifth decimal place.
    I expect the student to do their homework and find all the errrors I leeve in.

    Please take the time to read the Forum FAQ

Tags for this Thread

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts