He was using that as an example to show that the value contained in the float 
is not 1, but less than 1, even though the print shows it as 1.

> On Oct 10, 2022, at 8:07 PM, Bakul Shah <ba...@iitbombay.org> wrote:
> 
> On Oct 10, 2022, at 5:40 PM, Dante Castagnoli <dante.castagn...@gmail.com> 
> wrote:
>> 
>> Also, if you were to take an int(f), you will note that it returns "0", and 
>> not "1".
> 
> %0.3f does *rounding*, while int(f) does *truncation*.
> 1.0 is closer to 0.9999... than 0.999 is to 0.9999...
> 
> -- 
> You received this message because you are subscribed to the Google Groups 
> "golang-nuts" group.
> To unsubscribe from this group and stop receiving emails from it, send an 
> email to golang-nuts+unsubscr...@googlegroups.com.
> To view this discussion on the web visit 
> https://groups.google.com/d/msgid/golang-nuts/B51E4191-D268-4F17-BD50-1FEB59B94379%40bitblocks.com.

-- 
You received this message because you are subscribed to the Google Groups 
"golang-nuts" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to golang-nuts+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/golang-nuts/2A273781-F8A7-425C-8F08-12A49CBB0863%40ix.netcom.com.

Reply via email to