apple / apple/swift-numerics

`root` and `pow` don't handle `Int` arguments quite right

Open
#9 5 comments 0 reactions 0 assignees View on GitHub
bug
Dominant language
Swift
Stars
1.9k
Forks
181
Avg merge
2d 5h
Merged PRs (30d)
6

Description

At present, the implementations of these operations convert their `Int` arguments to the floating-point type. This works fine for small integers (the common case), but isn't quite right for large integers (which will round on conversion). This is especially problematic because it can convert odd integers to even integers, which will change the sign of results when the floating-point argument is negative.

Contributor guide

Open the contributing guide

Research direction

Locate the implementations of root and pow that accept Int arguments, then inspect how those arguments are converted to floating point. Check behavior with large odd integers and negative floating-point arguments; done means those cases no longer round in a way that changes the result.

Written by the indexing model from the issue text.

Assessment

Tech stack
swift
Domain
backend
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.