1
1
Fork 0
mirror of https://github.com/QB64Official/qb64.git synced 2024-07-03 10:01:21 +00:00

Added "&B" support to VAL function.

Added extended math functionality into user mods. (COT, SEC, COT, and their deritives.)
Cleaned up old config setting from config.txt file.
This commit is contained in:
SMcNeill 2015-08-08 02:23:15 -04:00
parent a4e3e12ef4
commit f9bb83066b
7 changed files with 173 additions and 7 deletions

View file

@ -14074,6 +14074,22 @@ long double func_val(qbs *s){
}//i
return hex_value;
}
if ((c==66)||(c==98)){//"B"or"b"
hex_digits=0;
hex_value=0;
for (i=i+2;i<s->len;i++){
c=s->chr[i];
if ((c>47)&&(c<50)){//0-1
c-=48;
hex_value<<=1;
hex_value|=c;
if (hex_digits||c) hex_digits++;
if (hex_digits>64){error(6); return 0;}
}else
break;
}//i
return hex_value;
}
if ((c==72)||(c==104)){//"H"or"h"
hex_digits=0;
hex_value=0;

View file

@ -13,7 +13,8 @@ double func_rad2deg(double degree);
double func_rad2grad(double degree);
double func_grad2deg(double degree);
double func_grad2rad(double degree);
double func_pi();
double func_pi(double multiplier,int32 passed);
int32 func_screenwidth();
int32 func_screenheight();
void sub_screenicon();
@ -21,3 +22,12 @@ int32 func_windowexists ();
int32 func__controlchr();
int32 func__str_nc_compare(qbs *s1, qbs *s2);
int32 func__str_compare(qbs *s1, qbs *s2);
double func_arcsec (double num);
double func_arccsc (double num);
double func_arccot (double num);
double func_sech (double num);
double func_csch (double num);
double func_coth (double num);
double func_sec (double num);
double func_csc (double num);
double func_cot (double num);

View file

@ -0,0 +1,51 @@
double func_pi (double multiplier,int32 passed) {
if (passed) {return 3.14159265358979323846264338327950288419716939937510582 * multiplier;}
return (3.14159265358979323846264338327950288419716939937510582);
}
double func_arcsec (double num) {
int sign = (num > 0) - (num < 0);
if (num<-1||num>1) {error(5);return 0;}
return atan(num / sqrt(1 - num * num)) + (sign - 1) * (2 * atan(1));
}
double func_arccsc (double num) {
int sign = (num > 0) - (num < 0);
if (num<-1||num>1) {error(5);return 0;}
return atan(num / sqrt(1 - num * num)) + (sign - 1) * (2 * atan(1));
}
double func_arccot (double num) {return 2 * atan(1) - atan(num);}
double func_sech (double num) {
if (num>88.02969) {error(5);return 0;}
if (exp(num) + exp(-num)==0) {error(5);return 0;}
return 2/ (exp(num) + exp(-num));
}
double func_csch (double num) {
if (num>88.02969) {error(5);return 0;}
if (exp(num) - exp(-num)==0) {error(5);return 0;}
return 2/ (exp(num) - exp(-num));
}
double func_coth (double num) {
if (num>44.014845) {error(5);return 0;}
if (2 * exp(num) - 1==0) {error(5);return 0;}
return 2 * exp(num) - 1;
}
double func_sec (double num) {
if (cos(num)==0) {error(5);return 0;}
return 1/cos(num);
}
double func_csc (double num) {
if (sin(num)==0) {error(5);return 0;}
return 1/sin(num);
}
double func_cot (double num) {
if (tan(num)==0) {error(5);return 0;}
return 1/tan(num);
}

View file

@ -1,3 +0,0 @@
double func_pi () {
return (3.14159265358979323846264338327950288419716939937510582);
}

View file

@ -2,6 +2,6 @@
#include "steve_mods.h"
#include "Steve Stuff/convert_angle.cpp"
#include "Steve Stuff/pi.cpp"
#include "Steve Stuff/extramath.cpp"
#include "Steve Stuff/screeninfo.cpp"
#include "Steve Stuff/stringcomp.cpp"

View file

@ -272,7 +272,7 @@ IF LoadedIDESettings = 0 THEN
WriteConfigSetting "'[IDE DISPLAY SETTINGS]", "IDE_CustomFont$", "c:\windows\fonts\lucon.ttf"
WriteConfigSetting "'[IDE DISPLAY SETTINGS]", "IDE_CustomFont", "FALSE"
WriteConfigSetting "'[IDE DISPLAY SETTINGS]", "IDE_CodePage", "0"
WriteConfigSetting "'[MOUSE SETTINGS]", "Mouse_Orentation$", "RIGHT"
WriteConfigSetting "'[MOUSE SETTINGS]", "SwapMouseButton", "FALSE"
ELSE
'use the main config file as the default values and just copy it over to the new file
f = FREEFILE

View file

@ -161,8 +161,10 @@ clearid
id.n = "_PI"
id.subfunc = 1
id.callname = "func_pi"
id.args = 0
id.args = 1
id.arg = MKL$(DOUBLETYPE - ISPOINTER)
id.ret = DOUBLETYPE - ISPOINTER
id.specialformat = "[?]"
id.Dependency = DEPENDENCY_USER_MODS
regid
@ -227,3 +229,93 @@ id.ret = LONGTYPE - ISPOINTER
id.Dependency = DEPENDENCY_USER_MODS
regid
clearid
id.n = "_ARCSEC"
id.subfunc = 1
id.callname = "func_arcsec"
id.args = 1
id.arg = MKL$(FLOATTYPE - ISPOINTER)
id.ret = FLOATTYPE - ISPOINTER
id.Dependency = DEPENDENCY_USER_MODS
regid
clearid
id.n = "_ARCCSC"
id.subfunc = 1
id.callname = "func_arccsc"
id.args = 1
id.arg = MKL$(FLOATTYPE - ISPOINTER)
id.ret = FLOATTYPE - ISPOINTER
id.Dependency = DEPENDENCY_USER_MODS
regid
clearid
id.n = "_ARCCOT"
id.subfunc = 1
id.callname = "func_arccot"
id.args = 1
id.arg = MKL$(FLOATTYPE - ISPOINTER)
id.ret = FLOATTYPE - ISPOINTER
id.Dependency = DEPENDENCY_USER_MODS
regid
clearid
id.n = "_SECH"
id.subfunc = 1
id.callname = "func_sech"
id.args = 1
id.arg = MKL$(FLOATTYPE - ISPOINTER)
id.ret = FLOATTYPE - ISPOINTER
id.Dependency = DEPENDENCY_USER_MODS
regid
clearid
id.n = "_CSCH"
id.subfunc = 1
id.callname = "func_csch"
id.args = 1
id.arg = MKL$(FLOATTYPE - ISPOINTER)
id.ret = FLOATTYPE - ISPOINTER
id.Dependency = DEPENDENCY_USER_MODS
regid
clearid
id.n = "_COTH"
id.subfunc = 1
id.callname = "func_coth"
id.args = 1
id.arg = MKL$(FLOATTYPE - ISPOINTER)
id.ret = FLOATTYPE - ISPOINTER
id.Dependency = DEPENDENCY_USER_MODS
regid
clearid
id.n = "_SEC"
id.subfunc = 1
id.callname = "func_sec"
id.args = 1
id.arg = MKL$(FLOATTYPE - ISPOINTER)
id.ret = FLOATTYPE - ISPOINTER
id.Dependency = DEPENDENCY_USER_MODS
regid
clearid
id.n = "_CSC"
id.subfunc = 1
id.callname = "func_csc"
id.args = 1
id.arg = MKL$(FLOATTYPE - ISPOINTER)
id.ret = FLOATTYPE - ISPOINTER
id.Dependency = DEPENDENCY_USER_MODS
regid
clearid
id.n = "_COT"
id.subfunc = 1
id.callname = "func_cot"
id.args = 1
id.arg = MKL$(FLOATTYPE - ISPOINTER)
id.ret = FLOATTYPE - ISPOINTER
id.Dependency = DEPENDENCY_USER_MODS
regid