def EncryptFloat(self, plaintext, r_value=None):
    if not isinstance(plaintext, float):
      raise ValueError('Expected float plaintext but got: %s' % type(plaintext))

    input_as_long = struct.unpack('Q', struct.pack('d', plaintext))[0]
    mantissa = (input_as_long & 0xfffffffffffff) | 0x10000000000000
    exponent = ((input_as_long >> 52) & 0x7ff) - EXPONENT_BIAS
    sign = input_as_long >> (EXPLICIT_MANTISSA_BITS + EXPONENT_BITS)
    if IsNan(plaintext):
      # Put a 1 in the 32 bit nan indicator field.
      plaintext = 0x00000001 << FLOAT_NAN_LSB  # << 991
    elif IsInfPlus(plaintext):
      # Put a 1 in the 32 bit plus inf indicator field.
      plaintext = 0x00000001 << FLOAT_PLUSINF_LSB  # << 959
    elif IsInfMinus(plaintext):
      # Put a 1 in the 32 bit minus inf indicator field.
      plaintext = 0x00000001 << FLOAT_MINUSINF_LSB  # << 927
    elif exponent == 0 and mantissa == 0:  # explicit 0
      plaintext = 0
    elif exponent > FLOAT_MANTISSA_ZERO:  # > 389
      # Can't represent such large numbers
      raise ValueError('Floats with exponents larger than 389 are currently '
                       'not suppported.')
    elif exponent < -FLOAT_MANTISSA_ZERO - EXPLICIT_MANTISSA_BITS:  # < -389 -52
      # too small, set to zero
      plaintext = 0
    else:  # representable numbers with -441 <= exponent <= 389.
      # Place 53 bit mantissa (1 + 52 explicit bit mantissa in 831 bit payload
      # and shift according to exponent.
      # - first put 53 bit mantissa on the left most side of payload
      plaintext = mantissa << FLOAT_MANTISSA_LSB  # << 778
      # - second shift right as needed.
      plaintext >>= (FLOAT_MANTISSA_ZERO - exponent)  # >>= (389 - exponent)
      # Find 2s complement if number is negative
      if sign == 1:  # neg number
        # make 895 bit (831 + 64 extended sign bits) 2s complement
        plaintext = (plaintext  ^ _ONES_CARRYOVER_LSB) + 1L
    return self.Encrypt(plaintext, r_value=r_value)
Test to make sure we can set the disk timeout value
dataset/ETHPy150Open google/encrypted-bigquery-client/src/paillier.py/Paillier.EncryptFloat--crossover with--dataset/ETHPy150Open saltstack/salt/tests/unit/modules/win_powercfg_test.py/PowerCfgTestCase.test_set_disk_timeout