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

Release 1.0.0 with multiplication optimization #78

Merged
merged 53 commits into from
Jun 29, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
53 commits
Select commit Hold shift + click to select a range
a8b6656
Merge pull request #71 from epam/release
agdavydov81 Jan 16, 2023
0200c05
Add VTA compatibility test: as a separate task, with out relation to …
agdavydov81 Jan 18, 2023
7e05c6e
VTA test: Fix json name.
agdavydov81 Jan 18, 2023
a4acbb2
Java: Enable VTA compatibility test.
agdavydov81 Jan 23, 2023
32b5db5
doc: Update FAQ, Javadoc, and C# about the sign check.
agdavydov81 Jan 27, 2023
ee982d1
Java: Small comparison operation speedup.
Feb 2, 2023
ed02024
Java: Speedup isGreater
Feb 2, 2023
3a9602f
Java: Enhance data generation for comparison benchmark
agdavydov81 Feb 3, 2023
d8fb3ce
Merge pull request #73 from epam/cmp-speedup
agdavydov81 Feb 3, 2023
f6f70e3
Java: VTA: Remove redundant tryParseChecked function. (It was added e…
agdavydov81 Feb 3, 2023
1c45a26
Java: optimize unsigned long comparison with mask 0x0003ffffffffffffL
agdavydov81 Feb 8, 2023
460dc02
Java: optimize UnsignedLong.isGreater with non-canonical format
agdavydov81 Feb 8, 2023
2030e3d
Java: optimize UnsignedLong.isGreater with non-canonical format
agdavydov81 Feb 8, 2023
9f813c1
Java: optimize UnsignedLong.isGreater with non-canonical format
agdavydov81 Feb 8, 2023
3b9d7c7
Java: optimize UnsignedLong.isGreater with non-canonical format
agdavydov81 Feb 8, 2023
9c37f19
Java: optimize UnsignedLong.isGreater with non-canonical format
agdavydov81 Feb 8, 2023
18a18dc
Java: optimize UnsignedLong.isGreater with non-canonical format
agdavydov81 Feb 8, 2023
e652653
Java: Add tests on UnsignedLong speedup.
agdavydov81 Feb 9, 2023
c168682
Merge pull request #74 from epam/unsigned-long-speedup
agdavydov81 Feb 9, 2023
bcb7990
Java: optimize UnsignedLong.isGreater with non-canonical format
agdavydov81 Feb 10, 2023
e6d1225
Update FAQ.md
andymalakov Feb 14, 2023
42c1e38
Update README.md
andymalakov Feb 15, 2023
fa8efdc
Speed up `JavaImpl.canonizeFinite`
plokhotnyuk Jun 16, 2023
d65e285
Enhance fast div10 code.
agdavydov81 Jun 22, 2023
b8654f3
Enhance CanonizeBenchmark with fast div10 operation.
agdavydov81 Jun 22, 2023
b09168b
Add test for fast div10 acceptable range.
agdavydov81 Jun 22, 2023
f39cd5e
Java: Speedup fromDecimalDouble
agdavydov81 Jun 22, 2023
698c6ec
Java: Add fromDecimalDouble benchmark.
agdavydov81 Jun 22, 2023
29c1070
Fix fast division typo.
agdavydov81 Jun 22, 2023
0552325
Java: Tiny speedup: replace UnsignedLong.isGreater(x, 0) with x!=0 (E…
agdavydov81 Jun 23, 2023
fb66141
Java: Initial version of the multi-release JAR
agdavydov81 Jun 26, 2023
b58c6b4
Java: Update to minimal version 8.
agdavydov81 Jun 26, 2023
0040c04
Java: Add multiplication benchmark.
agdavydov81 Jun 26, 2023
799c2a1
Java: Fix sourceCompatibility
agdavydov81 Jun 26, 2023
31034aa
Java: Fix JMH
agdavydov81 Jun 26, 2023
b59571a
CI: Update Java version
agdavydov81 Jun 27, 2023
7fb07db
Merge branch 'mrjar' of https://github.com/epam/DFP into mrjar
agdavydov81 Jun 27, 2023
1dbbe96
Java: Make task for the tests compilation to jars.
agdavydov81 Jun 27, 2023
47d15cd
Java: Initial version of the tests run from JARs
agdavydov81 Jun 28, 2023
4cdba97
Java: Fix runTestJars task
agdavydov81 Jun 28, 2023
7fd89cd
Java: Downgrade to gradle 7.6.1 for JDK 1.7 support
agdavydov81 Jun 28, 2023
5bacf6d
CI: Java: Split compilation and run tests for different JDK versions
agdavydov81 Jun 28, 2023
bd0f6df
CI: Fix Java artifact name
agdavydov81 Jun 28, 2023
47382bc
CI: Fix dependency
agdavydov81 Jun 28, 2023
d34d705
CI: Java: Update Release tests
agdavydov81 Jun 28, 2023
4d09aa7
Java: Replace direct __mul_64x64_to_128 substitutions with Mul64Impl.…
agdavydov81 Jun 28, 2023
11b6e08
Java: Replace some other 64*64 multiplications.
agdavydov81 Jun 28, 2023
8593ac4
Java: Tiny code optimization and clearing.
agdavydov81 Jun 28, 2023
97bf452
Java: Enhance code.
agdavydov81 Jun 28, 2023
31e0f94
Java: Replace next part of 64*64 multiplications
agdavydov81 Jun 28, 2023
44dff61
Java: Replace last 64*64 multiplications.
agdavydov81 Jun 28, 2023
6966aff
Update version to 1.0.0
agdavydov81 Jun 28, 2023
60c59e0
Merge pull request #77 from epam/mrjar
agdavydov81 Jun 28, 2023
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
26 changes: 11 additions & 15 deletions .github/workflows/Build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -146,18 +146,22 @@ jobs:
uses: actions/setup-java@v3
with:
distribution: 'adopt'
java-version: '8'
java-version: '19'
- name: build
run: |
./gradlew jar
./gradlew javadocJar
./gradlew copyTestJars
- uses: actions/upload-artifact@v3
with:
name: java-jars
path: |
./*java/dfp/build/libs/*
./*java/dfp-math/build/libs/*
./*java/decimalDemo/build/libs/*
./*java/dfp/testLibs/*
./*java/dfp-math/testLibs/*
./*java/dfpNativeTests/testLibs/*
./*java/vtaTest/testLibs/*
retention-days: 7

build-dotnet:
Expand Down Expand Up @@ -190,20 +194,20 @@ jobs:

test-java:
runs-on: ${{ matrix.os }}
needs: [compress-native]
needs: [build-java]
strategy:
fail-fast: false
matrix:
os: [ 'ubuntu-latest', 'windows-2019', 'macos-latest']
java: [ '8', '11', '15']
java: [ '8', '11', '19']
steps:
- uses: actions/checkout@v3
with:
submodules: 'recursive'
- name: Download compress-native artifacts
- name: Download java-jars artifacts
uses: actions/download-artifact@v3
with:
name: compress-native
name: java-jars
- name: Setup java
uses: actions/setup-java@v3
with:
Expand All @@ -214,15 +218,7 @@ jobs:
./gradlew :java:systemInfo:runSystemInfo
- name: test
run: |
./gradlew check
- name: Upload test results on failure
uses: actions/upload-artifact@v3
if: ${{ failure() }}
with:
path: |
java/dfp/build/reports/*
java/dfp-math/build/reports/*
name: Java-{{ matrix.java }}-${{ matrix.os }}-TestReports
./gradlew runTestJars

test-dotnet:
runs-on: ${{ matrix.os }}
Expand Down
16 changes: 10 additions & 6 deletions .github/workflows/CI.yml
Original file line number Diff line number Diff line change
Expand Up @@ -190,18 +190,22 @@ jobs:
uses: actions/setup-java@v3
with:
distribution: 'adopt'
java-version: '8'
java-version: '19'
- name: build
run: |
./gradlew jar
./gradlew javadocJar
./gradlew copyTestJars
- uses: actions/upload-artifact@v3
with:
name: java-jars
path: |
./*java/dfp/build/libs/*
./*java/dfp-math/build/libs/*
./*java/decimalDemo/build/libs/*
./*java/dfp/testLibs/*
./*java/dfp-math/testLibs/*
./*java/dfpNativeTests/testLibs/*
./*java/vtaTest/testLibs/*
retention-days: 7


Expand Down Expand Up @@ -236,15 +240,15 @@ jobs:

test-java:
runs-on: ubuntu-latest
needs: [compress-native]
needs: [build-java]
steps:
- uses: actions/checkout@v3
with:
submodules: 'recursive'
- name: Download compress-native artifacts
- name: Download java-jars artifacts
uses: actions/download-artifact@v3
with:
name: compress-native
name: java-jars
- name: Setup java
uses: actions/setup-java@v3
with:
Expand All @@ -255,7 +259,7 @@ jobs:
./gradlew :java:systemInfo:runSystemInfo
- name: test
run: |
./gradlew check
./gradlew runTestJars


test-dotnet:
Expand Down
13 changes: 2 additions & 11 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -43,23 +43,14 @@ DFP was inspired on [Intel Decimal Floating-Point Math Library](https://software

## Supported platforms

The Java DFP library does not contain native code, so all the JRE platforms must be supported.
DFP for Java runs on all platforms where Java is supported.

The Java DFP-Math library supports next platforms:
DFP for .NET supports the following platforms:
* x86-64 (Windows, Linux, Mac)
* x86 (Windows, Linux)
* arm64 (Linux, Mac)
* arm7 (Linux)

The .NET DFP and DFP-Math libraries supports next platforms:
* x86-64 (Windows, Linux, Mac)
* x86 (Windows, Linux)
* arm64 (Linux, Mac)
* arm7 (Linux)

Linux Note: The Alpine Linux and other Linux distributions for the x86-64 platform are supported out of the box because the musl libc is statically linked with the native library. Other platforms require glibc.

Mac Note: The Mac on the Apple M1 platform for now is supported through Rosetta application compatibility layer. We plan to support native arm64 platform in the future releases.

## Credits

Expand Down
57 changes: 57 additions & 0 deletions csharp/EPAM.Deltix.DFP/Decimal64.cs
Original file line number Diff line number Diff line change
Expand Up @@ -314,26 +314,51 @@ public static explicit operator Decimal64(Decimal value)

#region Classification

/// <summary>
/// Returns <code>true</code> if the supplied <code>DFP</code> value equals dedicated <code>NULL</code> constant
/// (in the range of the NaN values) that imply null reference of type <see cref="Decimal64"/>.
/// </summary>
/// <returns><code>true</code> for dedicated <code>NULL</code> constant</returns>
public Boolean IsNull()
{
return DotNetImpl.IsNull(Bits);
}

/// <summary>
/// Checks is the <code>DFP</code> value is Not-a-Number.
/// If you need check for all abnormal values use negation of the <see cref="IsFinite"/> function.
/// </summary>
/// <returns><code>true</code> for Not-a-Number values.</returns>
public Boolean IsNaN()
{
return DotNetImpl.IsNaN(Bits);
}

/// <summary>
/// Checks is the <code>DFP</code> value is positive or negative infinity.
/// If you need check for all abnormal values use negation of the <see cref="IsFinite"/> function.
/// </summary>
/// <returns><code>true</code> for positive or negative infinity.</returns>
public Boolean IsInfinity()
{
return DotNetImpl.IsInfinity(Bits);
}

/// <summary>
/// Checks is the <code>DFP</code> value is positive infinity.
/// If you need check for all abnormal values use negation of the <see cref="IsFinite"/> function.
/// </summary>
/// <returns><code>true</code> for positive infinity.</returns>
public Boolean IsPositiveInfinity()
{
return DotNetImpl.IsPositiveInfinity(Bits);
}

/// <summary>
/// Checks is the <code>DFP</code> value is negative infinity.
/// If you need check for all abnormal values use negation of the <see cref="IsFinite"/> function.
/// </summary>
/// <returns><code>true</code> for negative infinity.</returns>
public Boolean IsNegativeInfinity()
{
return DotNetImpl.IsNegativeInfinity(Bits);
Expand All @@ -345,6 +370,10 @@ public Boolean IsSigned()
return DotNetImpl.SignBit(Bits);
}

/// <summary>
/// Checks is the <code>DFP</code> value is a finite value: not a NaN, not a positive infinity, not a negative infinity.
/// </summary>
/// <returns><code>true</code> for finite values.</returns>
public Boolean IsFinite()
{
return DotNetImpl.IsFinite(Bits);
Expand Down Expand Up @@ -426,31 +455,59 @@ public Boolean IsLessOrEqual(Decimal64 that)
return NativeImpl.isLessOrEqual(a.Bits, b.Bits);
}

/// <summary>
/// Checks is the <code>DFP</code> value is zero.
/// </summary>
/// <returns><code>true</code> for zero.</returns>
public Boolean IsZero()
{
return DotNetImpl.IsZero(Bits);
}

/// <summary>
/// Checks is the <code>DFP</code> value is not a zero or abnormal: NaN or positive infinity or negative infinity.
/// </summary>
/// <returns><code>true</code> for not a zero or abnormal.</returns>
public Boolean IsNonZero()
{
return !DotNetImpl.IsZero(Bits);
}

/// <summary>
/// Checks is the <code>DFP</code> value is greater than zero.
/// If you need check for values greater or equal to zero use <see cref="IsNonNegative"/> function.
/// </summary>
/// <returns><code>true</code> for values greater than zero.</returns>
public Boolean IsPositive()
{
return DotNetImpl.IsPositive(Bits);
}

/// <summary>
/// Checks is the <code>DFP</code> value is less than zero.
/// If you need check for values less or equal to zero use <see cref="IsNonPositive"/> function.
/// </summary>
/// <returns><code>true</code> for values less than zero.</returns>
public Boolean IsNegative()
{
return DotNetImpl.IsNegative(Bits);
}

/// <summary>
/// Checks is the <code>DFP</code> value is less or equal to zero.
/// If you need check for values strictly less than zero use <see cref="IsNegative"/> function.
/// </summary>
/// <returns><code>true</code> for values less or equal to zero.</returns>
public Boolean IsNonPositive()
{
return DotNetImpl.IsNonPositive(Bits);
}

/// <summary>
/// Checks is the <code>DFP</code> value is greater or equal to zero.
/// If you need check for values strictly greater than zero use <see cref="IsPositive"/> function.
/// </summary>
/// <returns><code>true</code> for values greater or equal to zero.</returns>
public Boolean IsNonNegative()
{
return DotNetImpl.IsNonNegative(Bits);
Expand Down
29 changes: 29 additions & 0 deletions docs/FAQ.md
Original file line number Diff line number Diff line change
Expand Up @@ -25,4 +25,33 @@ So, key points:
The *Checked functions in Java are not intended to be used directly.
These special functions are required just for ValueTypeAgent support.

## How to quickly check a sign?
There are many `is*` functions in the DFP library for the fast sign check.
The output values of these functions are presented in the next table.

| Function | -Infinity | -1 | 0 | 1 | Infinity | NaN |
| :--- | ---: | ---: | ---: | ---: | ---: | ---: |
| isPositive | false | false | false | **TRUE** | **TRUE** | false |
| isNonNegative | false | false | **TRUE** | **TRUE** | **TRUE** | false |
| isNegative | **TRUE** | **TRUE** | false | false | false | false |
| isNonPositive | **TRUE** | **TRUE** | **TRUE** | false | false | false |
| isInfinity | **TRUE** | false | false | false | **TRUE** | false |
| isPositiveInfinity | false | false | false | false | **TRUE** | false |
| isNegativeInfinity | **TRUE** | false | false | false | false | false |
| isNaN | false | false | false | false | false | **TRUE** |
| isFinite | false | **TRUE** | **TRUE** | **TRUE** | false | false |
| isNonFinite | **TRUE** | false | false | false | **TRUE** | **TRUE** |
| isZero | false | false | **TRUE** | false | false | false |
| isNonZero | **TRUE** | **TRUE** | false | **TRUE** | **TRUE** | **TRUE** |

# Do we have a method of parsing value like "1.703E-5"?

All the parse() and tryParse() methods supports this scientific notation.
Use the method you like best

```
Decimal64Utils.parse() or Decimal64Utils.tryParse()
Decimal64.parse() or Decimal64.tryParse()
```


3 changes: 2 additions & 1 deletion gradle.properties
Original file line number Diff line number Diff line change
@@ -1 +1,2 @@
version=0.12.11-SNAPSHOT
version=1.0.0-SNAPSHOT
valueTypesVersion=0.9.4
2 changes: 1 addition & 1 deletion gradle/wrapper/gradle-wrapper.properties
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-7.3.3-bin.zip
distributionUrl=https\://services.gradle.org/distributions/gradle-7.6.1-bin.zip
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists
33 changes: 28 additions & 5 deletions java/dfp-math/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -9,11 +9,7 @@ if (isReleaseVersion) {

group = 'com.epam.deltix'

sourceCompatibility = 1.7
compileTestJava {
sourceCompatibility = "1.8"
targetCompatibility = "1.8"
}
sourceCompatibility = 8

repositories {
mavenCentral()
Expand Down Expand Up @@ -134,3 +130,30 @@ jar {
sourcesJar {
duplicatesStrategy = DuplicatesStrategy.EXCLUDE
}

task testsJar(type: Jar, dependsOn: [jar, testClasses, processTestResources]) {
archiveClassifier = 'tests'
from sourceSets.test.output
}

task copyTestDeps(type: Copy) {
from(sourceSets.test.runtimeClasspath) { include '*.jar' }
into('testLibs')
}

task copyTestJars(type: Copy, dependsOn: [testsJar, copyTestDeps]) {
from(jar.outputs.files)
from(testsJar.outputs.files)
into('testLibs')
}

task runTestJars(type: JavaExec) {
mainClass = 'org.junit.runner.JUnitCore'
classpath = files { file('testLibs').listFiles() }

def testClassesRoot = file('src/test/java').absolutePath
fileTree(dir: testClassesRoot, include: '**/*Test.java').each { File file ->
def ap = file.absolutePath
args += ap.substring(testClassesRoot.length() + 1, ap.length() - 5).replace(File.separator, '.')
}
}
Loading