1

The command a: = 1/0; leads to different results:

VCL - WIN32: floating point divide by zero

VCL - WIN64: FLOAT_DIVIDE_BY_ZERO

FMX - Win32, Win64, Android: no exception, a = 0

Is that intentional?

LU RD
  • 34,438
  • 5
  • 88
  • 296
Peter Kloß
  • 119
  • 8
  • 1
    The compiler and the RTL are the same regardless of which UI framework you use. So I would expect consistent results whether you use VCL or FMX. Unless there is some low-level hook that VCL is using that FMX is not, or vice versa – Remy Lebeau Jun 04 '21 at 22:26
  • 1
    Please check what System.Math.GetExceptionMask()` returns in each case. and add that to your question. Look at `System.Math.TArithmeticExceptionMask`for definition. – Tom Brunberg Jun 05 '21 at 07:07
  • Also look at both answers to [this question](https://stackoverflow.com/q/47611635/2292722) – Tom Brunberg Jun 05 '21 at 07:10
  • That seems implausible. On Windows compilers that code assigns +inf to a. – David Heffernan Jun 05 '21 at 07:34
  • @Tom Brunberg: VCL TArithmeticExceptionMask = 50 = exDenormalized exUnderflow exPrecision a := 1/0; raises exception and enters EXCEPT FMX TArithmeticExceptionMask = 63 = exInvalidOp exDenormalized exZeroDivide exOverflow exUnderflow exPrecision a := 1/0; dont't raises exception and does not enter EXCEPT – Peter Kloß Jun 05 '21 at 20:14
  • @Remy Lebeau & David Heffernan: I also tested with a := b / c; Where c = 0. The results are the same as a := 1/0 like on top of this question. I looked at the question mentioned from Tom Brunberg. I think the treatment of division by zero should be the same in VCL and FMX and on all platforms. – Peter Kloß Jun 05 '21 at 20:31

0 Answers0