Re: formatting a float or double in a string with all significant digits kept

2019-10-10 Thread dan via Digitalmars-d-learn
On Thursday, 10 October 2019 at 22:44:05 UTC, H. S. Teoh wrote: On Thu, Oct 10, 2019 at 09:13:05PM +, Jon Degenhardt via Digitalmars-d-learn wrote: On Thursday, 10 October 2019 at 17:12:25 UTC, dan wrote: > Thanks also berni44 for the information about the dig > attribute, Jon > for the

Re: formatting a float or double in a string with all significant digits kept

2019-10-10 Thread H. S. Teoh via Digitalmars-d-learn
On Thu, Oct 10, 2019 at 09:13:05PM +, Jon Degenhardt via Digitalmars-d-learn wrote: > On Thursday, 10 October 2019 at 17:12:25 UTC, dan wrote: > > Thanks also berni44 for the information about the dig attribute, Jon > > for the neat packaging into one line using the attribute on the > > type.

Re: formatting a float or double in a string with all significant digits kept

2019-10-10 Thread Jon Degenhardt via Digitalmars-d-learn
On Thursday, 10 October 2019 at 17:12:25 UTC, dan wrote: Thanks also berni44 for the information about the dig attribute, Jon for the neat packaging into one line using the attribute on the type. Unfortunately, the version of gdc that comes with the version of debian that i am using does not

Re: formatting a float or double in a string with all significant digits kept

2019-10-10 Thread dan via Digitalmars-d-learn
On Wednesday, 9 October 2019 at 10:54:49 UTC, David Briant wrote: On Tuesday, 8 October 2019 at 20:37:03 UTC, dan wrote: I have a double precision number that i would like to print all significant digits of, but no more than what are actually present in the number. Or more exactly, i want to

Re: formatting a float or double in a string with all significant digits kept

2019-10-09 Thread David Briant via Digitalmars-d-learn
On Tuesday, 8 October 2019 at 20:37:03 UTC, dan wrote: I have a double precision number that i would like to print all significant digits of, but no more than what are actually present in the number. Or more exactly, i want to print the minimum number of digits necessary to recover the

Re: formatting a float or double in a string with all significant digits kept

2019-10-09 Thread GreatSam4sure via Digitalmars-d-learn
On Wednesday, 9 October 2019 at 07:16:43 UTC, Jon Degenhardt wrote: On Wednesday, 9 October 2019 at 05:46:12 UTC, berni44 wrote: On Tuesday, 8 October 2019 at 20:37:03 UTC, dan wrote: But i would like to be able to do this without knowing the expansion of pi, or writing too much code,

Re: formatting a float or double in a string with all significant digits kept

2019-10-09 Thread Jon Degenhardt via Digitalmars-d-learn
On Wednesday, 9 October 2019 at 05:46:12 UTC, berni44 wrote: On Tuesday, 8 October 2019 at 20:37:03 UTC, dan wrote: But i would like to be able to do this without knowing the expansion of pi, or writing too much code, especially if there's some d function like writeAllDigits or something

Re: formatting a float or double in a string with all significant digits kept

2019-10-08 Thread berni44 via Digitalmars-d-learn
On Tuesday, 8 October 2019 at 20:37:03 UTC, dan wrote: But i would like to be able to do this without knowing the expansion of pi, or writing too much code, especially if there's some d function like writeAllDigits or something similar. You can use the property .dig to get the number of