Skip to content

feat: Add pingpong and fract functions#2

Merged
oglego merged 6 commits into
mainfrom
feature-pingpong
Feb 21, 2026
Merged

feat: Add pingpong and fract functions#2
oglego merged 6 commits into
mainfrom
feature-pingpong

Conversation

@oglego

@oglego oglego commented Feb 21, 2026

Copy link
Copy Markdown
Owner

Summary

This PR introduces two new mathematical functions to the extension: pingpong and fract.

Mathematical Implementation

  • fract(x): Returns the fractional (decimal) part of a number.

  • pingpong(x, min, max): Returns a value that "bounces" back and forth between the minimum and maximum.

Key Changes

  • New Functions: Added pingpong and fract.
  • Vectorized Execution: Leveraged DuckDB's native executors for high-performance processing.
  • Documentation: Updated README.md with usage descriptions and examples.
  • Testing: Added comprehensive unit tests covering:
    • Positive and negative inputs for fract.
    • Range boundaries and large inputs for pingpong.

Usage Examples

-- Returns 0.25
SELECT fract(42.25);

-- Returns 8.0 (Value bounces back from 10)
SELECT pingpong(12, 0, 10);

@oglego
oglego merged commit 636947f into main Feb 21, 2026
26 checks passed
@oglego
oglego deleted the feature-pingpong branch April 25, 2026 17:32
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant