package o;

import java.math.BigDecimal;
import java.math.BigInteger;
import java.math.RoundingMode;
import java.text.DecimalFormat;
import java.util.ArrayList;
import java.util.Iterator;

/* compiled from: r8-map-id-3b7cc9102578c509342fa2f0fabed2bfc72239cd258d579fc679bfcbc198b048 */
/* loaded from: classes.dex */
public final class Wn0 implements InterfaceC1991no0 {
    public final Double l;

    public Wn0(Double d) {
        if (d == null) {
            this.l = Double.valueOf(Double.NaN);
        } else {
            this.l = d;
        }
    }

    @Override // o.InterfaceC1991no0
    public final Iterator a() {
        return null;
    }

    @Override // o.InterfaceC1991no0
    public final InterfaceC1991no0 b(String str, C2062oc0 c2062oc0, ArrayList arrayList) throws NumberFormatException {
        if ("toString".equals(str)) {
            return new C2560to0(zzc());
        }
        throw new IllegalArgumentException(zzc() + "." + str + " is not a function.");
    }

    public final boolean equals(Object obj) {
        if (obj == this) {
            return true;
        }
        if (obj instanceof Wn0) {
            return this.l.equals(((Wn0) obj).l);
        }
        return false;
    }

    @Override // o.InterfaceC1991no0
    public final InterfaceC1991no0 h() {
        return new Wn0(this.l);
    }

    public final int hashCode() {
        return this.l.hashCode();
    }

    public final String toString() {
        return zzc();
    }

    @Override // o.InterfaceC1991no0
    public final String zzc() throws NumberFormatException {
        Double d = this.l;
        if (Double.isNaN(d.doubleValue())) {
            return "NaN";
        }
        if (Double.isInfinite(d.doubleValue())) {
            return d.doubleValue() > 0.0d ? "Infinity" : "-Infinity";
        }
        BigDecimal bigDecimalValueOf = BigDecimal.valueOf(d.doubleValue());
        BigDecimal bigDecimal = bigDecimalValueOf.signum() == 0 ? new BigDecimal(BigInteger.ZERO, 0) : bigDecimalValueOf.stripTrailingZeros();
        DecimalFormat decimalFormat = new DecimalFormat("0E0");
        decimalFormat.setRoundingMode(RoundingMode.HALF_UP);
        decimalFormat.setMinimumFractionDigits((bigDecimal.scale() > 0 ? bigDecimal.precision() : bigDecimal.scale()) - 1);
        String str = decimalFormat.format(bigDecimal);
        int iIndexOf = str.indexOf("E");
        if (iIndexOf <= 0) {
            return str;
        }
        int i = Integer.parseInt(str.substring(iIndexOf + 1));
        return ((i >= 0 || i <= -7) && (i < 0 || i >= 21)) ? str.replace("E-", "e-").replace("E", "e+") : bigDecimal.toPlainString();
    }

    @Override // o.InterfaceC1991no0
    public final Double zzd() {
        return this.l;
    }

    @Override // o.InterfaceC1991no0
    public final Boolean zze() {
        Double d = this.l;
        boolean z = false;
        if (!Double.isNaN(d.doubleValue()) && d.doubleValue() != 0.0d) {
            z = true;
        }
        return Boolean.valueOf(z);
    }
}
