Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

added float32 schubfach algorithm; wip #18155

Merged
merged 2 commits into from
Jun 3, 2021
Merged

added float32 schubfach algorithm; wip #18155

merged 2 commits into from
Jun 3, 2021

Conversation

Araq
Copy link
Member

@Araq Araq commented Jun 2, 2021

No description provided.

@planetis-m
Copy link
Contributor

planetis-m commented Jun 2, 2021

There is a float32 implementation of Dragonbox in fmtlib Did you miss this comment?

Alternatively you might want to try out the Schubfach implementation (float32 version, float64 version). Dragonbox is an optimized version of this algorithm.

nvm.

@@ -0,0 +1,451 @@
## Copyright 2020 Alexander Bolz
Copy link
Member

@timotheecour timotheecour Jun 2, 2021

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

as i was doing in #18008, can you add a readme.md somewhere (maybe lib/vendor/readme.md in which we can add future external dependencies under lib/vendor) to show:

  • the git repo involved, the files that were copied, and the hash at which the repo was cloned
  • the c2nim command used (i'm assuming smthg like c2nim --cpp --keepBodies -o:lib/system/schubfach.nim $Drachennest/src/schubfach_32.cc)
  • ideally, split in 2 commits, 1 with raw c2nim output (maybe marked [wip] so git bisect can learn to skip it), and one with the manual modifications, that way it's more reproducible/transparent and easier to update from upstream if needed

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good ideas, will do it maybe later. But I consider remaining bugs to be our own, not related to dragonbox/schubfach, just like we avoided certain TLSF bugs by porting over to Nim.

Copy link
Member

@timotheecour timotheecour Jun 3, 2021

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

i was referring to not just bugs but performance improvements, not that they can't be ported over again

Good ideas, will do it maybe later.

=> 282d61b

not defined(js) and defined(nimHasDragonBox):
import schubfach

proc nimFloat32ToStr(f: float32): string {.compilerproc.} =
Copy link
Member

@timotheecour timotheecour Jun 2, 2021

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

how about adding float32 overloads for addFloat, $, writeFloatToBuffer

@Araq Araq merged commit daaa409 into devel Jun 3, 2021
@Araq Araq deleted the araq-schubfach branch June 3, 2021 10:09
@timotheecour timotheecour added the TODO: followup needed remove tag once fixed or tracked elsewhere label Jun 12, 2021
PMunch pushed a commit to PMunch/Nim that referenced this pull request Mar 28, 2022
* added float32 schubfach algorithm; wip

* fixes nim-lang#18418
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
TODO: followup needed remove tag once fixed or tracked elsewhere
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants