@oqtopus-team/pi-qdash 0.1.11-beta.20 → 0.1.11-beta.21

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -93,7 +93,12 @@ export function sweepsOf(parameters: Record<string, RecordedParameter>): Sweep[]
93
93
  /** A number for the model: up to four significant digits, no trailing zeros. */
94
94
  export function formatNumber(value: number): string {
95
95
  if (!Number.isFinite(value)) return String(value);
96
- if (Number.isInteger(value) && Math.abs(value) < 1e15) return String(value);
96
+ if (value === 0) return "0";
97
+ // A log-spaced endpoint comes back as 499999.99999994; it is the integer it rounds to.
98
+ const rounded = Math.round(value);
99
+ if (rounded !== 0 && Math.abs(value - rounded) <= 1e-9 * Math.abs(value) && Math.abs(rounded) < 1e15) {
100
+ return String(rounded);
101
+ }
97
102
  const text = Math.abs(value) >= 1e6 || Math.abs(value) < 1e-4 ? value.toExponential(3) : value.toPrecision(4);
98
103
  return text.includes("e") ? text.replace(/\.?0+e/, "e") : text.replace(/(\.\d*?)0+$/, "$1").replace(/\.$/, "");
99
104
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@oqtopus-team/pi-qdash",
3
- "version": "0.1.11-beta.20",
3
+ "version": "0.1.11-beta.21",
4
4
  "description": "Pi extension for querying QDash via @oqtopus-team/qdash-client",
5
5
  "type": "module",
6
6
  "license": "Apache-2.0",