#Get the smallest positive float number

1 messages · Page 1 of 1 (latest)

bitter escarp
#

Is there a function in std that gives you the smallest positive float number for type T?

frail adder
#
const std = @import("std");

pub fn main() void {
    std.debug.print("{d}\n{d}\n", .{ std.math.floatMin(f64), std.math.floatTrueMin(f64) });
}

output:

0.000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000022250738585072014
0.000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000005
bitter escarp
#

What is the difference between them?

#

I see that one is lesser than the other, but why?

hollow panther
#

from the docs, floatMin is the smallest number excluding subnormals and floatTrueMin does count subnormals

bitter escarp
#

Hmm, I should look into what subnormals are.