Author Topic: if-elseif Mab's macros for floating comparisons  (Read 161 times)

HSE

  • Member
  • *****
  • Posts: 1407
  • <AMD>< 7-32>
if-elseif Mab's macros for floating comparisons
« on: September 08, 2020, 08:54:30 AM »
Hi all!

Some extension of Mabdelouahab's macros that allow floating point numbers comparisons for conditional flow easily (usually it's not so simple because early expansion).

Code: [Select]
  mov wParam, 1
    mov pMsg, WM_PAINT
    mov lParam, 3

    fSlv8 alor1 = 1.5
    fSlv8 alor2 = 2.2

    @if wParam eq 1
      @if lParam ne 3 || pMsg eq WM_COMMAND
        @if wParam gt 1 || wParam lt 4
          print "  ----------------------------------------",13,10
          print "  Ain't Mabdelouahab's runtime comparisons great",13,10
          print "  ----------------------------------------",13,10
        @endif
      @elseif alor1 fGT 1.0 && alor2 fNE 2.0
          print "  ----------------------------------------",13,10
          print "  Is working? Yes",13,10
          print "  ----------------------------------------",13,10
      @else
          print "  ----------------------------------------",13,10
          print "  Nothing ",13,10
          print "  ----------------------------------------",13,10
      @endif
    @endif
   

I was developing almost exactly the same :biggrin:, but discovery of Mab's macros save me to make most difficult part (comparison expansion)  :thumbsup: