program memory math strange behavior