first commit
This commit is contained in:
@@ -0,0 +1,31 @@
|
||||
<Project>
|
||||
|
||||
<Import Project="../Directory.Build.props" />
|
||||
|
||||
<PropertyGroup>
|
||||
<IsPackable>true</IsPackable>
|
||||
<GenerateDocumentationFile>true</GenerateDocumentationFile>
|
||||
<VersionPrefix>0.1.0</VersionPrefix>
|
||||
<VersionSuffix>dev</VersionSuffix>
|
||||
|
||||
<Authors>JustFixMe</Authors>
|
||||
<Copyright>Copyright (c) 2026 JustFixMe</Copyright>
|
||||
|
||||
<PackageTags>csharp;math;precise-math;</PackageTags>
|
||||
<PackageLicenseFile>LICENSE</PackageLicenseFile>
|
||||
<PackageReadmeFile>README.md</PackageReadmeFile>
|
||||
|
||||
<EmitCompilerGeneratedFiles Condition="'$(Configuration)'=='Debug'">true</EmitCompilerGeneratedFiles>
|
||||
</PropertyGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<InternalsVisibleTo Include="$(AssemblyName).Tests" />
|
||||
<InternalsVisibleTo Include="$(AssemblyName).Benchmarks" />
|
||||
</ItemGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<None Include="$(MSBuildThisFileDirectory)../README.md" Pack="true" PackagePath="/" />
|
||||
<None Include="$(MSBuildThisFileDirectory)../LICENSE" Pack="true" PackagePath="/" />
|
||||
</ItemGroup>
|
||||
|
||||
</Project>
|
||||
@@ -0,0 +1,66 @@
|
||||
namespace Just.PreciseMath;
|
||||
|
||||
/// <summary>
|
||||
/// Represents higher precision floating point type
|
||||
/// </summary>
|
||||
/// <remarks>
|
||||
/// Constructs new DoubleDouble from given low and high components
|
||||
/// </remarks>
|
||||
public readonly struct DoubleDouble : IEquatable<DoubleDouble>, IEqualityOperators<DoubleDouble, DoubleDouble, bool>
|
||||
{
|
||||
internal readonly double _high;
|
||||
internal readonly double _low;
|
||||
|
||||
// No normalization, for internal use only
|
||||
internal DoubleDouble(double high, double low)
|
||||
{
|
||||
_high = high;
|
||||
_low = low;
|
||||
}
|
||||
|
||||
#region Static constants
|
||||
/// <summary>
|
||||
/// Represents a value that is not a number (NaN).
|
||||
/// </summary>
|
||||
public static DoubleDouble NaN => new(double.NaN, double.NaN);
|
||||
/// <summary>
|
||||
/// Represents a unit value.
|
||||
/// </summary>
|
||||
public static DoubleDouble One => new(1.0, 0);
|
||||
/// <summary>
|
||||
/// Represents a zero value.
|
||||
/// </summary>
|
||||
public static DoubleDouble Zero => new();
|
||||
#endregion
|
||||
|
||||
/// <summary>
|
||||
/// High part of DoubleDouble
|
||||
/// </summary>
|
||||
public readonly double High => _high;
|
||||
/// <summary>
|
||||
/// Low part of DoubleDouble
|
||||
/// </summary>
|
||||
public readonly double Low => _low;
|
||||
|
||||
|
||||
/// <inheritdoc/>
|
||||
[Pure]
|
||||
public bool Equals(DoubleDouble other) => _high == other._high && _low == other._low;
|
||||
/// <inheritdoc/>
|
||||
[Pure]
|
||||
public override bool Equals(object? obj) => obj is DoubleDouble other && this.Equals(other);
|
||||
/// <inheritdoc/>
|
||||
[Pure]
|
||||
public override int GetHashCode() => HashCode.Combine(_high, _low);
|
||||
|
||||
/// <summary>
|
||||
/// TODO: fill
|
||||
/// </summary>
|
||||
[Pure, MethodImpl(MethodImplOptions.AggressiveInlining)]
|
||||
public static bool operator ==(DoubleDouble left, DoubleDouble right) => left.Equals(right);
|
||||
/// <summary>
|
||||
/// TODO: fill
|
||||
/// </summary>
|
||||
[Pure, MethodImpl(MethodImplOptions.AggressiveInlining)]
|
||||
public static bool operator !=(DoubleDouble left, DoubleDouble right) => !left.Equals(right);
|
||||
}
|
||||
@@ -0,0 +1,15 @@
|
||||
<Project Sdk="Microsoft.NET.Sdk">
|
||||
|
||||
<PropertyGroup>
|
||||
<AssemblyName>Just.PreciseMath</AssemblyName>
|
||||
<RootNamespace>Just.PreciseMath</RootNamespace>
|
||||
|
||||
<Description>A .NET library for extended-precision floating-point arithmetic using double-double representations and common mathematical functions.</Description>
|
||||
</PropertyGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<Using Include="System.Numerics"/>
|
||||
<Using Include="System.Diagnostics.Contracts"/>
|
||||
<Using Include="System.Runtime.CompilerServices"/>
|
||||
</ItemGroup>
|
||||
</Project>
|
||||
Reference in New Issue
Block a user