fork download
  1. import numpy as np
  2.  
  3.  
  4. def get_fix(xs):
  5. res = [np.floor(e) if e >= 0 else np.ceil(e) for e in xs]
  6. return res
  7.  
  8. xs = [3.14, -2.718]
  9. res = get_fix(xs)
  10. print(res)
  11.  
Success #stdin #stdout 0.14s 24732KB
stdin
Standard input is empty
stdout
[3.0, -2.0]