On Tuesday, 7 July 2020 at 16:38:39 UTC, kinke wrote:
On Saturday, 4 July 2020 at 20:35:48 UTC, Walter Bright wrote:
On 6/21/2020 8:24 AM, 9il wrote:
[...]

Great work! Would you like to add it to dmd?

AFAIU, the 'problem' is that *all* floating-point literals are parsed as real_t values, which for DMD is x87 real (usually using the host C runtime's `strtold`). When emitting them as double or float literals, the compiler converts these values to a lower precision, where the increased intermediate precision might break the 'banker's rule'.

So wouldn't the trivial 'fix' be using `strtod` for double literals and `strtof` for floats? [For LDC, we wouldn't rely on the host C runtime or a mir implementation, but use LLVM facilities anyway.]

This should work if the C runtime handles the values correctly. Does this actually mean DMD wouldn't be able to compile itself with DigigtalMars C runtime?
              • ... Steven Schveighoffer via Digitalmars-d-announce
              • ... John Colvin via Digitalmars-d-announce
              • ... H. S. Teoh via Digitalmars-d-announce
              • ... Steven Schveighoffer via Digitalmars-d-announce
              • ... H. S. Teoh via Digitalmars-d-announce
              • ... 9il via Digitalmars-d-announce
              • ... Adam D. Ruppe via Digitalmars-d-announce
              • ... Dibyendu Majumdar via Digitalmars-d-announce
              • ... Joseph Rushton Wakeling via Digitalmars-d-announce
    • Re: Decimal string... kinke via Digitalmars-d-announce
      • Re: Decimal st... 9il via Digitalmars-d-announce
  • Re: Decimal string to f... Walter Bright via Digitalmars-d-announce

Reply via email to