forked from nim-lang/Nim
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
2ea8423
commit 097fc18
Showing
11 changed files
with
2,240 additions
and
68 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
// Copyright 2020 Alexander Bolz | ||
// | ||
// Distributed under the Boost Software License, Version 1.0. | ||
// (See accompanying file LICENSE_1_0.txt or copy at https://www.boost.org/LICENSE_1_0.txt) | ||
|
||
#pragma once | ||
|
||
namespace dragonbox { | ||
|
||
// char* output_end = Dtoa(buffer, value); | ||
// | ||
// Converts the given double-precision number into decimal form and stores the result in the given | ||
// buffer. | ||
// | ||
// The buffer must be large enough, i.e. >= DtoaMinBufferLength. | ||
// The output format is similar to printf("%g"). | ||
// The output is _not_ null-terminted. | ||
// | ||
// The output is optimal, i.e. the output string | ||
// 1. rounds back to the input number when read in (using round-to-nearest-even) | ||
// 2. is as short as possible, | ||
// 3. is as close to the input number as possible. | ||
// | ||
// Note: | ||
// This function may temporarily write up to DtoaMinBufferLength characters into the buffer. | ||
|
||
constexpr int DtoaMinBufferLength = 64; | ||
|
||
char* Dtoa(char* buffer, double value); | ||
|
||
} // namespace dragonbox |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
#include "schubfach_32.h" | ||
#include "schubfach_64.h" | ||
#include "dragonbox.h" | ||
|
||
extern "C" char* nimtoStringDragonboxImplDouble(char* buffer, double value){ | ||
return dragonbox::Dtoa(buffer, value); | ||
} | ||
|
||
extern "C" char* nimSchubfachFtoa(char* buffer, float value){ | ||
return schubfach::Ftoa(buffer, value); | ||
} | ||
|
||
extern "C" char* nimSchubfachDtoa(char* buffer, double value){ | ||
return schubfach::Dtoa(buffer, value); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,3 @@ | ||
# files | ||
dragonbox.cc: adapted from https://github.com/abolz/Drachennest/blob/master/src/dragonbox.cc | ||
LICENSE.txt: copied from https://github.com/abolz/Drachennest/blob/master/LICENSE | ||
dragonbox.*,schubfach_32.*: adapted from https://github.com/abolz/Drachennest/blob/master/src/dragonbox.cc |
Oops, something went wrong.