Last update November 2, 2007

Doc Comments / Phobos /
Std Conv



Difference (last change) (Author, normal page display)

Changed: 27,30c27,29
*Corresponding page in the D Specification
** D 1.x
** D 2.x

* Corresponding page in the D Specification:
** D 1.x
** D 2.x

std.conv

Comments

Add your comments here...

Extending std.conv with floating-point wrapper functions

I was looking into the std.conv module the other evening, and I had thought it had conversion functions for all of the D numerical types, but sadly I discovered that it only did the whole-number types. So the next evening I looked around and found std.string.atof() that does only float and double, and std.math2's "real atof( in char[] )" function, which does a pretty good job with float, double, and real right out of the box. With a bit of playing around with std.math2 yet the next evening I managed to make some useful wrapper functions that worked well with D's remaining floating-point types: ifloat, idouble, ireal, cfloat, cdouble, and creal.

I really think it would be great if Walter would add these functions, or functions like these to the std.conv before D v1.0. It would make std.conv more complete, and on top of that, it would save a person's time looking all around for functions to convert number-types that were converted with std.string.toString() functions back to their original D's numerical value(s).

...

Source: NG:digitalmars.D/12382

D 1.x/2.x Differences

Some templates (e.g. to, roundTo, parse) have been added to the D 2.x version. The std2 project contains a port for D 1.x.

Links


FrontPage | News | TestPage | MessageBoard | Search | Contributors | Folders | Index | Help | Preferences | Edit

Edit text of this page (date of last change: November 2, 2007 16:51 (diff))