Skip to content

Commit

Permalink
· Removed decimal 64 related features (WIP)
Browse files Browse the repository at this point in the history
  • Loading branch information
carlosga committed Mar 6, 2024
1 parent e6ce476 commit 6d140dd
Show file tree
Hide file tree
Showing 14 changed files with 1 addition and 957 deletions.
51 changes: 0 additions & 51 deletions src/bid128_add.rs
Original file line number Diff line number Diff line change
Expand Up @@ -14,60 +14,9 @@
use crate::bid_conf::BID_SWAP128;

use crate::bid128::*;
use crate::bid64_to_bid128::bid64_to_bid128;
use crate::bid_internal::*;
use crate::d128::{_IDEC_flags, StatusFlags, RoundingMode};

/////////////////////////////////////
/// BID64/BID128 add
/////////////////////////////////////

pub (crate) fn bid128dd_add(x: BID_UINT64, y: BID_UINT64, rnd_mode: RoundingMode, pfpsf: &mut _IDEC_flags) -> BID_UINT128 {
let x1: BID_UINT128 = bid64_to_bid128(x, pfpsf);
let y1: BID_UINT128 = bid64_to_bid128(y, pfpsf);
let res: BID_UINT128 = bid128_add(&x1, &y1, rnd_mode, pfpsf);
res
}

pub (crate) fn bid128dq_add(x: BID_UINT64, y: &BID_UINT128, rnd_mode: RoundingMode, pfpsf: &mut _IDEC_flags) -> BID_UINT128 {
let x1: BID_UINT128 = bid64_to_bid128(x, pfpsf);
let res: BID_UINT128 = bid128_add(&x1, y, rnd_mode, pfpsf);
res
}

pub (crate) fn bid128qd_add(x: &BID_UINT128, y: BID_UINT64, rnd_mode: RoundingMode, pfpsf: &mut _IDEC_flags) -> BID_UINT128 {
let y1: BID_UINT128 = bid64_to_bid128(y, pfpsf);
let res: BID_UINT128 = bid128_add(x, &y1, rnd_mode, pfpsf);
res
}

// bid128_add stands for bid128qq_add

/////////////////////////////////////
/// BID64/BID128 sub
/////////////////////////////////////

pub (crate) fn bid128dd_sub(x: BID_UINT64, y: BID_UINT64, rnd_mode: RoundingMode, pfpsf: &mut _IDEC_flags) -> BID_UINT128 {
let x1: BID_UINT128 = bid64_to_bid128(x, pfpsf);
let y1: BID_UINT128 = bid64_to_bid128(y, pfpsf);

bid128_sub(&x1, &y1, rnd_mode, pfpsf)
}

pub (crate) fn bid128dq_sub(x: BID_UINT64, y: &BID_UINT128, rnd_mode: RoundingMode, pfpsf: &mut _IDEC_flags) -> BID_UINT128 {
let x1: BID_UINT128 = bid64_to_bid128(x, pfpsf);

bid128_sub(&x1, y, rnd_mode, pfpsf)
}

pub (crate) fn bid128qd_sub(x: &BID_UINT128, y: BID_UINT64, rnd_mode: RoundingMode, pfpsf: &mut _IDEC_flags) -> BID_UINT128 {
let y1: BID_UINT128 = bid64_to_bid128(y, pfpsf);

bid128_sub(x, &y1, rnd_mode, pfpsf)
}

// bid128_sub stands for bid128qq_sub

/////////////////////////////////////
/// BID128 sub
/////////////////////////////////////
Expand Down
125 changes: 0 additions & 125 deletions src/bid128_fma.rs
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,6 @@
use crate::bid_conf::BID_SWAP128;

use crate::bid128::*;
use crate::bid64_to_bid128::{bid64_to_bid128};
use crate::bid_internal::*;
use crate::bid_round::*;
use crate::d128::{_IDEC_flags, StatusFlags, RoundingMode};
Expand Down Expand Up @@ -3933,128 +3932,4 @@ pub (crate) fn bid128_fma(x: &BID_UINT128, y: &BID_UINT128, z: &BID_UINT128, rnd
&mut is_inexact_gt_midpoint,
x, y, z,
rnd_mode, pfpsf)
}

pub (crate) fn bid128ddd_fma(x: BID_UINT64, y: BID_UINT64, z: BID_UINT64, rnd_mode: RoundingMode, pfpsf: &mut _IDEC_flags) -> BID_UINT128 {
let mut is_midpoint_lt_even: bool = false;
let mut is_midpoint_gt_even: bool = false;
let mut is_inexact_lt_midpoint: bool = false;
let mut is_inexact_gt_midpoint: bool = false;

let x1: BID_UINT128 = bid64_to_bid128(x, pfpsf);
let y1: BID_UINT128 = bid64_to_bid128(y, pfpsf);
let z1: BID_UINT128 = bid64_to_bid128(z, pfpsf);

bid128_ext_fma(
&mut is_midpoint_lt_even,
&mut is_midpoint_gt_even,
&mut is_inexact_lt_midpoint,
&mut is_inexact_gt_midpoint,
&x1, &y1, &z1,
rnd_mode, pfpsf)
}

pub (crate) fn bid128ddq_fma(x: BID_UINT64, y: BID_UINT64, z: &BID_UINT128, rnd_mode: RoundingMode, pfpsf: &mut _IDEC_flags) -> BID_UINT128 {
let mut is_midpoint_lt_even = false;
let mut is_midpoint_gt_even = false;
let mut is_inexact_lt_midpoint = false;
let mut is_inexact_gt_midpoint = false;

let x1: BID_UINT128 = bid64_to_bid128(x, pfpsf);
let y1: BID_UINT128 = bid64_to_bid128(y, pfpsf);

bid128_ext_fma(
&mut is_midpoint_lt_even,
&mut is_midpoint_gt_even,
&mut is_inexact_lt_midpoint,
&mut is_inexact_gt_midpoint,
&x1, &y1, z,
rnd_mode, pfpsf)
}

pub (crate) fn bid128dqd_fma(x: BID_UINT64, y: &BID_UINT128, z: BID_UINT64, rnd_mode: RoundingMode, pfpsf: &mut _IDEC_flags) -> BID_UINT128 {
let mut is_midpoint_lt_even: bool = false;
let mut is_midpoint_gt_even: bool = false;
let mut is_inexact_lt_midpoint: bool = false;
let mut is_inexact_gt_midpoint: bool = false;

let x1: BID_UINT128 = bid64_to_bid128(x, pfpsf);
let z1: BID_UINT128 = bid64_to_bid128(z, pfpsf);

bid128_ext_fma(
&mut is_midpoint_lt_even,
&mut is_midpoint_gt_even,
&mut is_inexact_lt_midpoint,
&mut is_inexact_gt_midpoint,
&x1, y, &z1,
rnd_mode, pfpsf)
}

pub (crate) fn bid128dqq_fma(x: BID_UINT64, y: &BID_UINT128, z: &BID_UINT128, rnd_mode: RoundingMode, pfpsf: &mut _IDEC_flags) -> BID_UINT128 {
let mut is_midpoint_lt_even = false;
let mut is_midpoint_gt_even = false;
let mut is_inexact_lt_midpoint = false;
let mut is_inexact_gt_midpoint = false;

let x1: BID_UINT128 = bid64_to_bid128(x, pfpsf);

bid128_ext_fma(
&mut is_midpoint_lt_even,
&mut is_midpoint_gt_even,
&mut is_inexact_lt_midpoint,
&mut is_inexact_gt_midpoint,
&x1, y, z,
rnd_mode, pfpsf)
}

pub (crate) fn bid128qdd_fma(x: &BID_UINT128, y: BID_UINT64, z: BID_UINT64, rnd_mode: RoundingMode, pfpsf: &mut _IDEC_flags) -> BID_UINT128 {
let mut is_midpoint_lt_even = false;
let mut is_midpoint_gt_even = false;
let mut is_inexact_lt_midpoint = false;
let mut is_inexact_gt_midpoint = false;

let y1: BID_UINT128 = bid64_to_bid128(y, pfpsf);
let z1: BID_UINT128 = bid64_to_bid128(z, pfpsf);

bid128_ext_fma(
&mut is_midpoint_lt_even,
&mut is_midpoint_gt_even,
&mut is_inexact_lt_midpoint,
&mut is_inexact_gt_midpoint,
x, &y1, &z1,
rnd_mode, pfpsf)
}

pub (crate) fn bid128qdq_fma(x: &BID_UINT128, y: BID_UINT64, z: &BID_UINT128, rnd_mode: RoundingMode, pfpsf: &mut _IDEC_flags) -> BID_UINT128 {
let mut is_midpoint_lt_even = false;
let mut is_midpoint_gt_even = false;
let mut is_inexact_lt_midpoint = false;
let mut is_inexact_gt_midpoint = false;

let y1: BID_UINT128 = bid64_to_bid128(y, pfpsf);

bid128_ext_fma(
&mut is_midpoint_lt_even,
&mut is_midpoint_gt_even,
&mut is_inexact_lt_midpoint,
&mut is_inexact_gt_midpoint,
x, &y1, z,
rnd_mode, pfpsf)
}

pub (crate) fn bid128qqd_fma(x: &BID_UINT128, y: &BID_UINT128, z: BID_UINT64, rnd_mode: RoundingMode, pfpsf: &mut _IDEC_flags) -> BID_UINT128 {
let mut is_midpoint_lt_even = false;
let mut is_midpoint_gt_even = false;
let mut is_inexact_lt_midpoint = false;
let mut is_inexact_gt_midpoint = false;

let z1: BID_UINT128 = bid64_to_bid128(z, pfpsf);

bid128_ext_fma(
&mut is_midpoint_lt_even,
&mut is_midpoint_gt_even,
&mut is_inexact_lt_midpoint,
&mut is_inexact_gt_midpoint,
x, y, &z1,
rnd_mode, pfpsf)
}
20 changes: 0 additions & 20 deletions src/bid128_mul.rs
Original file line number Diff line number Diff line change
Expand Up @@ -13,29 +13,9 @@
use crate::bid_conf::BID_SWAP128;

use crate::bid128_fma::{bid128_fma};
use crate::bid64_to_bid128::bid64_to_bid128;
use crate::bid_internal::*;
use crate::d128::{_IDEC_flags, RoundingMode};

pub (crate) fn bid128dd_mul(x: &BID_UINT64, y: &BID_UINT64, rnd_mode: RoundingMode, pfpsf: &mut _IDEC_flags) -> BID_UINT128 {
let x1: BID_UINT128 = bid64_to_bid128(*x, pfpsf);
let y1: BID_UINT128 = bid64_to_bid128(*y, pfpsf);

bid128_mul(&x1, &y1, rnd_mode, pfpsf)
}

pub (crate) fn bid128dq_mul(x: &BID_UINT64, y: &BID_UINT128, rnd_mode: RoundingMode, pfpsf: &mut _IDEC_flags) -> BID_UINT128 {
let x1: BID_UINT128 = bid64_to_bid128(*x, pfpsf);

bid128_mul(&x1, y, rnd_mode, pfpsf)
}

pub (crate) fn bid128qd_mul(x: &BID_UINT128, y: &BID_UINT64, rnd_mode: RoundingMode, pfpsf: &mut _IDEC_flags) -> BID_UINT128 {
let y1: BID_UINT128 = bid64_to_bid128(*y, pfpsf);

bid128_mul(x, &y1, rnd_mode, pfpsf)
}

/// Decimal floating-point multiplication
pub (crate) fn bid128_mul(x: &BID_UINT128, y: &BID_UINT128, rnd_mode: RoundingMode, pfpsf: &mut _IDEC_flags) -> BID_UINT128 {
let z: BID_UINT128 = BID_UINT128 { w: [0x0000000000000000u64, 0x5ffe000000000000u64] };
Expand Down
Loading

0 comments on commit 6d140dd

Please sign in to comment.