grain-lang / grain

The Grain compiler toolchain and CLI. Home of the modern web staple. 🌾
https://grain-lang.org/
GNU Lesser General Public License v3.0
3.26k stars 113 forks source link

feat(stdlib): Add `**` to `Float64` and `Float32` #2163

Closed spotandjake closed 1 week ago

spotandjake commented 1 week ago

This pr adds the power function 2.0d ** 2.0d to the Float32 and Float64 libraries, this uses the same algorithm we use for Number.pow without the extra overhead for the different number types, a future improvement we could make is having a separate algorithm for float32 for better performance.