Skip to content

std.math.pow doesn't support f16, f80, f128, c_longdouble or comptime_float #23602

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
Empika1 opened this issue Apr 18, 2025 · 2 comments · May be fixed by #23631
Open

std.math.pow doesn't support f16, f80, f128, c_longdouble or comptime_float #23602

Empika1 opened this issue Apr 18, 2025 · 2 comments · May be fixed by #23631
Labels
contributor friendly This issue is limited in scope and/or knowledge of Zig internals. enhancement Solving this issue will likely involve adding new logic or components to the codebase. standard library This issue involves writing Zig code for the standard library.

Comments

@Empika1
Copy link

Empika1 commented Apr 18, 2025

Zig Version

0.14.0

Steps to Reproduce and Observed Behavior

const std = @import("std");
pub fn main() void {
    _ = std.math.pow(f16, 1, 1);
    _ = std.math.pow(f80, 1, 1);
    _ = std.math.pow(f128, 1, 1);
    _ = std.math.pow(c_longdouble, 1, 1);
    _ = std.math.pow(comptime_float, 1, 1);
}
error: pow not implemented for f16
error: pow not implemented for f80
error: pow not implemented for f128
error: pow not implemented for c_longdouble
error: pow not implemented for comptime_float

Expected Behavior

I expected pow to be implemented for all standard floating point types. I'm not sure exactly how the algorithm works, but judging by the fact that it already handles 2 types (f32 and f64) without branching, this doesn't seem like it would be too hard to fix.

@Empika1 Empika1 added the bug Observed behavior contradicts documented or intended behavior label Apr 18, 2025
@alexrp alexrp added enhancement Solving this issue will likely involve adding new logic or components to the codebase. contributor friendly This issue is limited in scope and/or knowledge of Zig internals. standard library This issue involves writing Zig code for the standard library. and removed bug Observed behavior contradicts documented or intended behavior labels Apr 18, 2025
@Empika1
Copy link
Author

Empika1 commented Apr 18, 2025

Sorry if this isn't best categorized as a bug. This is my first submitted issue.

@ashpil
Copy link

ashpil commented Apr 24, 2025

Would like to see comptime_int support as well

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
contributor friendly This issue is limited in scope and/or knowledge of Zig internals. enhancement Solving this issue will likely involve adding new logic or components to the codebase. standard library This issue involves writing Zig code for the standard library.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants