Skip to content

Commit

Permalink
Initial commit
Browse files Browse the repository at this point in the history
  • Loading branch information
tk-yoshimura committed May 21, 2024
0 parents commit 57f01ab
Show file tree
Hide file tree
Showing 23 changed files with 88,185 additions and 0 deletions.
2 changes: 2 additions & 0 deletions .gitattributes
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
# Auto detect text files and perform LF normalization
* text=auto
61 changes: 61 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,61 @@
# User-specific files
*.rsuser
*.suo
*.user
*.userosscache
*.sln.docstates
*.userprefs

# Images
*.png
*.jpg
*.jpeg
*.bmp
*.webp

# WinMarge backups
*.bak

# Cache/Options directory
/.vs
/dll

# NuGet Packages
*.nupkg
*.snupkg
/**/[Pp]ackages/*

# Build results
/**/[Bb]in/
/**/[Oo]bj/
/**/[Ll]og/
/**/[Ll]ogs/
/**/bld/

# MSTest test Results
[Tt]est[Rr]esult*/
[Bb]uild[Ll]og.*

# Publish
/**/publish/
/**/PublishProfiles
*.[Pp]ublish.xml
*.azurePubxml
*.pubxml
*.publishproj

# Python cache
/**/__pycache__
*.pyc

# Other
nuget.exe
nugetpack.bat
/**/*.nuspec
/**/*.nupkg

results/*

# Resource AutoGen

# Safelist
38 changes: 38 additions & 0 deletions HoltsmarkDistributionFP64.sln
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@

Microsoft Visual Studio Solution File, Format Version 12.00
# Visual Studio Version 17
VisualStudioVersion = 17.9.34902.65
MinimumVisualStudioVersion = 10.0.40219.1
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "HoltsmarkDistributionFP64", "HoltsmarkDistributionFP64\HoltsmarkDistributionFP64.csproj", "{779AFDAF-D840-4312-8E14-38F99C6D79A0}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "HoltsmarkDistributionFP64Tests", "HoltsmarkDistributionFP64Tests\HoltsmarkDistributionFP64Tests.csproj", "{31B346D8-0C93-4F67-BD3C-A3D5453906B7}"
ProjectSection(ProjectDependencies) = postProject
{779AFDAF-D840-4312-8E14-38F99C6D79A0} = {779AFDAF-D840-4312-8E14-38F99C6D79A0}
EndProjectSection
EndProject
Project("{888888A0-9F3D-457C-B088-3A5042F75D52}") = "HoltsmarkDistributionFP64ErrorVis", "HoltsmarkDistributionFP64ErrorVis\HoltsmarkDistributionFP64ErrorVis.pyproj", "{706E3B32-B70A-4A14-9B26-DC8D696F1DBA}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Any CPU = Debug|Any CPU
Release|Any CPU = Release|Any CPU
EndGlobalSection
GlobalSection(ProjectConfigurationPlatforms) = postSolution
{779AFDAF-D840-4312-8E14-38F99C6D79A0}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{779AFDAF-D840-4312-8E14-38F99C6D79A0}.Debug|Any CPU.Build.0 = Debug|Any CPU
{779AFDAF-D840-4312-8E14-38F99C6D79A0}.Release|Any CPU.ActiveCfg = Release|Any CPU
{779AFDAF-D840-4312-8E14-38F99C6D79A0}.Release|Any CPU.Build.0 = Release|Any CPU
{31B346D8-0C93-4F67-BD3C-A3D5453906B7}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{31B346D8-0C93-4F67-BD3C-A3D5453906B7}.Debug|Any CPU.Build.0 = Debug|Any CPU
{31B346D8-0C93-4F67-BD3C-A3D5453906B7}.Release|Any CPU.ActiveCfg = Release|Any CPU
{31B346D8-0C93-4F67-BD3C-A3D5453906B7}.Release|Any CPU.Build.0 = Release|Any CPU
{706E3B32-B70A-4A14-9B26-DC8D696F1DBA}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{706E3B32-B70A-4A14-9B26-DC8D696F1DBA}.Release|Any CPU.ActiveCfg = Release|Any CPU
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
EndGlobalSection
GlobalSection(ExtensibilityGlobals) = postSolution
SolutionGuid = {4515B9EB-0868-42AE-8D66-343BDD6FC243}
EndGlobalSection
EndGlobal
25 changes: 25 additions & 0 deletions HoltsmarkDistributionFP64/ApproxUtil.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
using System.Collections.ObjectModel;
using System.Diagnostics;

namespace HoltsmarkDistributionFP64.InternalUtils {
internal static class ApproxUtil {

public static double Pade(double x, (ReadOnlyCollection<double> numer, ReadOnlyCollection<double> denom) table) {
double sc = Poly(x, table.numer), sd = Poly(x, table.denom);

Debug.Assert(sd >= 0.5, $"pade denom digits loss! {x}");

return sc / sd;
}

public static double Poly(double x, ReadOnlyCollection<double> table) {
double s = table[^1];

for (int i = table.Count - 2; i >= 0; i--) {
s = s * x + table[i];
}

return s;
}
}
}
27 changes: 27 additions & 0 deletions HoltsmarkDistributionFP64/ExMath.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
using static System.Double;

namespace HoltsmarkDistributionFP64 {
internal static class ExMath {

public static double Square(double x) => x * x;
public static double Cube(double x) => x * x * x;

public static double Pow3d2(double x) {
if (x == 0d || !IsFinite(x) || int.Abs(double.ILogB((double)x)) < 320) {
return Sqrt(Cube(x));
}
else {
return Cube(Sqrt(x));
}
}

public static double Pow2d3(double x) {
if (x == 0d || !IsFinite(x) || int.Abs(double.ILogB((double)x)) < 480) {
return Cbrt(Square(x));
}
else {
return Square(Cbrt(x));
}
}
}
}
Loading

0 comments on commit 57f01ab

Please sign in to comment.