Relative Content

Tag Archive for numpyperformancemodulo

Why is `array % 1` running 150% slower for smaller numbers than larger ones?

I would understand if numpy was smart enough to see that array % 1 does not do anything, and that runtime is independent of the input. I would also understand if runtime was longer for larger numbers, maybe because dividing a large number takes longer (compare Why is floating-point division in Python faster with smaller numbers?). But why does array % 1 run longer for smaller numbers?