Skip to content

Commit

Permalink
Print the smallest floating point representation.
Browse files Browse the repository at this point in the history
This commmit makes a change where floating points are now
printed as their smallest textual representation. Before, all
numbers were always ddd.fffff. But now it may be printed with an
exponent, if and when that will make it smaller. This affects wkt
and geojson outputs. The reason for this change is to save space,
both network and disk, but without losing any accuracy.

For example, the number 5000000 will be now be 5e6.

To disable this feature call tg_env_set_print_fixed_floats(true);
  • Loading branch information
tidwall committed Feb 1, 2025
1 parent 023a2be commit 80d67ac
Show file tree
Hide file tree
Showing 9 changed files with 1,090 additions and 2,403 deletions.
8 changes: 4 additions & 4 deletions deps/.package
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import github.com/tidwall/json.c v1.1.7
import github.com/tidwall/ryu v0.2.1
import github.com/tidwall/json.c v1.1.8
import github.com/tidwall/fp v0.1.2

sum cba8cb6c700fc38902e8ddcaf0b056adad3227be json.c
sum 1a58747fed3daf14985bf9dea43aabea0de57c4d json.h
sum 47d36a9e261a02c9ca14d628f614453e4198586a ryu.c
sum 78b34e436ad29756dd3a2f8df9b72f6a13ecb9af ryu.h
sum 45445418215c415151d6edf56b271fa966e45bd0 fp.c
sum 3be96b07d324464ac76c9478e145291af1125492 fp.h
Loading

0 comments on commit 80d67ac

Please sign in to comment.