[Cross-platform / Bug Fix] Typecast Currency divided by scalar issue

Summary

This merge request fixes an issue that usually manifests under -Oofastmath, but also under other set circumstances, where divisions - with a Currency numerator typecast to floating-point - are changed into multiplications for speed reasons. This fixes some scaling issues, and also introduces a case where the fast-math optimisation outside of fast-math if it is safe to do so (an integer divisor that is a power of two).

This fixes test webtbs/tw41865d.pp.

System

  • Processor architecture: Cross-platform

What is the current bug behavior?

If a Currency is typecast to floating-point and then divided by a constant, the result is sometimes incorrectly scaled.

What is the behavior after applying this patch?

The result should be correctly scaled under all circumstances.

Merge request reports

Loading
Loading