File tree Expand file tree Collapse file tree 1 file changed +33
-0
lines changed
include/boost/multiprecision Expand file tree Collapse file tree 1 file changed +33
-0
lines changed Original file line number Diff line number Diff line change @@ -680,6 +680,39 @@ class cpp_double_fp_backend
680
680
681
681
float_type u { cpp_df_qf_detail::split (float_type ()) * v.data .first };
682
682
683
+ if (cpp_df_qf_detail::ccmath::isinf (u))
684
+ {
685
+ // Evidently we have a very large denominator. Let's take a last chance
686
+ // for finite division. Use the ratio of square roots and subsequently
687
+ // square the ratio, handling the sign of the result separately.
688
+
689
+ const bool u_neg { isneg () };
690
+ const bool v_neg { v.isneg () };
691
+ const bool b_neg { u_neg != v_neg };
692
+
693
+ cpp_double_fp_backend uu { *this };
694
+ cpp_double_fp_backend vv { v };
695
+
696
+ cpp_double_fp_backend sqrt_u { };
697
+ cpp_double_fp_backend sqrt_v { };
698
+
699
+ if (u_neg) { uu.negate (); }
700
+ if (v_neg) { vv.negate (); }
701
+
702
+ eval_sqrt (sqrt_u, uu);
703
+ eval_sqrt (sqrt_v, vv);
704
+
705
+ cpp_double_fp_backend sqrt_ratio { sqrt_u / sqrt_v };
706
+
707
+ *this = sqrt_ratio;
708
+
709
+ eval_multiply (*this , sqrt_ratio);
710
+
711
+ if (b_neg)
712
+ negate ();
713
+ return *this ;
714
+ }
715
+
683
716
const float_type hc { c - float_type { c - C } };
684
717
685
718
const float_type hv { u - float_type { u - v.data .first } };
You can’t perform that action at this time.
0 commit comments