Neg
NegResult = Neg(InputValue)
 
Parameters:

    InputValue = The value to be negated
Returns:

    NegResult = The value converted to negative
 

      The Neg() function takes a positive integer or floating point value and will negate it. If the value is already negative, Neg() returns this value unchanged.



FACTS:


      * The NEG function performs is the opposite of the ABS function, where ABS returns a positive value, NEG always returns a negative.

      * Note: You can also negate a variable / function result by placing the - symbol in front of it or by multiplying it by -1. See example bellow.




Mini Tutorial:



  
; Assign the variable SPEED the positive integer value of 10
  Speed = 10
  
; Print Speed Negated using NEG()
  Print Neg(Speed)
  
; Print Speed Negated by applying a negative sign
  Print -Speed
  
; Display what neg does to a range of values
  For lp=-5 To 5
     Print Neg(lp)
  Next
  
; Display the Screen and wait for the user to press a key
  Sync
  WaitKey
  




This example would output.

  
  -10.0
  -10
  -5.0
  -4.0
  -3.0
  -2.0
  -1.0
  0.0
  -1.0
  -2.0
  -3.0
  -4.0
  -5.0
  

 
Related Info: Abs | GetSign | Sgn :
 


(c) Copyright 2002 - 2024 - Kevin Picone - PlayBASIC.com