Commit db47b3b9 authored by Cerlane Leong's avatar Cerlane Leong 💬

CPP support integer casting, always round down

parent 2f20769a
......@@ -242,9 +242,9 @@ struct posit8{
return convertP8ToDouble(castP8(value));
}
/*int toInteger()const{
return p8_to_i32(p8_floor(castP8(value)));
}*/
long long int toInteger()const{
return p8_int(castP8(value));
}
posit8& fma(posit8 a, posit8 b){ // += (a*b)
value = castUI(p8_mulAdd(castP8(a.value), castP8(b.value), castP8(value)));
......@@ -470,9 +470,9 @@ struct posit16{
return convertP16ToDouble(castP16(value));
}
/*int toInteger()const{
return p16_to_i32(p16_floor(castP16(value)));
}*/
long long int toInteger()const{
return p16_int(castP16(value));
}
posit16& fma(posit16 a, posit16 b){ // += (a*b)
value = castUI(p16_mulAdd(castP16(a.value), castP16(b.value), castP16(value)));
......@@ -698,9 +698,9 @@ struct posit32{
return convertP32ToDouble(castP32(value));
}
/*int toInteger()const{
return p32_to_i32(p32_floor(castP32(value)));
}*/
long long int toInteger()const{
return p32_int(castP32(value));;
}
posit32& fma(posit32 a, posit32 b){ // += (a*b)
value = castUI(p32_mulAdd(castP32(a.value), castP32(b.value), castP32(value)));
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment