本文整理汇总了Golang中flag.Float64函数的典型用法代码示例。如果您正苦于以下问题:Golang Float64函数的具体用法?Golang Float64怎么用?Golang Float64使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了Float64函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Golang代码示例。
示例1: main
func main() {
maxSideLength := flag.Float64("max", 1, "maximum side length")
minSideLength := flag.Float64("min", 1, "minimum side length")
flag.Parse()
cuboidStream := make(chan Cuboid, NUM_CONCURRENT_CUBOID_SEARCHES)
perfectCuboid := make(chan Cuboid)
wg := new(sync.WaitGroup)
go waitForPerfectCuboid(perfectCuboid)
go distributeCuboids(cuboidStream, perfectCuboid, wg)
fmt.Printf("Searching for a perfect cuboid with side lengths between %d and %d...", int(*minSideLength), int(*maxSideLength))
x := 1.0
for x <= *maxSideLength {
y := 1.0
for y <= *maxSideLength {
z := 1.0
for z <= *maxSideLength {
if x >= *minSideLength || y >= *minSideLength || z >= *minSideLength {
wg.Add(1)
cuboid := Cuboid{Length: x, Width: y, Height: z}
cuboidStream <- cuboid
}
z += 1
}
y += 1
}
x += 1
}
wg.Wait()
fmt.Println(" done.")
}
开发者ID:kochman,项目名称:perfectcuboid,代码行数:35,代码来源:perfectcuboid.go
示例2: main
func main() {
debug := flag.Bool("debug", false, "debug on")
threaded := flag.Bool("threaded", true, "debug on")
delcache_ttl := flag.Float64("deletion_cache_ttl", 5.0, "Deletion cache TTL in seconds.")
branchcache_ttl := flag.Float64("branchcache_ttl", 5.0, "Branch cache TTL in seconds.")
deldirname := flag.String(
"deletion_dirname", "GOUNIONFS_DELETIONS", "Directory name to use for deletions.")
flag.Parse()
if len(flag.Args()) < 2 {
fmt.Println("Usage:\n main MOUNTPOINT RW-DIRECTORY RO-DIRECTORY ...")
os.Exit(2)
}
ufsOptions := unionfs.UnionFsOptions{
DeletionCacheTTLSecs: *delcache_ttl,
BranchCacheTTLSecs: *branchcache_ttl,
DeletionDirName: *deldirname,
}
ufs, err := unionfs.NewUnionFsFromRoots(flag.Args()[1:], &ufsOptions)
if err != nil {
log.Fatal("Cannot create UnionFs", err)
os.Exit(1)
}
mountState, _, err := fuse.MountFileSystem(flag.Arg(0), ufs, nil)
if err != nil {
log.Fatal("Mount fail:", err)
}
mountState.Debug = *debug
mountState.Loop(*threaded)
}
开发者ID:jravasi,项目名称:go-fuse,代码行数:33,代码来源:main.go
示例3: main
func main() {
// Set up flags.
wFlag := flag.Int("w", 640, "width of the image in pixels")
hFlag := flag.Int("h", 480, "height of the image in pixels")
xMinFlag := flag.Float64("x-min", -2.0, "minimum x value to plot")
xMaxFlag := flag.Float64("x-max", 2.0, "maximum x value to plot")
bailoutFlag := flag.Int("bailout", 100, "maximum iteration bailout")
// Handle the flags.
flag.Parse()
// Main logic.
acc := newAccumulator(*wFlag, *hFlag, *xMinFlag, *xMaxFlag)
const numSamples = 1e8
for acc.getCount() < numSamples {
log.Print(acc.getCount())
accumulateSeqence(*bailoutFlag, acc)
}
img := acc.toImage()
f, err := os.Create("out.png")
if err != nil {
log.Fatal(err)
}
if err := png.Encode(f, img); err != nil {
log.Fatal(err)
}
}
开发者ID:peterstace,项目名称:buddhabrotgen,代码行数:29,代码来源:main.go
示例4: main
func main() {
drinks := flag.Float64("drinks", 2.5, "How many drinks consumed")
weight := flag.Float64("weight", 70.0, "Body weight in kilograms")
hours := flag.Float64("hours", 2.0, "How many hours it took to drink")
gender := flag.String("gender", "male", "Specify male or female")
flag.Usage = func() {
fmt.Println(`
NAME:
inebriati
DESCRIPTION:
Calculates estimated blood ethanol concentration (EBAC)
COMMANDS:
-drinks Number of standard drinks comsumed.
-weight Weight in kiligrams.
-hours Drinking period in hours.
-gender Select male or female.
`[1:])
}
flag.Parse()
i := inebriati.New(*drinks, *weight, *hours, *gender)
i.Calc()
fmt.Println(i)
}
开发者ID:NovemberFoxtrot,项目名称:inebriati,代码行数:32,代码来源:tippler.go
示例5: main
func main() {
size := flag.Int("psize", 500, "physical size of the square image")
vpx := flag.Float64("x", 0, "x coordinate of the center of the image")
vpy := flag.Float64("y", 0, "y coordinate of the center of the image")
d := flag.Float64("size", 2, "size of the represented part of the plane")
filename := flag.String("name", "image", "name of the image file produced (w/o extension")
numberOfProcs := flag.Int("procs", 2, "number of procs to use")
seed := flag.Int64("seed", 42, "seed for the random number generator")
cols := flag.Bool("with-colors", false, "whether there is colors")
flag.Parse()
runtime.GOMAXPROCS(*numberOfProcs)
withColors = *cols
if *cols {
initColors(*seed)
}
file, err := os.Open(*filename+".png", os.O_RDWR|os.O_CREAT, 0666)
if err != nil {
panic("error with opening file \"" + *filename + "\"")
}
im := image.NewRGBA(*size, *size)
ch := make(chan point, 1000)
Start(im, 2, *vpx, *vpy, *d, ch)
handleChans(im, ch)
png.Encode(file, im)
}
开发者ID:ineol,项目名称:mandelgo,代码行数:34,代码来源:mandel.go
最后编辑: kuteng 文档更新时间: 2021-08-23 19:14 作者:kuteng