Stuff.
parent
da16890f2e
commit
decfbd5f81
|
@ -9,7 +9,8 @@ print_result -(0_f32 / 0_f32).as(Float32)
|
||||||
print_result 65504.0
|
print_result 65504.0
|
||||||
print_result 10_000.0
|
print_result 10_000.0
|
||||||
print_result -10_000.0
|
print_result -10_000.0
|
||||||
# print_result 50.5
|
print_result 153.0
|
||||||
|
print_result -3992.0
|
||||||
# print_result 0.15625
|
# print_result 0.15625
|
||||||
# print_result 10.539187
|
# print_result 10.539187
|
||||||
# print_result -10.539187
|
# print_result -10.539187
|
||||||
|
@ -177,7 +178,7 @@ def f32_to_f16(value : Float32)
|
||||||
# No exponent for subnormals
|
# No exponent for subnormals
|
||||||
final_value = (half_sign | half_man).to_u16
|
final_value = (half_sign | half_man).to_u16
|
||||||
|
|
||||||
puts "#{get_summary final_value} => underflow"
|
# puts "#{get_summary final_value} => underflow"
|
||||||
|
|
||||||
return final_value, ConversionInfo::Underflow
|
return final_value, ConversionInfo::Underflow
|
||||||
end
|
end
|
||||||
|
@ -190,7 +191,7 @@ def f32_to_f16(value : Float32)
|
||||||
# Check for rounding (see comment above functions)
|
# Check for rounding (see comment above functions)
|
||||||
round_bit = 0x0000_1000u32
|
round_bit = 0x0000_1000u32
|
||||||
final_value = if (man & round_bit) != 0 && (man & (3 * round_bit - 1)) != 0
|
final_value = if (man & round_bit) != 0 && (man & (3 * round_bit - 1)) != 0
|
||||||
puts "round it"
|
# puts "round it"
|
||||||
# Round it
|
# Round it
|
||||||
((half_sign | half_exp | half_man) + 1).to_u16
|
((half_sign | half_exp | half_man) + 1).to_u16
|
||||||
else
|
else
|
||||||
|
|
Loading…
Reference in New Issue