Re: wth!! ctfe cannot format floating point at compile time?

2017-08-14 Thread Adam D. Ruppe via Digitalmars-d-learn
On Monday, 14 August 2017 at 13:11:20 UTC, Steven Schveighoffer wrote: Another reasonable idea is to have the compiler call the function for you. Yeah, I was thinking that too. Heck, the compiler prolly uses it for reading source and writing errors. Perhaps just special case hack the functio

Re: wth!! ctfe cannot format floating point at compile time?

2017-08-14 Thread Steven Schveighoffer via Digitalmars-d-learn
On 8/13/17 11:44 PM, Adam D. Ruppe wrote: On Monday, 14 August 2017 at 01:52:16 UTC, Johnson Jones wrote: pretty simply, trying to convert a floating point to a string in a ctfe function and it thinks that it is too complex to do in a ctfe, really? It uses a C function to do the conversion, w

Re: wth!! ctfe cannot format floating point at compile time?

2017-08-14 Thread Stefan Koch via Digitalmars-d-learn
On Monday, 14 August 2017 at 04:29:17 UTC, Johnson wrote: ``` auto valueToString(alias v)(){return v.stringof;} enum a = valueToString!(0.75); static assert(a == "0.75"); ``` Thanks! You'd think that to would do this internally automatically ;/ It only works on literals. valueToString!(a) wil

Re: wth!! ctfe cannot format floating point at compile time?

2017-08-13 Thread Johnson via Digitalmars-d-learn
On Monday, 14 August 2017 at 03:52:40 UTC, HypperParrow wrote: On Monday, 14 August 2017 at 01:52:16 UTC, Johnson Jones wrote: Error: uncaught CTFE exception std.format.FormatException("Cannot format floating point types at compile-time") called from here: to(0.75) pretty simply, trying to co

Re: wth!! ctfe cannot format floating point at compile time?

2017-08-13 Thread Johnson via Digitalmars-d-learn
On Monday, 14 August 2017 at 03:44:27 UTC, Adam D. Ruppe wrote: On Monday, 14 August 2017 at 01:52:16 UTC, Johnson Jones wrote: pretty simply, trying to convert a floating point to a string in a ctfe function and it thinks that it is too complex to do in a ctfe, really? It uses a C function t

Re: wth!! ctfe cannot format floating point at compile time?

2017-08-13 Thread HypperParrow via Digitalmars-d-learn
On Monday, 14 August 2017 at 01:52:16 UTC, Johnson Jones wrote: Error: uncaught CTFE exception std.format.FormatException("Cannot format floating point types at compile-time") called from here: to(0.75) pretty simply, trying to convert a floating point to a string in a ctfe function and it th

Re: wth!! ctfe cannot format floating point at compile time?

2017-08-13 Thread Adam D. Ruppe via Digitalmars-d-learn
On Monday, 14 August 2017 at 01:52:16 UTC, Johnson Jones wrote: pretty simply, trying to convert a floating point to a string in a ctfe function and it thinks that it is too complex to do in a ctfe, really? It uses a C function to do the conversion, which is not available at compile time sinc

wth!! ctfe cannot format floating point at compile time?

2017-08-13 Thread Johnson Jones via Digitalmars-d-learn
Error: uncaught CTFE exception std.format.FormatException("Cannot format floating point types at compile-time") called from here: to(0.75) pretty simply, trying to convert a floating point to a string in a ctfe function and it thinks that it is too complex to do in a ctfe, really?