Skip to content

AstGen: allow unary float builtins to forward a result location - #23988

Merged
mlugg merged 2 commits into
ziglang:masterfrom
Rexicon226:float-op-rl
Aug 28, 2025
Merged

mlugg merged 2 commits into
ziglang:masterfrom
Rexicon226:float-op-rl

Conversation

@Rexicon226

@Rexicon226 Rexicon226 commented May 25, 2025 •

Copy link
Copy Markdown
Contributor

Release Notes

Previously Zig would not forward a result-location through the following builtin functions,

@sqrt
@sin
@cos
@tan
@exp
@exp2
@log
@log2
@log10
@floor
@ceil
@trunc
@round

This has now been changed. Where previous you couldn't write,

const x: f64 = @sqrt(@floatFromInt(N));

since @sqrt would not forward the f64 result type to @floatFromInt, now you can.

@alexrp
alexrp requested a review from mlugg May 25, 2025 09:58
@alexrp alexrp added the proposal This issue suggests language modifications. If it also has the "accepted" label then it is planned. label May 25, 2025
@alexrp

alexrp commented May 29, 2025

Copy link
Copy Markdown
Member

Just a reminder that, if accepted, this should have some copy-pastable release notes in the PR description.

@Rexicon226

Copy link
Copy Markdown
Contributor Author

Yeah, happy to write them up.

@mlugg mlugg left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

One nitpick. If you fix that and rebase (I see at least one writergate-related change you'll need to make), I'll be happy to merge (ping me if I forget).

Comment thread lib/std/zig/Zir.zig Outdated
@mlugg mlugg added enhancement Solving this issue will likely involve adding new logic or components to the codebase. release notes This PR should be mentioned in the release notes. and removed proposal This issue suggests language modifications. If it also has the "accepted" label then it is planned. labels Aug 13, 2025
@mlugg
mlugg merged commit 73a0b54 into ziglang:master Aug 28, 2025
@Rexicon226
Rexicon226 deleted the float-op-rl branch August 28, 2025 14:46
@alexrp alexrp removed the release notes This PR should be mentioned in the release notes. label Oct 3, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhancement Solving this issue will likely involve adding new logic or components to the codebase.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants