import numpy as np
import npquad

print("declaring quad from string '1.7'")
q1 = np.quad('1.7')
print("result: {0}".format(str(q1)))

f = float("1.7")
f32 = np.float32("1.7")
f64 = np.float64("1.7")

print("coercing floating point values 1.7 to quad")
q3 = np.quad(f)
print("python float: {0}".format(str(q3)))
q4 = np.quad(f32)
print("numpy float32: {0}".format(str(q4)))
q5 = np.quad(f64)
print("numpy float64: {0}".format(str(q5)))

i = int(2)
i8 = np.int8(2)
i16 = np.int16(2)
i32 = np.int32(2)
i64 = np.int64(2)

print("coercing floating point values 1.7 to quad")
q = np.quad("1.7")
q6 = np.quad(i)
print("python int: {0}".format(str(q6)))
q7 = np.quad(i8)
print("numpy int8: {0}".format(str(q7)))
q8 = np.quad(i16)
print("numpy int16: {0}".format(str(q8)))
q9 = np.quad(i32)
print("numpy int32: {0}".format(str(q9)))
q10 = np.quad(i64)
print("numpy int64: {0}".format(str(q10)))

print("coercing quad values 1.7")
f = float(q)
print("python float: {0}".format(str(f)))
f32 = np.float32(q)
print("numpy float32: {0}".format(str(f32)))
f64 = np.float64(q)
print("numpy float64: {0}".format(str(f64)))
#i = int(q)
#print("python int: {0}".format(str(i)))
i8 = np.int8(q)
print("numpy int8: {0}".format(str(i8)))
i16 = np.int16(q)
print("numpy int16: {0}".format(str(i16)))
i32 = np.int32(q)
print("numpy int32: {0}".format(str(i32)))
i64 = np.int64(q)
print("numpy int64: {0}".format(str(i64)))
q_=np.quad(q)
print("numpy quad: {0}".format(str(q_)))

print("declaring empty array")
ar = np.empty(4, dtype=np.quad)
print(ar)

print("filling it with 1.7")
ar.fill(np.quad("1.7"))
print(ar)

print("assigning value to single elements:")
print("np.float64 2.3 at position 0")
ar[0] = np.float64(2.3)
print(ar)
print("np.int32 4 at position 1")
ar[1] = np.int32(4)
print(ar)

print("declaring zeros array")
ar = np.empty(4, dtype=np.quad)
print(ar)

print("declaring ones array")
ar = np.ones(4, dtype=np.quad)
print(ar)

print("creating np.float64 array")
far = np.empty(4, dtype=np.float64)
far.fill(1.7)
print(far)
print("coercing to quad")
far_toq = far.astype(np.quad)
print(far_toq)
print("dtype:", far_toq.dtype)
print("size:", far_toq.nbytes)

print("creating np.int32 array")
iar = np.empty(4, dtype=np.float64)
iar.fill(2)
print(iar)
print("coercing to quad")
iar_toq = iar.astype(np.quad)
print(iar_toq)
print("dtype:", iar_toq.dtype)
print("size:", iar_toq.nbytes)

print("creating two random 2x2 quad matrices")
mat1 = np.random.rand(2, 2).astype(np.quad)
mat2 = np.random.rand(2, 2).astype(np.quad)
print(mat1)
print(mat2)
print("adding")
print(mat1 + mat2)
print(mat1.astype(np.float64) + mat2.astype(np.float64))
print("multiplying")
print(mat1 * mat2)
print(mat1.astype(np.float64) * mat2.astype(np.float64))
print("exponentiating")
print(mat1 ** mat2)
print(mat1.astype(np.float64) ** mat2.astype(np.float64))
print("matrix multiplying")
print(np.dot(mat1, mat2))
print(np.dot(mat1.astype(np.float64), mat2.astype(np.float64)))


print("multiplying 1st matrix by 2")
print(mat1 * 2)

print("squaring 1st matrix")
print(mat1 ** 2)

print("creating two random 2x2 matrices, quad and float64")
mat1 = np.random.rand(2, 2).astype(np.quad)
mat2 = np.random.rand(2, 2).astype(np.float64)
print(mat1)
print(mat2)
print("adding")
print(mat1 + mat2)
print("multiplying")
print(mat1 * mat2)
print("exponentiating")
print(mat1 ** mat2)

print("creating quad value 1.7")
q = np.quad("1.7")
print("floor")
print(np.floor(q))
print("ceil")
print(np.ceil(q))
print("rint")
print(np.rint(q))
print("square")
print(np.square(q))
print("sqrt")
print(np.sqrt(q))
print("exp")
print(np.exp(q))
print("log")
print(np.log(q))

786314f0225cdcce75b80def15f17cda19c8c832
<mask token>

<mask token>
print("declaring quad from string '1.7'")
<mask token>
print('result: {0}'.format(str(q1)))
<mask token>
print('coercing floating point values 1.7 to quad')
<mask token>
print('python float: {0}'.format(str(q3)))
<mask token>
print('numpy float32: {0}'.format(str(q4)))
<mask token>
print('numpy float64: {0}'.format(str(q5)))
<mask token>
print('coercing floating point values 1.7 to quad')
<mask token>
print('python int: {0}'.format(str(q6)))
<mask token>
print('numpy int8: {0}'.format(str(q7)))
<mask token>
print('numpy int16: {0}'.format(str(q8)))
<mask token>
print('numpy int32: {0}'.format(str(q9)))
<mask token>
print('numpy int64: {0}'.format(str(q10)))
print('coercing quad values 1.7')
<mask token>
print('python float: {0}'.format(str(f)))
<mask token>
print('numpy float32: {0}'.format(str(f32)))
<mask token>
print('numpy float64: {0}'.format(str(f64)))
<mask token>
print('numpy int8: {0}'.format(str(i8)))
<mask token>
print('numpy int16: {0}'.format(str(i16)))
<mask token>
print('numpy int32: {0}'.format(str(i32)))
<mask token>
print('numpy int64: {0}'.format(str(i64)))
<mask token>
print('numpy quad: {0}'.format(str(q_)))
print('declaring empty array')
<mask token>
print(ar)
print('filling it with 1.7')
ar.fill(np.quad('1.7'))
print(ar)
print('assigning value to single elements:')
print('np.float64 2.3 at position 0')
<mask token>
print(ar)
print('np.int32 4 at position 1')
<mask token>
print(ar)
print('declaring zeros array')
<mask token>
print(ar)
print('declaring ones array')
<mask token>
print(ar)
print('creating np.float64 array')
<mask token>
far.fill(1.7)
print(far)
print('coercing to quad')
<mask token>
print(far_toq)
print('dtype:', far_toq.dtype)
print('size:', far_toq.nbytes)
print('creating np.int32 array')
<mask token>
iar.fill(2)
print(iar)
print('coercing to quad')
<mask token>
print(iar_toq)
print('dtype:', iar_toq.dtype)
print('size:', iar_toq.nbytes)
print('creating two random 2x2 quad matrices')
<mask token>
print(mat1)
print(mat2)
print('adding')
print(mat1 + mat2)
print(mat1.astype(np.float64) + mat2.astype(np.float64))
print('multiplying')
print(mat1 * mat2)
print(mat1.astype(np.float64) * mat2.astype(np.float64))
print('exponentiating')
print(mat1 ** mat2)
print(mat1.astype(np.float64) ** mat2.astype(np.float64))
print('matrix multiplying')
print(np.dot(mat1, mat2))
print(np.dot(mat1.astype(np.float64), mat2.astype(np.float64)))
print('multiplying 1st matrix by 2')
print(mat1 * 2)
print('squaring 1st matrix')
print(mat1 ** 2)
print('creating two random 2x2 matrices, quad and float64')
<mask token>
print(mat1)
print(mat2)
print('adding')
print(mat1 + mat2)
print('multiplying')
print(mat1 * mat2)
print('exponentiating')
print(mat1 ** mat2)
print('creating quad value 1.7')
<mask token>
print('floor')
print(np.floor(q))
print('ceil')
print(np.ceil(q))
print('rint')
print(np.rint(q))
print('square')
print(np.square(q))
print('sqrt')
print(np.sqrt(q))
print('exp')
print(np.exp(q))
print('log')
print(np.log(q))

<mask token>
print("declaring quad from string '1.7'")
q1 = np.quad('1.7')
print('result: {0}'.format(str(q1)))
f = float('1.7')
f32 = np.float32('1.7')
f64 = np.float64('1.7')
print('coercing floating point values 1.7 to quad')
q3 = np.quad(f)
print('python float: {0}'.format(str(q3)))
q4 = np.quad(f32)
print('numpy float32: {0}'.format(str(q4)))
q5 = np.quad(f64)
print('numpy float64: {0}'.format(str(q5)))
i = int(2)
i8 = np.int8(2)
i16 = np.int16(2)
i32 = np.int32(2)
i64 = np.int64(2)
print('coercing floating point values 1.7 to quad')
q = np.quad('1.7')
q6 = np.quad(i)
print('python int: {0}'.format(str(q6)))
q7 = np.quad(i8)
print('numpy int8: {0}'.format(str(q7)))
q8 = np.quad(i16)
print('numpy int16: {0}'.format(str(q8)))
q9 = np.quad(i32)
print('numpy int32: {0}'.format(str(q9)))
q10 = np.quad(i64)
print('numpy int64: {0}'.format(str(q10)))
print('coercing quad values 1.7')
f = float(q)
print('python float: {0}'.format(str(f)))
f32 = np.float32(q)
print('numpy float32: {0}'.format(str(f32)))
f64 = np.float64(q)
print('numpy float64: {0}'.format(str(f64)))
i8 = np.int8(q)
print('numpy int8: {0}'.format(str(i8)))
i16 = np.int16(q)
print('numpy int16: {0}'.format(str(i16)))
i32 = np.int32(q)
print('numpy int32: {0}'.format(str(i32)))
i64 = np.int64(q)
print('numpy int64: {0}'.format(str(i64)))
q_ = np.quad(q)
print('numpy quad: {0}'.format(str(q_)))
print('declaring empty array')
ar = np.empty(4, dtype=np.quad)
print(ar)
print('filling it with 1.7')
ar.fill(np.quad('1.7'))
print(ar)
print('assigning value to single elements:')
print('np.float64 2.3 at position 0')
ar[0] = np.float64(2.3)
print(ar)
print('np.int32 4 at position 1')
ar[1] = np.int32(4)
print(ar)
print('declaring zeros array')
ar = np.empty(4, dtype=np.quad)
print(ar)
print('declaring ones array')
ar = np.ones(4, dtype=np.quad)
print(ar)
print('creating np.float64 array')
far = np.empty(4, dtype=np.float64)
far.fill(1.7)
print(far)
print('coercing to quad')
far_toq = far.astype(np.quad)
print(far_toq)
print('dtype:', far_toq.dtype)
print('size:', far_toq.nbytes)
print('creating np.int32 array')
iar = np.empty(4, dtype=np.float64)
iar.fill(2)
print(iar)
print('coercing to quad')
iar_toq = iar.astype(np.quad)
print(iar_toq)
print('dtype:', iar_toq.dtype)
print('size:', iar_toq.nbytes)
print('creating two random 2x2 quad matrices')
mat1 = np.random.rand(2, 2).astype(np.quad)
mat2 = np.random.rand(2, 2).astype(np.quad)
print(mat1)
print(mat2)
print('adding')
print(mat1 + mat2)
print(mat1.astype(np.float64) + mat2.astype(np.float64))
print('multiplying')
print(mat1 * mat2)
print(mat1.astype(np.float64) * mat2.astype(np.float64))
print('exponentiating')
print(mat1 ** mat2)
print(mat1.astype(np.float64) ** mat2.astype(np.float64))
print('matrix multiplying')
print(np.dot(mat1, mat2))
print(np.dot(mat1.astype(np.float64), mat2.astype(np.float64)))
print('multiplying 1st matrix by 2')
print(mat1 * 2)
print('squaring 1st matrix')
print(mat1 ** 2)
print('creating two random 2x2 matrices, quad and float64')
mat1 = np.random.rand(2, 2).astype(np.quad)
mat2 = np.random.rand(2, 2).astype(np.float64)
print(mat1)
print(mat2)
print('adding')
print(mat1 + mat2)
print('multiplying')
print(mat1 * mat2)
print('exponentiating')
print(mat1 ** mat2)
print('creating quad value 1.7')
q = np.quad('1.7')
print('floor')
print(np.floor(q))
print('ceil')
print(np.ceil(q))
print('rint')
print(np.rint(q))
print('square')
print(np.square(q))
print('sqrt')
print(np.sqrt(q))
print('exp')
print(np.exp(q))
print('log')
print(np.log(q))

import numpy as np
import npquad
print("declaring quad from string '1.7'")
q1 = np.quad('1.7')
print('result: {0}'.format(str(q1)))
f = float('1.7')
f32 = np.float32('1.7')
f64 = np.float64('1.7')
print('coercing floating point values 1.7 to quad')
q3 = np.quad(f)
print('python float: {0}'.format(str(q3)))
q4 = np.quad(f32)
print('numpy float32: {0}'.format(str(q4)))
q5 = np.quad(f64)
print('numpy float64: {0}'.format(str(q5)))
i = int(2)
i8 = np.int8(2)
i16 = np.int16(2)
i32 = np.int32(2)
i64 = np.int64(2)
print('coercing floating point values 1.7 to quad')
q = np.quad('1.7')
q6 = np.quad(i)
print('python int: {0}'.format(str(q6)))
q7 = np.quad(i8)
print('numpy int8: {0}'.format(str(q7)))
q8 = np.quad(i16)
print('numpy int16: {0}'.format(str(q8)))
q9 = np.quad(i32)
print('numpy int32: {0}'.format(str(q9)))
q10 = np.quad(i64)
print('numpy int64: {0}'.format(str(q10)))
print('coercing quad values 1.7')
f = float(q)
print('python float: {0}'.format(str(f)))
f32 = np.float32(q)
print('numpy float32: {0}'.format(str(f32)))
f64 = np.float64(q)
print('numpy float64: {0}'.format(str(f64)))
i8 = np.int8(q)
print('numpy int8: {0}'.format(str(i8)))
i16 = np.int16(q)
print('numpy int16: {0}'.format(str(i16)))
i32 = np.int32(q)
print('numpy int32: {0}'.format(str(i32)))
i64 = np.int64(q)
print('numpy int64: {0}'.format(str(i64)))
q_ = np.quad(q)
print('numpy quad: {0}'.format(str(q_)))
print('declaring empty array')
ar = np.empty(4, dtype=np.quad)
print(ar)
print('filling it with 1.7')
ar.fill(np.quad('1.7'))
print(ar)
print('assigning value to single elements:')
print('np.float64 2.3 at position 0')
ar[0] = np.float64(2.3)
print(ar)
print('np.int32 4 at position 1')
ar[1] = np.int32(4)
print(ar)
print('declaring zeros array')
ar = np.empty(4, dtype=np.quad)
print(ar)
print('declaring ones array')
ar = np.ones(4, dtype=np.quad)
print(ar)
print('creating np.float64 array')
far = np.empty(4, dtype=np.float64)
far.fill(1.7)
print(far)
print('coercing to quad')
far_toq = far.astype(np.quad)
print(far_toq)
print('dtype:', far_toq.dtype)
print('size:', far_toq.nbytes)
print('creating np.int32 array')
iar = np.empty(4, dtype=np.float64)
iar.fill(2)
print(iar)
print('coercing to quad')
iar_toq = iar.astype(np.quad)
print(iar_toq)
print('dtype:', iar_toq.dtype)
print('size:', iar_toq.nbytes)
print('creating two random 2x2 quad matrices')
mat1 = np.random.rand(2, 2).astype(np.quad)
mat2 = np.random.rand(2, 2).astype(np.quad)
print(mat1)
print(mat2)
print('adding')
print(mat1 + mat2)
print(mat1.astype(np.float64) + mat2.astype(np.float64))
print('multiplying')
print(mat1 * mat2)
print(mat1.astype(np.float64) * mat2.astype(np.float64))
print('exponentiating')
print(mat1 ** mat2)
print(mat1.astype(np.float64) ** mat2.astype(np.float64))
print('matrix multiplying')
print(np.dot(mat1, mat2))
print(np.dot(mat1.astype(np.float64), mat2.astype(np.float64)))
print('multiplying 1st matrix by 2')
print(mat1 * 2)
print('squaring 1st matrix')
print(mat1 ** 2)
print('creating two random 2x2 matrices, quad and float64')
mat1 = np.random.rand(2, 2).astype(np.quad)
mat2 = np.random.rand(2, 2).astype(np.float64)
print(mat1)
print(mat2)
print('adding')
print(mat1 + mat2)
print('multiplying')
print(mat1 * mat2)
print('exponentiating')
print(mat1 ** mat2)
print('creating quad value 1.7')
q = np.quad('1.7')
print('floor')
print(np.floor(q))
print('ceil')
print(np.ceil(q))
print('rint')
print(np.rint(q))
print('square')
print(np.square(q))
print('sqrt')
print(np.sqrt(q))
print('exp')
print(np.exp(q))
print('log')
print(np.log(q))

import numpy as np
import npquad

print("declaring quad from string '1.7'")
q1 = np.quad('1.7')
print("result: {0}".format(str(q1)))

f = float("1.7")
f32 = np.float32("1.7")
f64 = np.float64("1.7")

print("coercing floating point values 1.7 to quad")
q3 = np.quad(f)
print("python float: {0}".format(str(q3)))
q4 = np.quad(f32)
print("numpy float32: {0}".format(str(q4)))
q5 = np.quad(f64)
print("numpy float64: {0}".format(str(q5)))

i = int(2)
i8 = np.int8(2)
i16 = np.int16(2)
i32 = np.int32(2)
i64 = np.int64(2)

print("coercing floating point values 1.7 to quad")
q = np.quad("1.7")
q6 = np.quad(i)
print("python int: {0}".format(str(q6)))
q7 = np.quad(i8)
print("numpy int8: {0}".format(str(q7)))
q8 = np.quad(i16)
print("numpy int16: {0}".format(str(q8)))
q9 = np.quad(i32)
print("numpy int32: {0}".format(str(q9)))
q10 = np.quad(i64)
print("numpy int64: {0}".format(str(q10)))

print("coercing quad values 1.7")
f = float(q)
print("python float: {0}".format(str(f)))
f32 = np.float32(q)
print("numpy float32: {0}".format(str(f32)))
f64 = np.float64(q)
print("numpy float64: {0}".format(str(f64)))
#i = int(q)
#print("python int: {0}".format(str(i)))
i8 = np.int8(q)
print("numpy int8: {0}".format(str(i8)))
i16 = np.int16(q)
print("numpy int16: {0}".format(str(i16)))
i32 = np.int32(q)
print("numpy int32: {0}".format(str(i32)))
i64 = np.int64(q)
print("numpy int64: {0}".format(str(i64)))
q_=np.quad(q)
print("numpy quad: {0}".format(str(q_)))

print("declaring empty array")
ar = np.empty(4, dtype=np.quad)
print(ar)

print("filling it with 1.7")
ar.fill(np.quad("1.7"))
print(ar)

print("assigning value to single elements:")
print("np.float64 2.3 at position 0")
ar[0] = np.float64(2.3)
print(ar)
print("np.int32 4 at position 1")
ar[1] = np.int32(4)
print(ar)

print("declaring zeros array")
ar = np.empty(4, dtype=np.quad)
print(ar)

print("declaring ones array")
ar = np.ones(4, dtype=np.quad)
print(ar)

print("creating np.float64 array")
far = np.empty(4, dtype=np.float64)
far.fill(1.7)
print(far)
print("coercing to quad")
far_toq = far.astype(np.quad)
print(far_toq)
print("dtype:", far_toq.dtype)
print("size:", far_toq.nbytes)

print("creating np.int32 array")
iar = np.empty(4, dtype=np.float64)
iar.fill(2)
print(iar)
print("coercing to quad")
iar_toq = iar.astype(np.quad)
print(iar_toq)
print("dtype:", iar_toq.dtype)
print("size:", iar_toq.nbytes)

print("creating two random 2x2 quad matrices")
mat1 = np.random.rand(2, 2).astype(np.quad)
mat2 = np.random.rand(2, 2).astype(np.quad)
print(mat1)
print(mat2)
print("adding")
print(mat1 + mat2)
print(mat1.astype(np.float64) + mat2.astype(np.float64))
print("multiplying")
print(mat1 * mat2)
print(mat1.astype(np.float64) * mat2.astype(np.float64))
print("exponentiating")
print(mat1 ** mat2)
print(mat1.astype(np.float64) ** mat2.astype(np.float64))
print("matrix multiplying")
print(np.dot(mat1, mat2))
print(np.dot(mat1.astype(np.float64), mat2.astype(np.float64)))


print("multiplying 1st matrix by 2")
print(mat1 * 2)

print("squaring 1st matrix")
print(mat1 ** 2)

print("creating two random 2x2 matrices, quad and float64")
mat1 = np.random.rand(2, 2).astype(np.quad)
mat2 = np.random.rand(2, 2).astype(np.float64)
print(mat1)
print(mat2)
print("adding")
print(mat1 + mat2)
print("multiplying")
print(mat1 * mat2)
print("exponentiating")
print(mat1 ** mat2)

print("creating quad value 1.7")
q = np.quad("1.7")
print("floor")
print(np.floor(q))
print("ceil")
print(np.ceil(q))
print("rint")
print(np.rint(q))
print("square")
print(np.square(q))
print("sqrt")
print(np.sqrt(q))
print("exp")
print(np.exp(q))
print("log")
print(np.log(q))
