Source File
math.go
Belonging Package
go/printer
// Copyright 2026 The Go Authors. All rights reserved.// Use of this source code is governed by a BSD-style// license that can be found in the LICENSE file.package printerimport// log2ish returns a crude approximation to logâ‚‚(x).// The result is only used for heuristic alignment decisions and should// not be used where precision matters.// The approximation is guaranteed to produce identical results// across all architectures.func log2ish( float64) float64 {, := math.Frexp()return float64() + 2*(-1)}// exp2ish returns a crude approximation to 2**x.// The result is only used for heuristic alignment decisions and should// not be used where precision matters.// The approximation is guaranteed to produce identical results// across all architectures.func exp2ish( float64) float64 {:= math.Floor():= -return math.Ldexp(1+, int())}
![]() |
The pages are generated with Golds v0.8.7. (GOOS=linux GOARCH=amd64) Golds is a Go 101 project developed by Tapir Liu. PR and bug reports are welcome and can be submitted to the issue list. Please follow @zigo_101 (reachable from the left QR code) to get the latest news of Golds. |