cockroachdb / cockroachdb/cockroach

float exp/degrees return Inf/0 on overflow instead of PG range error

Open
#173,609 2 comments 0 reactions 0 assignees View on GitHub
C-autosolve C-bug E-quick-win O-community T-sql-queries X-blathers-triaged
Dominant language
Go
Stars
32.5k
Forks
4.1k
PR merge metrics
PR metrics pending

Description

**Lineage**
- Original: #122879
- Fix: #169869 FloatPow — reject invalid power and finite→Inf/0 overflow
- Gap: exp() / degrees() still use bare math.Exp / scale with no overflow check
**To Reproduce** (v25.2.0)
```sql
SELECT exp(710::float8); -- Infinity; PG: overflow
SELECT exp(-746::float8); -- 0; PG: underflow
SELECT degrees(1e308::float8); -- Infinity; PG: overflow

Jira issue: CRDB-66922

Contributor guide

Open the contributing guide

Research direction

Start by running the three SQL reproductions for exp() and degrees(), then locate their implementations and compare the bare math.Exp/scale behavior with FloatPow's overflow handling. Done means finite-to-Infinity and finite-to-zero overflow cases return PostgreSQL-compatible range errors rather than Infinity or 0.

Written by the indexing model from the issue text.

Assessment

Tech stack
go, sql
Domain
databases
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Active
Clarity
Mostly clear
Newbie friendliness
70/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.