-
-
Notifications
You must be signed in to change notification settings - Fork 3.1k
Closed as not planned
Closed as not planned
Copy link
Labels
enhancementSolving this issue will likely involve adding new logic or components to the codebase.Solving this issue will likely involve adding new logic or components to the codebase.standard libraryThis issue involves writing Zig code for the standard library.This issue involves writing Zig code for the standard library.
Description
Zig Version
0.14.0-dev.2340+182cdf74b
Steps to Reproduce and Observed Behavior
test {
_ = std.math.isInf(3.0);
}Produces error:
~/zig/0.14.0-dev.2340+182cdf74b/files/lib/std/math/isinf.zig:8:55: error: access of union field 'float' while field 'comptime_float' is active
const TBits = std.meta.Int(.unsigned, @typeInfo(T).float.bits);
~~~~~~~~~~~~^~~~~~
~/zig/0.14.0-dev.2340+182cdf74b/files/lib/std/builtin.zig:556:18: note: union declared here
pub const Type = union(enum) {
^~~~~
/var/tmp/inftest.zig:21:23: note: called from here
_ = std.math.isInf(3.0);
~~~~~~~~~~~~~~^~~~~
std.math.isFinite produces the same error.
This error is present in zig 0.13.0 as well.
Expected Behavior
Given that std.math.isNan supports ComptimeFloat arguments, I expected std.math.isInf / std.math.isFinite to also support them. If there is a reason why it shouldn't support ComptimeFloat, then a more helpful @compileError() might be helpful. Just flagging this in case it was missed! Thanks all!
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
enhancementSolving this issue will likely involve adding new logic or components to the codebase.Solving this issue will likely involve adding new logic or components to the codebase.standard libraryThis issue involves writing Zig code for the standard library.This issue involves writing Zig code for the standard library.