您当前的位置:首页 > IT编程 > C++
| C语言 | Java | VB | VC | python | Android | TensorFlow | C++ | oracle | 学术与代码 | cnn卷积神经网络 | gnn | 图像修复 | Keras | 数据集 | Neo4j | 自然语言处理 | 深度学习 | 医学CAD | 医学影像 | 超参数 | pointnet | pytorch | 异常检测 | Transformers | 情感分类 | 知识图谱 |

自学教程:C++ Double函数代码示例

51自学网 2021-06-01 20:29:46
  C++
这篇教程C++ Double函数代码示例写得很实用,希望能帮到您。

本文整理汇总了C++中Double函数的典型用法代码示例。如果您正苦于以下问题:C++ Double函数的具体用法?C++ Double怎么用?C++ Double使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。

在下文中一共展示了Double函数的28个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C++代码示例。

示例1: MSG_DEBUG

void Plane::Shoot(Double speed, const Point2i& target){  MSG_DEBUG("weapon.shoot", "Plane Shoot");  nb_dropped_bombs = 0;  last_dropped_bomb = NULL;  cible_x = target.x;  SetY(0);  distance_to_release = (int)(speed * sqrt(TWO * (GetY() + target.y)));  Point2d speed_vector;  if (ActiveCharacter().GetDirection() == DIRECTION_RIGHT) {    image->SetFlipped(false);    speed_vector.SetValues(speed, 0);    SetX(ONE - Double(image->GetWidth()));    //distance_to_release -= obus_dx;   if (distance_to_release > cible_x)     distance_to_release = 0;  } else {    image->SetFlipped(true);    speed_vector.SetValues(-speed, 0) ;    SetX(Double(GetWorld().GetWidth() - 1));    //distance_to_release += obus_dx;    if (distance_to_release > GetWorld().GetWidth()-cible_x - obus_dx)      distance_to_release = 0;  }  SetSpeedXY(speed_vector);  Camera::GetInstance()->FollowObject(this);  ObjectsList::GetRef().AddObject(this);}
开发者ID:yeKcim,项目名称:warmux,代码行数:34,


示例2: scale

void PictureWidget::ApplyScaling(ScalingType t){  if (spr) {    Point2d scale(Double(size.x) / picture_size.x,                  Double(size.y) / picture_size.y);    if (size.x==0 || size.y==0)      return;    switch (t) {    case NO_SCALING: break;    case X_SCALING: spr->Scale(scale.x, 1.0); break;    case Y_SCALING: spr->Scale(1.0, scale.x); break;    case STRETCH_SCALING: spr->Scale(scale.x, scale.y); break;    case FIT_SCALING:    default:      {        Double zoom = std::min(scale.x, scale.y);        spr->Scale(zoom, zoom);        break;      }    }  }  type = t;}
开发者ID:fluxer,项目名称:warmux,代码行数:26,


示例3: Print

    // **************************************************************    void Print()    {        Double memsize = Double(n) * sizeof(Double);        std::string suffix;        if(memsize >= 1.024e3)        {            memsize *= Double(1.0/1.024e3);            suffix = "ki";        }        if(memsize >= 1.024e3)        {            memsize *= Double(1.0/1.024e3);            suffix = "Mi";        }        if(memsize >= 1.024e3)        {            memsize *= Double(1.0/1.024e3);            suffix = "Gi";        }        std_cout.Clear_Format();        std_cout            << "Lookup table information:/n"            << "    Name:               " << name << "/n"            << "    Range:              [" << range_min << ", " << range_max << "]/n"            << "    Number of points:   " << n << "/n"            << "    dx:                 " << dx << "/n"            << "    Size:               " << memsize << " " << suffix << "B/n"            << "    Pointer:            " << table << "/n";    }
开发者ID:nbigaouette,项目名称:memory,代码行数:31,


示例4: CheckFront

void FastMarch2D::FindPhi(int index, int x, int y) {	static Double phiX, phiY, phiZ, b, quotient, phi;    static int a;    static bool flagX, flagY;    phiX = phiY = phiZ = 0.;    a = 0;    flagX = flagY = 0;	//Find The phiS	CheckFront (phiX, a, flagX, GI(x+1,  y));	CheckBehind(phiX, a, flagX, GI(x-1,  y));	CheckFront (phiY, a, flagY, GI(x  ,y+1));	CheckBehind(phiY, a, flagY, GI(x  ,y-1));	//Max Tests	if(a == 2) {		if(phiX >= phiY) CheckMax2(a, phiX, phiY);		else			 CheckMax2(a, phiY, phiX);	}	b = phiX + phiY + phiZ;	quotient = square(b) - 		Double(a) * (square(phiX) + square(phiY) + square(phiZ) - square(h));	if(quotient < 0.) cout << "0 ";	else {		phi = b + sqrt(quotient);		phi /= Double(a);		grid[index].value = phi;		if(grid[index].HeapPosition == -1) AddToHeap(index);	    else                               UpdateHeap(index); 	}}
开发者ID:pizibing,项目名称:particlelevelsetlibrary,代码行数:33,


示例5: applyV

obj applyV(double (*func)(double), obj v, obj name){	if(type(v)==tDouble)	return Double(func(udbl(v)));	if(type(v)==INT)	return Double(func(uint(v)));	if(type(v) == tDblArray) {		DblArray* a;		a = &(udar(v));		obj r = dblArray(a->size);//		obj r = new dblarr(a->size);		for(int i=0; i<(a->size); i++) udar(r).v[i] = func(a->v[i]);		return r;	}	if(isVec(type(v))){		int len = size(v);		obj r = aArray(len);		for(int i=0; i<len; i++){			obj lt = ind(v,i);			uar(r).v[i] = applyV(func, lt, name); 			release(lt);		}		return r;	}	if(type(v)==LIST){		list l = nil;		for(list l1 = ul(v); l1; l1=rest(l1)){			l = cons(applyV(func,first(l1), name), l);		}		return List2v(reverse(l));	}	obj rr=nil;	if(name){		rr = udef_op0(name, v);	}	if(!rr) error("func: argument must be a scalar or an array.");	return rr;}
开发者ID:mogami29,项目名称:cipher-shell,代码行数:35,


示例6: assert

Double Double::operator-(const Double& d) const {	if (fabs(_d - d._d) < parameter::small_epsilon()) return Double();	assert(_d >= d._d);	if (_d - d._d > LOG_BIGVAL) return *this;	else return Double(true, d._d + log(exp(_d - d._d) - 1));}
开发者ID:arne-cl,项目名称:turian-parser,代码行数:7,


示例7:

void IERandom::Vec3(IEVector3& result,					const IEVector3& mean,					const IEVector3& variance){	result.setX(static_cast<float>(Double(mean.getX(), variance.getX())));	result.setY(static_cast<float>(Double(mean.getY(), variance.getY())));	result.setZ(static_cast<float>(Double(mean.getZ(), variance.getZ())));}
开发者ID:yalcinerbora,项目名称:GIThesis,代码行数:8,


示例8: Double

void Polecat::Fart(){  // particles must be exactly the same accross the network  Double norme = Double(RandomSync().GetInt(0, 500))/100;  Double angle = Double(RandomSync().GetInt(0, 3000))/100;  ParticleEngine::AddNow(GetPosition(), 3, particle_POLECAT_FART, true, angle, norme);  last_fart_time = GameTime::GetInstance()->Read();  JukeBox::GetInstance()->Play("default", "weapon/polecat_fart");}
开发者ID:Arnaud474,项目名称:Warmux,代码行数:9,


示例9: Quat

void IERandom::Quat(IEQuaternion& result,					const IEQuaternion& mean,					const IEQuaternion& variance){	result.setX(static_cast<float>(Double(mean.getX(), variance.getX())));	result.setY(static_cast<float>(Double(mean.getY(), variance.getY())));	result.setZ(static_cast<float>(Double(mean.getZ(), variance.getZ())));	result.setW(static_cast<float>(Double(mean.getW(), variance.getW())));}
开发者ID:yalcinerbora,项目名称:GIThesis,代码行数:9,


示例10: IsLargeSizeDifference

/** * Checks if the size difference of any dimension is more than a * factor of two.  This is used to check whether the terrain has to be * redrawn after zooming in. */static boolIsLargeSizeDifference(const GeoBounds &a, const GeoBounds &b){  assert(a.IsValid());  assert(b.IsValid());  return a.GetWidth().Native() > Double(b.GetWidth().Native()) ||    a.GetHeight().Native() > Double(b.GetHeight().Native());}
开发者ID:MindMil,项目名称:XCSoar,代码行数:14,


示例11: bez

bool Path::PointInside(const Objects & objects, const Vec2 & pt, bool debug) const{	vector<Vec2> x_ints;	vector<Vec2> y_ints;	for (unsigned i = m_start; i <= m_end; ++i)	{		Bezier bez(objects.beziers[objects.data_indices[i]].ToAbsolute(objects.bounds[i]));		vector<Vec2> xi(bez.SolveX(pt.x));		vector<Vec2> yi(bez.SolveY(pt.y));		x_ints.insert(x_ints.end(), xi.begin(), xi.end());		y_ints.insert(y_ints.end(), yi.begin(), yi.end());	}	//Debug("Solved for intersections");	unsigned bigger = 0;	unsigned smaller = 0;	for (unsigned i = 0; i < x_ints.size(); ++i)	{		if (debug)				Debug("X Intersection %u at %f,%f vs %f,%f", i,Double(x_ints[i].x), Double(x_ints[i].y), Double(pt.x), Double(pt.y));		if (x_ints[i].y >= pt.y)		{						++bigger;		}	}	smaller = x_ints.size() - bigger;	if (debug)	{		Debug("%u horizontal, %u bigger, %u smaller", x_ints.size(), bigger, smaller);	}	if (smaller % 2 == 0 || bigger % 2 == 0)		return false;			bigger = 0;	smaller = 0;	for (unsigned i = 0; i < y_ints.size(); ++i)	{		if (debug)				Debug("Y Intersection %u at %f,%f vs %f,%f", i,Double(y_ints[i].x), Double(y_ints[i].y), Double(pt.x), Double(pt.y));		if (y_ints[i].x >= pt.x)		{						++bigger;		}	}	smaller = y_ints.size() - bigger;	if (debug)	{		Debug("%u vertical, %u bigger, %u smaller", y_ints.size(), bigger, smaller);	}	if (smaller % 2 == 0 || bigger % 2 == 0)		return false;					return true;}
开发者ID:szmoore,项目名称:ipdf-code,代码行数:57,


示例12: vector

 void DoubleToStringConverter::DoubleToAscii(double v,                                             DtoaMode mode,                                             int requested_digits,                                             char* buffer,                                             int buffer_length,                                             bool* sign,                                             int* length,                                             int* point) {     Vector<char> vector(buffer, buffer_length);     ASSERT(!Double(v).IsSpecial());     ASSERT(mode == SHORTEST || requested_digits >= 0);          if (Double(v).Sign() < 0) {         *sign = true;         v = -v;     } else {         *sign = false;     }          if (mode == PRECISION && requested_digits == 0) {         vector[0] = '/0';         *length = 0;         return;     }          if (v == 0) {         vector[0] = '0';         vector[1] = '/0';         *length = 1;         *point = 1;         return;     }          bool fast_worked;     switch (mode) {         case SHORTEST:             fast_worked = FastDtoa(v, FAST_DTOA_SHORTEST, 0, vector, length, point);             break;         case FIXED:             fast_worked = FastFixedDtoa(v, requested_digits, vector, length, point);             break;         case PRECISION:             fast_worked = FastDtoa(v, FAST_DTOA_PRECISION, requested_digits,                                    vector, length, point);             break;         default:             UNREACHABLE();             fast_worked = false;     }     if (fast_worked) return;          // If the fast dtoa didn't succeed use the slower bignum version.     BignumDtoaMode bignum_mode = DtoaToBignumDtoaMode(mode);     BignumDtoa(v, bignum_mode, requested_digits, vector, length, point);     vector[*length] = '/0'; }
开发者ID:emuikernel,项目名称:EAWebKit,代码行数:56,


示例13: CORRADE_COMPARE

void AngleTest::construct() {    /* Default constructor */    constexpr Deg m1;    constexpr Deg m2{ZeroInit};    CORRADE_COMPARE(Float(m1), 0.0f);    CORRADE_COMPARE(Float(m2), 0.0f);    #ifndef MAGNUM_TARGET_GLES    constexpr Radd a1;    constexpr Radd a2{ZeroInit};    CORRADE_COMPARE(Double(a1), 0.0);    CORRADE_COMPARE(Double(a2), 0.0);    #else    constexpr Rad a1;    constexpr Rad a2{ZeroInit};    CORRADE_COMPARE(Float(a1), 0.0f);    CORRADE_COMPARE(Float(a2), 0.0f);    #endif    /* Value constructor */    constexpr Deg b(25.0);    CORRADE_COMPARE(Float(b), 25.0f);    #ifndef MAGNUM_TARGET_GLES    constexpr Radd n(3.14);    CORRADE_COMPARE(Double(n), 3.14);    #else    constexpr Rad n(3.14);    CORRADE_COMPARE(Float(n), 3.14f);    #endif    /* Copy constructor */    constexpr Deg c(b);    CORRADE_COMPARE(c, b);    #ifndef MAGNUM_TARGET_GLES    constexpr Radd o(n);    CORRADE_COMPARE(o, n);    #else    constexpr Rad o(n);    CORRADE_COMPARE(o, n);    #endif    /* Conversion operator */    constexpr Rad p(n);    CORRADE_COMPARE(Float(p), 3.14f);    #ifndef MAGNUM_TARGET_GLES    constexpr Degd d(b);    CORRADE_COMPARE(Double(d), 25.0);    #else    constexpr Deg d(b);    CORRADE_COMPARE(Float(d), 25.0f);    #endif}
开发者ID:Asuzer,项目名称:magnum,代码行数:51,


示例14: Double

Real Gaussian_<Real>::cdf(Real x) const{    static const Double a1 = 0.31938153, a2 = -0.356563782, a3 = 1.781477937, a4 = -1.821255978, a5 = 1.330274429;    static const Double sqrtTwoPi = Alge_d::sqrt(Double_::piTwo);    Double xz = Double(x-mu) / Double(sigma);    Double L = Alge_d::abs(xz);    Double K = 1 / (1 + 0.2316419 * L);    Double w = 1 - 1 / sqrtTwoPi * Alge_d::exp(-L * L / 2) * (a1 * K + a2 * K * K + a3 * Alge_d::pow(K,3) + a4 * Alge_d::pow(K,4) + a5 * Alge_d::pow(K,5));    if (xz < 0)        w = 1 - w;    return w;}
开发者ID:srish13,项目名称:Honeycomb,代码行数:14,


示例15: Check

void Check() { // expected-note{{'Check' declared here}}  if (toFoobar()) Double(7); // expected-error{{use of undeclared identifier 'toFoobar'; did you mean 'barstool::toFoobar'?}}  if (noFoobar()) Double(7); // expected-error{{use of undeclared identifier 'noFoobar'; did you mean 'barstool::toFoobar'?}}  if (moreFoobar()) Double(7); // expected-error{{use of undeclared identifier 'moreFoobar'; did you mean 'fizbin::nested::moreFoobar'}}  if (lessFoobar()) Double(7); // expected-error{{use of undeclared identifier 'lessFoobar'; did you mean 'fizbin::nested::lessFoobar'?}}  if (baztool::toFoobar()) Double(7); // expected-error{{use of undeclared identifier 'baztool'; did you mean 'fizbin::baztool'?}}  if (nested::moreFoobar()) Double(7); // expected-error{{use of undeclared identifier 'nested'; did you mean 'fizbin::nested'?}}  if (dummy::moreFoobar()) Double(7); // expected-error{{use of undeclared identifier 'dummy'; did you mean 'fizbin::dummy'?}}  if (dummy::mreFoobar()) Double(7); // expected-error{{use of undeclared identifier 'dummy'; did you mean 'fizbin::dummy'?}} /                                     // expected-error{{no member named 'mreFoobar' in 'fizbin::dummy'; did you mean 'moreFoobar'?}}  if (moFoobin()) Double(7); // expected-error{{use of undeclared identifier 'moFoobin'}}}
开发者ID:melanierk,项目名称:Harmony-PBV,代码行数:12,


示例16: switch

//  Choose applicable inaccuracy functions for current game mode and target typevoid Player::Inaccuracy(){	int i = 0;	if (p_colinmode) {		switch (p_targettype) {			case 0: ColinSingle(); break;			case 1: ColinSingle(); break;			case 2: ColinDouble(); break;			case 3: ColinTreble(); break;			case 4: ColinBull(); break;				}		if (p_targettype == 2 || p_targettype == 3) {			for (i = 0; boardpoints[i] != p_hit/p_targettype; i++){				}			p_targetindex = i;		} else if (p_targettype == 0) {			for (i = 0; boardpoints[i] != p_hit; i++) {					}			p_targetindex = i;		}	} else {		switch (p_targettype) {			case 0: Single(); break;			case 1: Bull(); break;			case 2: Double(); break;			case 3: Treble(); break;			case 4: BullsEye(); break;		}	}}
开发者ID:Steelbadger,项目名称:GBADarts,代码行数:30,


示例17: fixed

voidKalmanFilter1d::Update(const fixed z_abs, const fixed var_z_abs,                       const fixed dt){  // Some abbreviated constants to make the code line up nicely:  static constexpr fixed F1 = fixed(1);  // Validity checks. TODO: more?  assert(positive(dt));  // Note: math is not optimized by hand. Let the compiler sort it out.  // Predict step.  // Update state estimate.  x_abs_ += x_vel_ * dt;  // Update state covariance. The last term mixes in acceleration noise.  const fixed dt2 = sqr(dt);  const fixed dt3 = dt * dt2;  const fixed dt4 = sqr(dt2);  p_abs_abs_ += Double(dt*p_abs_vel_) + dt2 * p_vel_vel_ + Quarter(var_x_accel_ * dt4);  p_abs_vel_ += dt * p_vel_vel_ + Half(var_x_accel_ * dt3);  p_vel_vel_ += var_x_accel_ * dt2;  // Update step.  const fixed y = z_abs - x_abs_;  // Innovation.  const fixed s_inv = F1 / (p_abs_abs_ + var_z_abs);  // Innovation precision.  const fixed k_abs = p_abs_abs_*s_inv;  // Kalman gain  const fixed k_vel = p_abs_vel_*s_inv;  // Update state estimate.  x_abs_ += k_abs * y;  x_vel_ += k_vel * y;  // Update state covariance.  p_vel_vel_ -= p_abs_vel_*k_vel;  p_abs_vel_ -= p_abs_vel_*k_abs;  p_abs_abs_ -= p_abs_abs_*k_abs;}
开发者ID:DRIZO,项目名称:xcsoar,代码行数:35,


示例18: ASSERT

 bool DoubleToStringConverter::ToFixed(double value,                                       int requested_digits,                                       StringBuilder* result_builder) const {     ASSERT(kMaxFixedDigitsBeforePoint == 60);     const double kFirstNonFixed = 1e60;          if (Double(value).IsSpecial()) {         return HandleSpecialValues(value, result_builder);     }          if (requested_digits > kMaxFixedDigitsAfterPoint) return false;     if (value >= kFirstNonFixed || value <= -kFirstNonFixed) return false;          // Find a sufficiently precise decimal representation of n.     int decimal_point;     bool sign;     // Add space for the '/0' byte.     const int kDecimalRepCapacity =     kMaxFixedDigitsBeforePoint + kMaxFixedDigitsAfterPoint + 1;     char decimal_rep[kDecimalRepCapacity];     int decimal_rep_length;     DoubleToAscii(value, FIXED, requested_digits,                   decimal_rep, kDecimalRepCapacity,                   &sign, &decimal_rep_length, &decimal_point);          bool unique_zero = ((flags_ & UNIQUE_ZERO) != 0);     if (sign && (value != 0.0 || !unique_zero)) {         result_builder->AddCharacter('-');     }          CreateDecimalRepresentation(decimal_rep, decimal_rep_length, decimal_point,                                 requested_digits, result_builder);     return true; }
开发者ID:emuikernel,项目名称:EAWebKit,代码行数:34,


示例19: HandleSpecialValues

 bool DoubleToStringConverter::ToShortest(double value,                                          StringBuilder* result_builder) const {     if (Double(value).IsSpecial()) {         return HandleSpecialValues(value, result_builder);     }          int decimal_point;     bool sign;     const int kDecimalRepCapacity = kBase10MaximalLength + 1;     char decimal_rep[kDecimalRepCapacity];     int decimal_rep_length;          DoubleToAscii(value, SHORTEST, 0, decimal_rep, kDecimalRepCapacity,                   &sign, &decimal_rep_length, &decimal_point);          bool unique_zero = (flags_ & UNIQUE_ZERO) != 0;     if (sign && (value != 0.0 || !unique_zero)) {         result_builder->AddCharacter('-');     }          int exponent = decimal_point - 1;     if ((decimal_in_shortest_low_ <= exponent) &&         (exponent < decimal_in_shortest_high_)) {         CreateDecimalRepresentation(decimal_rep, decimal_rep_length,                                     decimal_point,                                     Max(0, decimal_rep_length - decimal_point),                                     result_builder);     } else {         CreateExponentialRepresentation(decimal_rep, decimal_rep_length, exponent,                                         result_builder);     }     return true; }
开发者ID:emuikernel,项目名称:EAWebKit,代码行数:33,


示例20: Double

void JG::updateMarginals(bool recompute){	if (marginal_nodes.empty() || recompute){		marginal_nodes=vector<JGNode*> (copy_of_gm->variables.size());		int count=0;		for (int i = 0; i < nodes.size(); i++) {			for(int j=0;j<nodes[i]->variables().size();j++){				if (!marginal_nodes[nodes[i]->variables()[j]->id()]){					marginal_nodes[nodes[i]->variables()[j]->id()]=nodes[i];					count++;				}			}			if (count==(int)copy_of_gm->variables.size()){				break;			}		}	}	marginals=vector<Function> (copy_of_gm->variables.size());	for(int i=0;i<copy_of_gm->variables.size();i++){		vector<Variable*> curr_variable;		curr_variable.push_back(copy_of_gm->variables[i]);		if(marginal_nodes[i]){			marginal_nodes[i]->getMarginal(curr_variable,marginals[i]);		}		else {			marginals[i].variables() = curr_variable;			marginals[i].tableInit(copy_of_gm->variables[i]->domain_size());			for (int j = 0; j < copy_of_gm->variables[i]->domain_size(); j++) {				marginals[i].tableEntry(j) = Double((double) 1.0						/ (double) copy_of_gm->variables[i]->domain_size());			}		}	}}
开发者ID:codeaudit,项目名称:pl-semantics,代码行数:35,


示例21: SetRowVisible

voidTaskCalculatorPanel::Refresh(){  const auto &calculated = CommonInterface::Calculated();  const TaskStats &task_stats = calculated.ordered_task_stats;  TCHAR buffer[32];  if (target_button != nullptr)    target_button->SetVisible(task_stats.has_targets);  SetRowVisible(AAT_TIME, task_stats.has_targets);  if (task_stats.has_targets) {    FormatTimespanSmart(buffer, (int)protected_task_manager->GetOrderedTaskSettings().aat_min_time, 2);    SetText(AAT_TIME, buffer);  }  FormatTimespanSmart(buffer, (int)task_stats.GetEstimatedTotalTime(), 2);  SetText(AAT_ESTIMATED, buffer);  fixed rPlanned = task_stats.total.solution_planned.IsDefined()    ? task_stats.total.solution_planned.vector.distance    : fixed(0);  if (positive(rPlanned))    LoadValue(DISTANCE, rPlanned, UnitGroup::DISTANCE);  else    ClearValue(DISTANCE);  LoadValue(MC, CommonInterface::GetComputerSettings().polar.glide_polar_task.GetMC(),            UnitGroup::VERTICAL_SPEED);  LoadValue(EFFECTIVE_MC, emc, UnitGroup::VERTICAL_SPEED);  if (positive(rPlanned)) {    fixed rMax = task_stats.distance_max;    fixed rMin = task_stats.distance_min;    if (rMin < rMax) {      fixed range = Double((rPlanned - rMin) / (rMax - rMin)) - fixed(1);      LoadValue(RANGE, range * 100);    } else      ClearValue(RANGE);  } else    ClearValue(RANGE);  if (task_stats.total.remaining_effective.IsDefined())    LoadValue(SPEED_REMAINING, task_stats.total.remaining_effective.GetSpeed(),              UnitGroup::TASK_SPEED);  else    ClearValue(SPEED_REMAINING);  if (task_stats.total.travelled.IsDefined())    LoadValue(SPEED_ACHIEVED, task_stats.total.travelled.GetSpeed(),              UnitGroup::TASK_SPEED);  else    ClearValue(SPEED_ACHIEVED);  LoadValue(CRUISE_EFFICIENCY, task_stats.cruise_efficiency * 100);}
开发者ID:DRIZO,项目名称:xcsoar,代码行数:59,


示例22: SinkRate

doubleGlidePolar::SinkRate(const double V, const double n) const{  const auto w0 = SinkRate(V);  const auto vl = VbestLD / std::max(Half(VbestLD), V);  return std::max(0.,                  w0 + (V / Double(bestLD)) * (n * n - 1) * vl * vl);}
开发者ID:ThomasXBMC,项目名称:XCSoar,代码行数:8,


示例23: SinkRate

fixedGlidePolar::SinkRate(const fixed V, const fixed n) const{  const fixed w0 = SinkRate(V);  const fixed vl = VbestLD / max(half(VbestLD), V);  return max(fixed_zero,             w0 + (V / Double(bestLD)) * (sqr(n) - fixed_one) * sqr(vl));}
开发者ID:alon,项目名称:xcsoar,代码行数:8,


示例24: EarthDistance

static inline AngleEarthDistance(const fixed a){  if (!positive(a))    return Angle::Zero();  return Angle::acos(fixed(1) - Double(a));}
开发者ID:ThomasXBMC,项目名称:XCSoar,代码行数:8,


示例25: SinkRate

fixedGlidePolar::SinkRate(const fixed V, const fixed n) const{  const fixed w0 = SinkRate(V);  const fixed vl = VbestLD / std::max(Half(VbestLD), V);  return std::max(fixed(0),                  w0 + (V / Double(bestLD)) * (sqr(n) - fixed(1)) * sqr(vl));}
开发者ID:DRIZO,项目名称:xcsoar,代码行数:8,


示例26: SMALL_MIN_LEG

namespace FAITriangleRules{  /**   * The minimum leg percentage for "small FAI triangles".   */  static constexpr fixed SMALL_MIN_LEG(0.28);  /**   * The maximum leg percentage for "small FAI triangles".  This is a   * derived value, assuming the other two legs are as short as   * possible.   */  static constexpr fixed SMALL_MAX_LEG(fixed(1) - Double(SMALL_MIN_LEG));  /**   * The threshold which allows applying the "large FAI triangle"   * rules [m].   *   * Don't use this variable.  Use FAITriangleSettings::GetThreshold()   * instead.   *   * @see FAITriangleSettings::Threshold::FAI   */  static constexpr fixed LARGE_THRESHOLD_FAI(750000);  /**   * Relaxed threshold used by some contests such as OLC and DMSt.   *   * Don't use this variable.  Use FAITriangleSettings::GetThreshold()   * instead.   *   * @see FAITriangleSettings::Threshold::KM500   */  static constexpr fixed LARGE_THRESHOLD_500(500000);  /**   * The minimum leg percentage for "large FAI triangles".   */  static constexpr fixed LARGE_MIN_LEG(0.25);  /**   * The maximum leg percentage for "large FAI triangles".   */  static constexpr fixed LARGE_MAX_LEG(0.45);  static constexpr inline fixed LargeMinLeg(fixed total) {    return Quarter(total);  }  gcc_pure  bool TestDistances(const fixed d1, const fixed d2, const fixed d3,                     const FAITriangleSettings &settings);  gcc_pure  bool TestDistances(const GeoPoint &a, const GeoPoint &b, const GeoPoint &c,                     const FAITriangleSettings &settings);}
开发者ID:Adrien81,项目名称:XCSoar,代码行数:57,


示例27: UpdateInfoBoxThermal30s

voidUpdateInfoBoxThermal30s(InfoBoxData &data){  SetVSpeed(data, CommonInterface::Calculated().average);  // Set Color (red/black)  data.SetValueColor(Double(CommonInterface::Calculated().average) <      CommonInterface::Calculated().common_stats.current_risk_mc ? 1 : 0);}
开发者ID:CnZoom,项目名称:XcSoarPull,代码行数:9,


示例28: epsilon

void AO_COS::getSample(const int& variable, int& value, Double& weight,myRandom& random){	Double epsilon(0.01);	vector<Double> dist(csp->variables[variable]->domain_size());	Double norm_const;	for(int i=0;i<dist.size();i++)	{		if(cp_algo->isConsistent(variable,i))		{			csp->variables[variable]->addr_value()=i;			int entry=Variable::getAddress(sampling_functions[variable].variables());						dist[i]=sampling_functions[variable].table()[entry];			norm_const+=dist[i];			//dist[i]=Double(1.0);		}					}	//cout<<"Var = "<<variable<<": ";	//Double norm_const1;	//for(int i=0;i<dist.size();i++)	//{	//	if(dist[i].isZero())	//		continue;	//	if((dist[i]/norm_const) < epsilon);	//	{	//		dist[i]=epsilon;	//	}	//	norm_const1+=dist[i];	//	//cout<<dist[i]<<" ";	//}	for(int i=0;i<dist.size();i++)		dist[i]/=norm_const;	/*for(int i=0;i<dist.size();i++)	{		dist[i]/=norm_const1;			}	*/	//cout<<endl;	double sampled_value=random.getDouble();	double cdf=0.0;	for(int i=0;i<dist.size();i++)	{		cdf+=dist[i].value();		if(cdf >= sampled_value)		{			value=i;			weight=dist[i];			return;		}	}	//cerr<<"Should not reach here---Rejection problem/n";	value=0;	weight=Double();}
开发者ID:codeaudit,项目名称:pl-semantics,代码行数:57,



注:本文中的Double函数示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。


C++ Double_val函数代码示例
C++ DotProduct函数代码示例
万事OK自学网:51自学网_软件自学网_CAD自学网自学excel、自学PS、自学CAD、自学C语言、自学css3实例,是一个通过网络自主学习工作技能的自学平台,网友喜欢的软件自学网站。