Download Reference Manual
The Developer's Library for D
About Wiki Forums Source Search Contact

Ticket #312 (new task)

Opened 17 years ago

Last modified 16 years ago

80bit FP format & parse routines

Reported by: kris Assigned to: Don Clugston
Priority: normal Milestone: 1.0
Component: Core Functionality Version:
Keywords: FP format triage Cc:

Description

module tango.text.locale.Convert has an interesting toDouble() algorithm -- can this be easily extended to 80bit?

The same module also uses ecvt() to convert double to char[]. Would be nice to get an 80bit version of ecvt() also?

Change History

03/05/07 07:49:29 changed by Don Clugston

That's a great start. The question is, can it be extended to 80 bits without making the table of powers of 10 absurdly large? I need to think about that.

A couple of interesting points: * Something which is supposed to happen when converting from text to float (which DMD currently does not do correctly) is that if the number of decimal digits exceeds real.dig, the decimal number should be rounded to real.dig digits in decimal, before any conversion occurs. (This means that if x>y, then the binary representation of x is NEVER smaller than the binary representation of y -- a very important property to maintain!) * I really don't know what to do about reading in NaN payloads. * This is a perfect situation for test-driven development!

04/09/07 18:56:29 changed by larsivi

Any news on this?

04/13/07 20:37:13 changed by larsivi

  • milestone changed from 0.97 RC 1 to 0.98 RC 2.

05/09/07 06:48:27 changed by Don Clugston

  • milestone changed from 0.98 RC 2 to 0.99 RC3.

Doing this properly involves a huge amount of work, and I don't have the time to do it. (It involves reinventing a very complicated wheel...) I have made some progress, but it will be a long time before it's complete. Pushing this back to the next release.

05/09/07 16:34:21 changed by kris

Don,

Perhaps we should consider a different approach? Just trying to consider options ...

07/03/07 03:00:11 changed by kris

  • milestone changed from 0.99 RC3 to 1.0.

Hiya Don

I'm moving six of your tickets to 1.0, since the release is already late. Can you enable some traction on these tickets, please? Some of them, I don't know what to do with. Perhaps you do?

07/04/07 12:43:05 changed by Don Clugston

The same module also uses ecvt() to convert double to char[]. Would be nice to get an 80bit version of ecvt() also?

stdlib.h is supposed to contain ecvtl(), which should cover the 80-bit case. Likewise, we should be able to use strtold() to convert text -> real80. Then, we just need to filter out the NaN and infinity case.

Note: It's actually quite important that the values for NaN and infinity be locale-independent, so that values can be interchanged without knowing the locale. If a user wants something different, they should intercept the values beforehand. Eg, they might want an infinity symbol. This is no different to displaying 2.3e-5 as 2.3 x 10-5.

03/26/08 23:28:20 changed by larsivi

Any status on this?

05/24/08 23:20:24 changed by larsivi

  • keywords changed from FP format to FP format triage.