Skip to content

Releases

Correctness, Diamond Deployment, and TrigMath Performance Release

Choose a tag to compare

@gorkemerdogan gorkemerdogan released this 11 Sep 06:56

Overview

Trigonometry Master v2.0.0 is a major correctness, deployment, benchmarking, and performance release.

This release turns the project into a more reliable, explicitly scoped, and deployable Solidity trigonometry system. It adds enforced numerical accuracy checks, fixes inverse-trigonometry and threshold bugs, defines special-value and input-range behavior, repairs the Diamond deployment path, improves benchmark methodology, and substantially reduces production gas through TrigMath inlining.

Highlights

  • Enforced real trigonometric accuracy assertions instead of record-count-only tests.
  • Fixed inverse-sine / inverse-cosine approximation behavior.
  • Corrected malformed binary128 threshold constants.
  • Added explicit NaN, infinity, domain, pole, signed-zero, and range behavior.
  • Added high-resolution raw binary128 characterization with ULP reporting.
  • Bounded direct trigonometric argument reduction to finite |x| <= 2^32.
  • Fixed the ethers v6 TrigonometryMaster Diamond deployment script.
  • Added production Diamond gas benchmark coverage.
  • Pre-encoded sin/cos Taylor coefficients.
  • Added shared internal sincos evaluation for paired consumers.
  • Replaced linked MathLib production dispatch with internal TrigMath.
  • Added bytecode-size guardrails.
  • Expanded raw binary128 edge-case and Diamond integration coverage.
  • Documented direct versus Diamond deployment tradeoffs.

Correctness Fixes

Accuracy tests now enforce numerical thresholds for:

  • sin
  • cos
  • tan
  • cot
  • asin
  • acos
  • atan
  • inverse/round-trip behavior
  • domain and pole behavior

Key fixes include:

  • Corrected asin from the incorrect form x + x·P(x²) to x + x³·P(x²).
  • Added an endpoint-stable acos branch near x = 1 using acos(x) = 2·asin(sqrt((1-x)/2)).
  • Corrected malformed binary128 constants for 1e-6, 1e-30, 2^-112, and the large-atan cutoff.
  • Fixed signed-zero handling in zero-sensitive logic.
  • Hardened Diamond ownership and diamondCut behavior.

Input Domain and Special Values

The trigonometric API now has explicit behavior for non-finite and unsupported inputs.

  • sin, cos, tan, and cot reject:

    • NaN
    • ±infinity
    • finite |x| > 2^32
  • asin and acos return canonical NaN for:

    • NaN
    • ±infinity
    • finite out-of-domain inputs
  • atan returns:

    • canonical NaN for NaN
    • signed π/2 for ±infinity
  • Finite tan/cot poles remain documented NaN cases.

Benchmarking Improvements

Benchmark output now distinguishes:

  • transaction receipt gas
  • estimateGas
  • eth_call results
  • harness-direct execution
  • Diamond-routed production execution
  • deployment and diamondCut installation costs

The benchmark suite no longer treats repeated deterministic calls as independent statistical samples or hides failures as data strings.

Representative local Hardhat production-route receipt gas at π/4:

Function Diamond-routed gas
sin 43,473
cos 42,504
tan 54,827
cot 54,831

These are local Hardhat measurements, not chain-wide gas guarantees.

Performance Improvements

This release substantially reduces production gas and deployment complexity.

Major changes:

  • Replaced runtime coefficient construction with audited encoded binary128 constants.
  • Added shared internal sincos evaluation for paired consumers.
  • Replaced linked MathLib production arithmetic dispatch with internal TrigMath.
  • Removed production dependency on linked MathLib deployment.

Current production size/deployment profile:

Item Value
TrigonometryFacet runtime size 18,333 bytes
EIP-170 headroom 6,243 bytes
Project budget headroom 4,667 bytes
TrigonometryFacet deployment gas 4,013,373

Production deployment no longer requires MathLib.

Diamond Deployment

The deployment script now targets the actual TrigonometryMaster Diamond architecture and works with ethers v6.

It deploys and installs:

  • DiamondCutFacet
  • TrigonometryMaster
  • OwnershipFacet
  • DiamondLoupeFacet
  • TrigonometryFacet

Local deployment validation passed, including facet installation through diamondCut.

Recent local deployment receipt gas:

Component Gas
DiamondCutFacet 1,022,266
TrigonometryMaster 324,179
OwnershipFacet 166,427
DiamondLoupeFacet 430,473
TrigonometryFacet 4,013,373
diamondCut installation 647,863

Test Coverage

The default suite now covers:

  • bytecode budget checks
  • Diamond safety checks
  • Diamond integration, selector installation, loupe, proxy routing, access control, replacement, and removal
  • MathLib special-value behavior
  • benchmark utility semantics
  • harness-observable accuracy
  • raw binary128 edge cases
  • high-resolution sin/cos characterization
  • argument-reduction range validation

The default test suite currently passes:

npm test
# 40 passing

v1.1.0.1 - Add Trigonometry Wrapper Library

Choose a tag to compare

@gorkemerdogan gorkemerdogan released this 25 Apr 08:45

v1.1.0.1 - Add Trigonometry Wrapper Library

This release adds a unified Trigonometry wrapper library for easier external imports.

Changes

  • Added contracts/libraries/Trigonometry.sol.
  • Exposed a single import point for:
    • sin
    • cos
    • tan
    • cot
    • asin
    • acos
    • atan
  • Routed calls internally to the existing TrigonometrySinCos, TrigonometryTanCot, and TrigonometryArc libraries.

Usage

import {Trigonometry} from "@gorkemerdogan/trigonometry-master/contracts/libraries/Trigonometry.sol";

v1.0.2.1 - Naming Cleanup

Choose a tag to compare

@gorkemerdogan gorkemerdogan released this 25 Apr 08:25

v1.0.2.1 - Naming Cleanup

This release cleans up remaining references from the original SmartSolve project after extracting Trigonometry Master as a standalone library.

Changes

  • Removed leftover SmartSolve naming from Trigonometry Master files.
  • Aligned contract and project naming with the standalone Trigonometry Master package.
  • Improved package consistency for external imports.

Notes

This release does not change the core trigonometric logic.

v1.0.1 - Package Setup

Choose a tag to compare

@gorkemerdogan gorkemerdogan released this 25 Apr 08:07

v1.0.1 - Package Setup

This release prepares Trigonometry Master for external usage as a GitHub-based npm dependency.

Changes

  • Added npm package metadata.
  • Configured package name for external Solidity imports.
  • Removed nested package files from the contracts directory.
  • Updated Hardhat and TypeScript configuration for stable local testing.
  • Prepared the package for imports such as:
import {TrigonometryMaster} from "@gorkemerdogan/trigonometry-master/contracts/TrigonometryMaster.sol";

Trigonometry Master v1.0.0 - Initial Release

Choose a tag to compare

@gorkemerdogan gorkemerdogan released this 25 Apr 07:41
f4caf11

Trigonometry Master v1.0.0

Initial release of Trigonometry Master, a deterministic quadruple-precision trigonometric library for Ethereum-compatible environments.

Highlights

  • Added support for core trigonometric functions:

    • sin
    • cos
    • tan
    • cot
  • Added support for inverse trigonometric functions:

    • arcsin
    • arccos
    • arctan
  • Implemented quadruple-precision arithmetic using bytes16 based on the IEEE-754 binary128 representation.

  • Designed the library with stateless, deterministic execution for reproducible results across EVM-compatible nodes.

  • Structured the implementation for modular integration with Diamond Pattern based smart contract systems.

  • Separated trigonometric logic into dedicated modules for:

    • sine / cosine
    • tangent / cotangent
    • inverse trigonometric operations

Intended Scope

This release is intended for research-oriented and engineering-focused smart contract applications that require deterministic and high-precision trigonometric computation.

Typical use cases include:

  • on-chain numerical analysis
  • optimization algorithms
  • differential equation solvers
  • geometric computation
  • verifiable mathematical research on EVM-based platforms

License

Released under the MIT License.