geofffranks / spruce

A BOSH template merge tool
MIT License
433 stars 78 forks source link

`(( calc ))` cannot handle large numbers #286

Closed jhunt closed 5 years ago

jhunt commented 5 years ago

This is fun:

https://play.spruce.cf/#f22093c2bbbf84230879f13c0d92963e

I expected to get an integer from (( calc )) when only integer operations were involved. Not sure if this is a Go thing, a fmt thing, or a YAML thing, but it sure confuses UAA when it's idle timeouts are specified as non-integers.

geofffranks commented 5 years ago

((calc)) is returning float64 values, which get strconv'd into scientific notation from inside the yaml marshaler.

Adding a test to calc to convert float64s that represent ints into int64s to avoid this where it's possible, though if the output of calc is in fact a large float64, it will still get converted into scientific notation.

geofffranks commented 5 years ago

Fixed in v1.19.3 (https://play.spruce.cf/#00ac89bc492802c3815795df49b49648)