Jump to page: 1 27  
Page
Thread overview
Printing floating points
Jan 21, 2021
deadalnix
Jan 21, 2021
Stefan Koch
Jan 21, 2021
jmh530
Jan 22, 2021
deadalnix
Jan 25, 2021
Walter Bright
Jan 21, 2021
Berni44
Jan 22, 2021
Walter Bright
Jan 22, 2021
Imperatorn
Jan 22, 2021
Paul Backus
Jan 22, 2021
deadalnix
Jan 23, 2021
deadalnix
Jan 26, 2021
Berni44
Jan 27, 2021
Bruce Carneal
Jan 27, 2021
Paul Backus
Jan 27, 2021
Bruce Carneal
Jan 27, 2021
Berni44
Jan 27, 2021
Bruce Carneal
Jan 27, 2021
Berni44
Jan 27, 2021
H. S. Teoh
Jan 27, 2021
Walter Bright
Jan 27, 2021
H. S. Teoh
Jan 27, 2021
Walter Bright
Jan 28, 2021
H. S. Teoh
Jan 22, 2021
deadalnix
Jan 25, 2021
Walter Bright
Jan 25, 2021
Bruce Carneal
Jan 26, 2021
Bruce Carneal
Jan 26, 2021
John Colvin
Jan 26, 2021
Bruce Carneal
Jan 26, 2021
Bruce Carneal
Jan 27, 2021
Bruce Carneal
Jan 27, 2021
Bruce Carneal
Jan 27, 2021
Bruce Carneal
Jan 28, 2021
Bruce Carneal
Jan 28, 2021
Bruce Carneal
Jan 28, 2021
Bruce Carneal
Jan 29, 2021
Bruce Carneal
Jan 29, 2021
Bruce Carneal
Jan 29, 2021
sarn
Jan 30, 2021
Afgdr
Jan 30, 2021
Afgdr
Jan 28, 2021
Bruce Carneal
Jan 26, 2021
Bruce Carneal
January 21, 2021
https://forum.dlang.org/post/r1hsv2$tt0$1@digitalmars.com

On Thursday, 6 February 2020 at 20:29:31 UTC, Walter Bright wrote:
> This one is always going to be a tough one:
>
> https://github.com/dlang/phobos/pull/7264
>
> Floating point code is extremely difficult to get right, and contains a lot of very subtle traps for the unwary. (It's why people are still writing research papers on formatting floating point numbers.) If there's a mistake in it that subtly breaks someone's floating point code, it would cause them to not trust D. Just finding someone capable of reviewing it thoroughly would be very difficult for any community.
>

While we are on this, I should point out that there has been a major breakthrough on the matter fairly recently called ryu.

I invite everyone who has an interest in printing floating to look at it. Here are a few useful links:

The original paper: https://dl.acm.org/doi/pdf/10.1145/3296979.3192369
Another paper: https://dl.acm.org/doi/pdf/10.1145/3360595

Source code in various languages: https://github.com/ulfjack/ryu

January 21, 2021
On Thursday, 21 January 2021 at 14:02:52 UTC, deadalnix wrote:
> https://forum.dlang.org/post/r1hsv2$tt0$1@digitalmars.com
>
> On Thursday, 6 February 2020 at 20:29:31 UTC, Walter Bright wrote:
>>[...]
>
> While we are on this, I should point out that there has been a major breakthrough on the matter fairly recently called ryu.
>
> I invite everyone who has an interest in printing floating to look at it. Here are a few useful links:
>
> The original paper: https://dl.acm.org/doi/pdf/10.1145/3296979.3192369
> Another paper: https://dl.acm.org/doi/pdf/10.1145/3360595
>
> Source code in various languages: https://github.com/ulfjack/ryu

I think Ilya has implemented this in mir already.
ryu is less of a breakthrough imo.
It's a modification of grisu2 (hence the name ryu (dragon in Japanese))
January 21, 2021
On Thursday, 21 January 2021 at 14:02:52 UTC, deadalnix wrote:
> While we are on this, I should point out that there has been a major breakthrough on the matter fairly recently called ryu.

This is well known to me (I wrote PR 7264). Unfortunately ryu and
format("%f") have different goals, so ryu cannot be used there.
Anyway, I have some ideas of extending the abilities of format,
where ryu (or a similiar algorithm) might make it into phobos.
But don't expect this to happen too soon.

As far as I know, there are allready several implementations of
ryu in D available.

Berni
January 21, 2021
On Thursday, 21 January 2021 at 14:13:32 UTC, Stefan Koch wrote:
> [snip]
>
> I think Ilya has implemented this in mir already.
> ryu is less of a breakthrough imo.
> It's a modification of grisu2 (hence the name ryu (dragon in Japanese))

Discussed here
https://forum.dlang.org/thread/yobmmccdvbmmbaolehbs@forum.dlang.org
January 22, 2021
On 1/21/2021 6:02 AM, deadalnix wrote:
> Source code in various languages: https://github.com/ulfjack/ryu

It's Boost licensed, yay!

Who wants to get the leet street cred for integrating this into dmd?
January 22, 2021
On Thursday, 21 January 2021 at 14:13:32 UTC, Stefan Koch wrote:
> I think Ilya has implemented this in mir already.
> ryu is less of a breakthrough imo.
> It's a modification of grisu2 (hence the name ryu (dragon in Japanese))

ryu pushes thing forward significantly, and proved it was correct to do so. I can't stress enough the importance of that last part, because there are no way you can check all possible double values by yourself and see if the output is correct.
January 22, 2021
On 1/22/21 4:33 AM, Walter Bright wrote:
> On 1/21/2021 6:02 AM, deadalnix wrote:
>> Source code in various languages: https://github.com/ulfjack/ryu
> 
> It's Boost licensed, yay!
> 
> Who wants to get the leet street cred for integrating this into dmd?

I believe Berni44 has already made a PR for this (and did so a while ago).

Original PR: https://github.com/dlang/phobos/pull/7264 (includes a nice paper on what he did)

New PR: https://github.com/dlang/phobos/pull/7757

Or maybe I misunderstand what he did. I can't make heads or tails of this stuff.

Amaury, can you take a look at that PR?

-Steve
January 22, 2021
On Friday, 22 January 2021 at 14:02:53 UTC, Steven Schveighoffer wrote:
> On 1/22/21 4:33 AM, Walter Bright wrote:
>> On 1/21/2021 6:02 AM, deadalnix wrote:
>>> Source code in various languages: https://github.com/ulfjack/ryu
>> 
>> It's Boost licensed, yay!
>> 
>> Who wants to get the leet street cred for integrating this into dmd?
>
> I believe Berni44 has already made a PR for this (and did so a while ago).
>
> Original PR: https://github.com/dlang/phobos/pull/7264 (includes a nice paper on what he did)
>
> New PR: https://github.com/dlang/phobos/pull/7757
>
> Or maybe I misunderstand what he did. I can't make heads or tails of this stuff.
>
> Amaury, can you take a look at that PR?
>
> -Steve

Interesting, doesn't seem to be ryu though
January 22, 2021
On Friday, 22 January 2021 at 16:42:20 UTC, Imperatorn wrote:
>
> Interesting, doesn't seem to be ryu though

From the linked PDF [1]:

> Ryu and other fast algorithms have been rejected, because they cannot be used for printf-like functions due to a different design goal.

According to the Ryu README on Github [2], "Ryu generates the shortest decimal representation of a floating point number that maintains round-trip safety." For printf, the user is allowed to specify things like the precision, the field width, and whether leading zeros should be used for padding, so a more flexible algorithm is needed.

[1] https://raw.githubusercontent.com/berni44/printFloat/master/printFloat.pdf
[2] https://github.com/ulfjack/ryu
January 22, 2021
On Friday, 22 January 2021 at 14:02:53 UTC, Steven Schveighoffer wrote:
> I believe Berni44 has already made a PR for this (and did so a while ago).
>
> Original PR: https://github.com/dlang/phobos/pull/7264 (includes a nice paper on what he did)
>
> New PR: https://github.com/dlang/phobos/pull/7757
>
> Or maybe I misunderstand what he did. I can't make heads or tails of this stuff.
>
> Amaury, can you take a look at that PR?
>
> -Steve

I looked. i can tell you it is not ryu. I would need to dive much deeper into it to be confident to include this.
« First   ‹ Prev
1 2 3 4 5 6 7