floor

floor, function

def pure const autodiff floor(quantity: number): number

Returns the entered quantity rounded down to the nearest integer.

Example

show table "" with
  floor(-1.7) 
  floor(-0.5) 
  floor(0.2)  
  floor(1.9)

This outputs the following table:

floor(-1.7) floor(-0.5) floor(0.2) floor(1.9)
-2 -1 0 1

Remarks

When used inside an Autodiff block, the gradient associated to floor() is 1, instead of 0, as the mathematical definition would suggest. The purpose of this irregular behavior is to facilate the design of discrete policies.

See also

User Contributed Notes
0 notes + add a note