C++ visualc&x2B+;2008发布版本打破我的浮动
你好 <>我用微软Visual C++ 2008 Express版发布了我的项目。但是,这里的一些浮点值可能与调试配置中的浮点值不同。出于某种原因,对于某些特定功能,它们都是NaN或零。我不确定为什么会发生这种情况,这是我第一次在发布模式下构建,非常感谢您的帮助 尝试的步骤:C++ visualc&x2B+;2008发布版本打破我的浮动,c++,visual-studio-2008,visual-c++,nan,release-mode,C++,Visual Studio 2008,Visual C++,Nan,Release Mode,你好 我用微软Visual C++ 2008 Express版发布了我的项目。但是,这里的一些浮点值可能与调试配置中的浮点值不同。出于某种原因,对于某些特定功能,它们都是NaN或零。我不确定为什么会发生这种情况,这是我第一次在发布模式下构建,非常感谢您的帮助 尝试的步骤: 浮点命令行选项 单步执行代码由于一些原因,这不起作用 数小时盯着代码看 谢谢你的阅读 这是行为不端的代码(注意:我过去在NAN中遇到过这种特殊功能的问题, 但这很奇怪): /* 该文件是White-Storm:Lightn
- 浮点命令行选项
- 单步执行代码由于一些原因,这不起作用
- 数小时盯着代码看 谢谢你的阅读
/*
该文件是White-Storm:Lightning(alpha)的一部分。
版权所有2012克里斯托弗·奥古斯都·格里利
White-Storm:Lightning(alpha)是免费软件:您可以重新发布和/或修改它
它是根据GNU通用公共许可证的条款发布的
自由软件基金会,或者许可证的第3版,或者
(由您选择)任何更高版本。
白风暴:闪电(alpha)的发布是希望它会有用,
但无任何保证;甚至没有任何关于
适销性或适合某一特定目的。见
有关更多详细信息,请参阅GNU通用公共许可证。
您应该已经收到GNU通用公共许可证的副本
伴随着白色风暴:闪电(阿尔法)。如果没有,请参阅。
*/
#包括“向量计算器.h”
WSL::Math::Vector::VectorCalculator::VectorCalculator()
{
WSL::Containers::Base::XYZ temp;
默认值=温度;
}
WSL::Containers::Base::XYZ WSL::Math::Vector::VectorCalculator::VectorCalculation(WSL::Containers::Base::XYZ goTo,WSL::Containers::Base::XYZ位置,浮点速度,bool td)
{
//确保向量没有任何杂散值//
向量=默认值;
//计算震级//
x=goTo.getX()-position.getX();
y=goTo.getY()-position.getY();
z=goTo.getZ()-position.getZ();
如果(td==true)
幅值=磁点积(x,y,z,幅值);
其他的
幅值=磁点积(x,y,幅值);
如果(x==0&&y==0&&z==0)
返回向量;
//正常的//
震级=sqrt(震级);
//确保我们不被零除//
如果(幅值!=0)
{
如果(x!=0)
x/=震级;
如果(y!=0)
y/=震级;
如果(td==true)
如果(z!=0)
z/=震级;
}
//以所需的速度前进//
如果(速度>=0)
{
x*=速度;
y*=速度;
}
如果(td==true)
z*=速度;
向量setX(x);
vector.setY(y);
向量setZ(z);
返回向量;
}
内联浮点WSL::数学::公式::点::点积(浮点x、浮点y、浮点mag)
{
回报率(mag=((x)*(x)+(y)*(y));
}
内联浮点WSL::数学::公式::点::点积(浮点x、浮点y、浮点z、浮点mag)
{
返回(mag=((x)*(x)+(y)*(y)+(z)*(z));
}
标题:
/*
This file is part of White - Storm: Lightning (alpha).
Copyright 2012 Christopher Augustus Greeley
White - Storm: Lightning (alpha) is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
White - Storm: Lightning (alpha) is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with White - Storm: Lightning (alpha). If not, see <http://www.gnu.org/licenses/>.
*/
#include "Int Bool.h"
namespace WSL
{
namespace Math
{
namespace Formulas
{
class Dot
{
public:
inline float DotProduct( float x, float y, float mag );
inline float DotProduct( float x, float y, float z, float mag );
};
}
namespace Vector
{
struct VectorCalculator
{
VectorCalculator();
WSL::Containers::Base::XYZ VectorCalculation( WSL::Containers::Base::XYZ goTo, WSL::Containers::Base::XYZ position, float speed, bool td );
WSL::Containers::Base::XYZ VectorCalculation( WSL::Containers::Base::XYZ goTo, WSL::Containers::Base::XYZ *position, float speed, bool td );
private:
WSL::Containers::Base::XYZ vector;
WSL::Containers::Base::XYZ default_;
float x, y, z, magnitude;
Math::Formulas::Dot magn;
};
}
}
}
/*
该文件是White-Storm:Lightning(alpha)的一部分。
版权所有2012克里斯托弗·奥古斯都·格里利
White-Storm:Lightning(alpha)是免费软件:您可以重新发布和/或修改它
它是根据GNU通用公共许可证的条款发布的
自由软件基金会,或者许可证的第3版,或者
(由您选择)任何更高版本。
白风暴:闪电(alpha)的发布是希望它会有用,
但无任何保证;甚至没有任何关于
适销性或适合某一特定目的。见
有关更多详细信息,请参阅GNU通用公共许可证。
您应该已经收到GNU通用公共许可证的副本
伴随着白色风暴:闪电(阿尔法)。如果没有,请参阅。
*/
#包括“Int Bool.h”
命名空间WSL
{
名称空间数学
{
名称空间公式
{
类点
{
公众:
内联浮点点积(浮点x、浮点y、浮点mag);
内联浮点点积(浮点x、浮点y、浮点z、浮点mag);
};
}
名称空间向量
{
结构向量计算器
{
向量计算器();
WSL::Containers::Base::XYZ矢量计算(WSL::Containers::Base::XYZ goTo,WSL::Containers::Base::XYZ位置,浮点速度,bool td);
WSL::Containers::Base::XYZ矢量计算(WSL::Containers::Base::XYZ goTo,WSL::Containers::Base::XYZ*位置,浮点速度,bool td);
私人:
WSL::Containers::Base::XYZ vector;
WSL::Containers::Base::XYZ默认值;
浮动x,y,z,幅值;
数学::公式::点磁;
};
}
}
}
上下文:
/*
This file is part of White - Storm: Lightning (alpha).
Copyright 2012 Christopher Augustus Greeley
White - Storm: Lightning (alpha) is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
White - Storm: Lightning (alpha) is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with White - Storm: Lightning (alpha). If not, see <http://www.gnu.org/licenses/>.
*/
#include "Include.h"
namespace WSL
{
namespace Containers
{
namespace Base
{
struct XYZB
{
inline float getX() { return X; }
inline float getY() { return Y; }
inline float getZ() { return Z; }
inline void setX( float Value ) { X = Value; }
inline void setY( float Value ) { Y = Value; }
inline void setZ( float Value ) { Z = Value; }
protected:
float X, Y, Z;
};
struct XYZ : public XYZB
{
public:
XYZ( float x, float y, float z )
{
X = x;
Y = y;
Z = z;
}
inline XYZ() { X = 0; Y = 0; Z = 0; }
};
}
}
}
/*
该文件是White-Storm:Lightning(alpha)的一部分。
版权所有2012克里斯托弗·奥古斯都·格里利
White-Storm:Lightning(alpha)是免费软件:您可以重新发布和/或修改它
它是根据GNU通用公共许可证的条款发布的
自由软件基金会,或者许可证的第3版,或者
(由您选择)任何更高版本。
白风暴:闪电(alpha)的发布是希望它会有用,
但无任何保证;甚至没有任何关于
适销性或适合某一特定目的。见
有关更多详细信息,请参阅GNU通用公共许可证。
您应该已经收到GNU通用公共许可证的副本
伴随着白色风暴:闪电(阿尔法)。如果没有,请参阅。
*/
#包括“包括.h”
/*
This file is part of White - Storm: Lightning (alpha).
Copyright 2012 Christopher Augustus Greeley
White - Storm: Lightning (alpha) is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
White - Storm: Lightning (alpha) is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with White - Storm: Lightning (alpha). If not, see <http://www.gnu.org/licenses/>.
*/
#include "Include.h"
namespace WSL
{
namespace Containers
{
namespace Base
{
struct XYZB
{
inline float getX() { return X; }
inline float getY() { return Y; }
inline float getZ() { return Z; }
inline void setX( float Value ) { X = Value; }
inline void setY( float Value ) { Y = Value; }
inline void setZ( float Value ) { Z = Value; }
protected:
float X, Y, Z;
};
struct XYZ : public XYZB
{
public:
XYZ( float x, float y, float z )
{
X = x;
Y = y;
Z = z;
}
inline XYZ() { X = 0; Y = 0; Z = 0; }
};
}
}
}
/*
This file is part of White - Storm: Lightning (alpha).
Copyright 2012 Christopher Augustus Greeley
White - Storm: Lightning (alpha) is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
White - Storm: Lightning (alpha) is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with White - Storm: Lightning (alpha). If not, see <http://www.gnu.org/licenses/>.
*/
#include "Vector.h"
WSL::Containers::Math::Vector::Vector()
{
destinationInitialize = false;
threeDimentional = false;
}
WSL::Containers::Math::Vector::Vector( WSL::Containers::Base::XYZ position_ )
{
position = position_;
destinationInitialize = false;
threeDimentional = false;
}
WSL::Containers::Math::Vector::Vector( WSL::Containers::Base::XYZ position_, bool threeDimentional_ )
{
position = position_;
destinationInitialize = false;
threeDimentional = threeDimentional_;
}
float WSL::Containers::Math::Vector::GetDestinationX()
{
return destination.getX();
}
float WSL::Containers::Math::Vector::GetDestinationY()
{
return destination.getY();
}
float WSL::Containers::Math::Vector::GetDestinationZ()
{
return destination.getZ();
}
WSL::Containers::Base::XYZ WSL::Containers::Math::Vector::GetDestination()
{
return destination;
}
WSL::Containers::Base::XYZ WSL::Containers::Math::Vector::GetPosition()
{
return position;
}
float WSL::Containers::Math::Vector::GetX()
{
return position.getX();
}
float WSL::Containers::Math::Vector::GetY()
{
return position.getY();
}
float WSL::Containers::Math::Vector::GetZ()
{
return position.getZ();
}
void WSL::Containers::Math::Vector::SetThreeDimentional( bool value )
{
threeDimentional = value;
}
bool WSL::Containers::Math::Vector::GetThreeDimentional()
{
return threeDimentional;
}
void WSL::Containers::Math::Vector::CalculateVector()
{
vector = vectorCalculator.VectorCalculation( destination, position, speed, threeDimentional );
}
void WSL::Containers::Math::Vector::Move()
{
position.setX( position.getX() + vector.getX() );
position.setY( position.getY() + vector.getY() );
position.setZ( position.getZ() + vector.getZ() );
}
void WSL::Containers::Math::Vector::SetPosition( WSL::Containers::Base::XYZ position_ )
{
position = position_;
}
void WSL::Containers::Math::Vector::SetSpeed( float speed_ )
{
speed = speed_;
}
void WSL::Containers::Math::Vector::SetDestination( float x, float y )
{
destination.setX( x );
destination.setY( y );
if( destinationInitialize == false )
{
destinationInitialize = true;
destination.setZ( 0 );
}
}
void WSL::Containers::Math::Vector::SetDestination( float x, float y, float z )
{
destination.setX( x );
destination.setY( y );
destination.setZ( z );
}
void WSL::Containers::Math::Vector::SetDestination( WSL::Containers::Base::XYZ destination_ )
{
destination = destination_;
}
void WSL::Containers::Math::Vector::SetDestination( float allCoords )
{
destination.setX( allCoords );
destination.setY( allCoords );
destination.setZ( allCoords );
}
void WSL::Containers::Math::Vector::SetVector( WSL::Containers::Base::XYZ vector_ )
{
vector = vector_;
}
WSL::Containers::Base::XYZ WSL::Containers::Math::Vector::GetVector()
{
return vector;
}
float WSL::Containers::Math::Vector::GetSpeed()
{
return speed;
}
/*
This file is part of White - Storm: Lightning (alpha).
Copyright 2012 Christopher Augustus Greeley
White - Storm: Lightning (alpha) is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
White - Storm: Lightning (alpha) is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with White - Storm: Lightning (alpha). If not, see <http://www.gnu.org/licenses/>.
*/
#include "Engine.h"
namespace WSL
{
namespace Containers
{
namespace Math
{
class Vector
{
WSL::Math::Vector::VectorCalculator vectorCalculator;
WSL::Containers::Base::XYZ position;
WSL::Containers::Base::XYZ destination;
WSL::Containers::Base::XYZ vector;
bool destinationInitialize, threeDimentional;
float speed;
public:
Vector();
Vector( WSL::Containers::Base::XYZ position_ );
Vector( WSL::Containers::Base::XYZ position_, bool threeDimentional_ );
void CalculateVector();
bool GetThreeDimentional();
void Move();
void SetPosition( WSL::Containers::Base::XYZ position_ );
void SetDestination( float x, float y );
void SetDestination( float x, float y, float z );
void SetDestination( WSL::Containers::Base::XYZ destination_ );
void SetDestination( float allCoords );
void SetSpeed( float speed_ );
void SetThreeDimentional( bool value );
void SetVector( WSL::Containers::Base::XYZ vector_ );
float GetDestinationX();
float GetDestinationY();
float GetDestinationZ();
WSL::Containers::Base::XYZ GetDestination();
WSL::Containers::Base::XYZ GetPosition();
WSL::Containers::Base::XYZ GetVector();
float GetX();
float GetY();
float GetZ();
float GetSpeed();
};
}
}
}