[go-nuts] Re: Incorrect arithmetic answers

2020-06-01 Thread cratermoon
Floating point calculations are imprecise. https://0.30004.com/ https://www.phys.uconn.edu/~rozman/Courses/P2200_15F/downloads/floating-point-guide-2015-10-15.pdf s On Monday, June 1, 2020 at 11:56:55 AM UTC-7, Saksham Saxena wrote: > > Hello, > > I was trying to implement Substring

[go-nuts] Re: OAuth2 token expiry logic

2020-04-20 Thread cratermoon
Whoops, you're right. I got my Time and Duration mixed up. Your question still stands, though. The section on Monotonic Clocks at https://pkg.go.dev/time?tab=doc is a bit dense, but my best guess is that stripping the monotonic clock reading from the Expiry ensures that the comparison is made a

[go-nuts] Re: OAuth2 token expiry logic

2020-04-20 Thread cratermoon
According to https://golang.org/pkg/time/#Duration.Round "If m <= 0, Round returns d unchanged". So now I'm really curious, why do the Round() at all? s On Sunday, April 19, 2020 at 6:45:45 PM UTC-7, ise...@gmail.com wrote: > > Hi, > > I have been looking at various packages to understand how on

Re: [go-nuts] Re: keep just 2 decimal places in a float64

2020-02-01 Thread cratermoon
Perhaps I'm doing something wrong or using the library outside of its intended purpose, but I found that this library doesn't handle Muller's Recurrence correctly. For those not familiar, Muller's Recurrence is 108 - (815-1500/z)/y https://play.golang.org/p/sePTgjZzHeY See https://latkin.org/

[go-nuts] Re: keep just 2 decimal places in a float64

2020-01-25 Thread cratermoon
Floating point math has many pitfalls. https://play.golang.org/p/LK0lla8hM9w See also https://0.30004.com/ s On Saturday, January 25, 2020 at 7:14:15 PM UTC-8, Jason E. Aten wrote: > > > https://play.golang.org/p/87bDubJxjHO > > I'd like to truncate a float64 to just 2 decimal plac

[go-nuts] Re: Inconsistent rounding with float printf ?

2019-12-06 Thread cratermoon
https://play.golang.org/p/j5HKxitS-Z6 See https://0.30004.com/ On Friday, December 6, 2019 at 1:25:01 AM UTC-8, Christophe Meessen wrote: > > I have noticed that printf performs an apparently inconsistent rounding of > floating point values. > > I divide a big number by 1000 and pri