added trunc() when building with ms visual studio compiler