Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Menu
Open sidebar
jerrrrry
infinicore
Commits
ce75b918
Unverified
Commit
ce75b918
authored
May 29, 2025
by
PanZezhong1725
Committed by
GitHub
May 29, 2025
Browse files
Merge pull request #227 from John-jsh/issue/226
issue/226: 修改_f32_to_f16()方法内的判断语句条件
parents
1be004cb
7475f149
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
1 addition
and
1 deletion
+1
-1
src/utils/custom_types.cc
src/utils/custom_types.cc
+1
-1
No files found.
src/utils/custom_types.cc
View file @
ce75b918
...
...
@@ -43,7 +43,7 @@ fp16_t _f32_to_f16(float val) {
int32_t
exponent
=
((
f32
>>
23
)
&
0xFF
)
-
127
;
// Extract and de-bias the exponent
uint32_t
mantissa
=
f32
&
0x7FFFFF
;
// Extract the mantissa (fraction part)
if
(
exponent
>=
3
1
)
{
// Special cases for Inf and NaN
if
(
exponent
>=
1
6
)
{
// Special cases for Inf and NaN
// NaN
if
(
exponent
==
128
&&
mantissa
!=
0
)
{
return
fp16_t
{
static_cast
<
uint16_t
>
(
sign
|
0x7E00
)};
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment