max(float('nan'), 1) evaluates to nan max(1, float('nan')) evaluates to 1 Is it the intended behavior? Continue reading...