MidpointRounding.AwayFromZero not correct

[@moderator: could you please move this post to the BURST subform? Posted here accidentally]

BURST compiled code appears to always do bankers rounding, and ignores the option MidpointRounding.AwayFromZero. Disabling BURST compilation leads to expected result:

var test1 = Math.Round(2.5f, MidpointRounding.AwayFromZero);//should round to 3
var test2 = Math.Round(2.5f);//should round to 2

Anything that can be done about this?

Thank you @Fribur - I’ve logged this bug internally and we’ll get it fixed.

1 Like