Uploaded image for project: 'Thrift'
  1. Thrift
  2. THRIFT-3456

rounding issue in static assert

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Closed
    • Major
    • Resolution: Fixed
    • None
    • 0.10.0
    • D - Compiler
    • None

    Description

      thrift.codegen.idlgen

      static assert(structIdlString!WithDefaults ==
      `struct WithDefaults {
      -1: string a = "asdf",
      -2: double b = 3.1415,
      1: WithoutMeta c =

      {a: "foo", b: 3, }

      ,
      }
      `);

      This assert fails for me, because struct contains double b = 3.1414999...999
      I suggest replace 3.1415 with 1.0e+20
      This value is free from rounding issues.

      FYI
      thrift.internal.ctfe contains similar unit test, but it is not use strict match:
      static assert(ctfeToString(3.1415).startsWith("3.141"));

      Create pull request: https://github.com/apache/thrift/pull/720

      Attachments

        Activity

          People

            sibnick Tolstokulakov Nikolay
            sibnick Tolstokulakov Nikolay
            Votes:
            0 Vote for this issue
            Watchers:
            3 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: