Floor a decimal value, x, to the first significant digit.For example, 1.0234 is ≈ 1.02.https://en.wikipedia.org/wiki/Significant_figures
from decimal import Decimal from math import floor, modf, log
num, integer = modf(x) y = log(num) / log(Decimal('.1')) denom = 10 ** (floor(y) + 1) x = int(x * denom) / denom
#include <cmath>
double i, n {modf(x, &i)}, y {log(n) / log(.1)}, d {pow(10, floor(y) + 1)}; x = trunc(x * d) / d;
let i = Math.trunc(x), n = x - i, y = Math.log(n) / Math.log(.1), d = Math.pow(10, Math.trunc(y) + 1) x = Math.trunc(x * d) / d
import static java.lang.Math.log; import static java.lang.Math.pow;
double i = (int) x, n = x - i, y = log(n) / log(.1), d = pow(10, (int) y + 1); x = (int) (x * d) / d;
str(x,s); p := Pos('.',s) + 1; while (s[p] = '0') do inc(p); setlength(s,p);
No security, no password. Other people might choose the same nickname.