core/transformation: fixed bug in wrap_value (reported by Thibault North)

For a scalar with a specific dtype, this dtype was ignored, and min_scalar_type() was used instead.