package com.google.android.gms.internal.measurement; import java.math.BigDecimal; import java.math.RoundingMode; import java.text.DecimalFormat; import java.util.Iterator; import java.util.List; /* loaded from: classes.dex */ public final class zzah implements zzap { private final Double zza; public zzah(Double d) { if (d == null) { this.zza = Double.valueOf(Double.NaN); } else { this.zza = d; } } public final boolean equals(Object obj) { if (obj == this) { return true; } if (obj instanceof zzah) { return this.zza.equals(((zzah) obj).zza); } return false; } public final int hashCode() { return this.zza.hashCode(); } public final String toString() { return zzi(); } @Override // com.google.android.gms.internal.measurement.zzap public final zzap zzbK(String str, zzg zzgVar, List list) { if ("toString".equals(str)) { return new zzat(zzi()); } throw new IllegalArgumentException(String.format("%s.%s is not a function.", zzi(), str)); } @Override // com.google.android.gms.internal.measurement.zzap public final zzap zzd() { return new zzah(this.zza); } @Override // com.google.android.gms.internal.measurement.zzap public final Boolean zzg() { return Boolean.valueOf((Double.isNaN(this.zza.doubleValue()) || this.zza.doubleValue() == 0.0d) ? false : true); } @Override // com.google.android.gms.internal.measurement.zzap public final String zzi() { int scale; if (Double.isNaN(this.zza.doubleValue())) { return "NaN"; } if (Double.isInfinite(this.zza.doubleValue())) { return this.zza.doubleValue() > 0.0d ? "Infinity" : "-Infinity"; } BigDecimal stripTrailingZeros = BigDecimal.valueOf(this.zza.doubleValue()).stripTrailingZeros(); DecimalFormat decimalFormat = new DecimalFormat("0E0"); decimalFormat.setRoundingMode(RoundingMode.HALF_UP); if (stripTrailingZeros.scale() > 0) { scale = stripTrailingZeros.precision(); } else { scale = stripTrailingZeros.scale(); } decimalFormat.setMinimumFractionDigits(scale - 1); String format = decimalFormat.format(stripTrailingZeros); int indexOf = format.indexOf("E"); if (indexOf <= 0) { return format; } int parseInt = Integer.parseInt(format.substring(indexOf + 1)); if ((parseInt >= 0 || parseInt <= -7) && (parseInt < 0 || parseInt >= 21)) { return format.replace("E-", "e-").replace("E", "e+"); } return stripTrailingZeros.toPlainString(); } @Override // com.google.android.gms.internal.measurement.zzap public final Iterator zzl() { return null; } @Override // com.google.android.gms.internal.measurement.zzap public final Double zzh() { return this.zza; } }