Percent sign question

Issue #826 closed
Former user created an issue

The percent (%) calculation is going wrong.

450-30 percent=449.7

google result is:

450 - 30% = 315

Comments (4)

  1. Helder Correia repo owner

    The % operator has been largely discussed in the past (e.g. see issue #239) and removed since version 0.12 (see issue #583). You must be using version 0.10 or 0.11.

  2. Helder Correia repo owner

    Sorry, I just realized you were talking about the percent built-in unit. In that case, it is merely an alias for the value 0.01, so you are multiplying 30 by 0.01 in the end, and that's not what you want.

  3. Helder Correia repo owner

    You can make use of the user functions feature like this:

    perc(v; p) = v×(1p×percent)
    
    perc(450; 30)
    = 315
    
  4. Log in to comment