Server Side Programming Articles

Page 1005 of 2109

isgreater() in C/C++

karthikeya Boyini
karthikeya Boyini
Updated on 15-Mar-2026 391 Views

In C programming, the isgreater() function is a type-generic macro used to compare two floating-point values safely. It is declared in the header file and returns a non-zero value (true) if the first argument is greater than the second, otherwise returns 0 (false). Unlike the regular > operator, isgreater() never raises floating-point exceptions. Syntax int isgreater(x, y); Parameters: x − First floating-point value to compare y − Second floating-point value to compare Return Value: Returns 1 if x is greater than y, otherwise returns 0. Example 1: Basic Usage with ...

Read More

PHP – How to get the square root of an arbitrary precision number using bcsqrt() function?

Urmila Samariya
Urmila Samariya
Updated on 15-Mar-2026 276 Views

In PHP, the bcsqrt() function is used to get the square root of an arbitrary precision number. It accepts the arbitrary precision number as a string and gives the square root of the number after scaling the result to the specified precision. Syntax string bcsqrt($num_string, $scale) Parameters The bcsqrt() function accepts two different parameters: $num_string and $scale. $num_string − It represents the number whose square root to be evaluated. It is a string-type parameter. $scale − It indicates the number of digits that appear ...

Read More

PHP – How to set or get the default scale parameter for all bc math functions using bcscale() function?

Urmila Samariya
Urmila Samariya
Updated on 15-Mar-2026 328 Views

In PHP, the bcscale() function is used to set the default scale parameter for all bc math functions. This function sets the default number of decimal places for all following calls to bc math functions that do not explicitly specify a scale parameter. Syntax int bcscale(int $scale) Parameters The bcscale() function accepts a single mandatory parameter − $scale − An integer that specifies the number of digits after the decimal point. The default value is 0. Return Value The bcscale() function returns the old scale value as an integer. Example ...

Read More

PHP – bcpowmod() function

Urmila Samariya
Urmila Samariya
Updated on 15-Mar-2026 289 Views

In PHP, bcpowmod() function is used to raise an arbitrary precision base number to another exponent number, reduced by a specified modulus. The bcpowmod() function accepts three arbitrary precision numbers as strings and returns the base number raised to the exponent modulo number after scaling the result to the specified precision. Syntax string bcpowmod(string $base, string $exponent, string $modulus, int $scale = 0) Parameters The bcpowmod() function accepts four different parameters − $base, $exponent, $modulus and $scale. $base − It represents the base number. It is a string type parameter. $exponent − ...

Read More

Difference between %d and %i format specifier in C

Samual Sam
Samual Sam
Updated on 15-Mar-2026 3K+ Views

In C programming, both %d and %i are format specifiers used for integer values, but they behave differently when used with scanf() for input operations. For printf(), they work identically. Syntax printf("%d", integer_variable); // Decimal output printf("%i", integer_variable); // Integer output (same as %d for printf) scanf("%d", &integer_variable); // Reads decimal integers only scanf("%i", &integer_variable); // Reads decimal, octal, and hexadecimal Format Specifier %d The %d format specifier handles signed decimal integers. For printf(), it displays integers in decimal form. For scanf(), it only accepts decimal ...

Read More

PHP – How to subtract one arbitrary precision number from another using bcsub() function?

Urmila Samariya
Urmila Samariya
Updated on 15-Mar-2026 910 Views

In PHP, bcsub() math function is used to subtract one arbitrary precision number from another number. The bcsub() function takes two arbitrary precision numbers as strings and returns the subtraction result after scaling to a specified precision. Syntax string bcsub($num_str1, $num_str2, $scaleVal) Parameters The bcsub() math function accepts three different parameters $num_str1, $num_str2 and $scaleVal. $num_str1 − It represents the left operand and it is the string type parameter. ...

Read More

Float and Double in C

karthikeya Boyini
karthikeya Boyini
Updated on 15-Mar-2026 56K+ Views

In C programming, float and double are data types used to represent floating point numbers. Both follow the IEEE 754 standard but differ in precision and memory usage. Float Data Type Float is a 32-bit IEEE 754 single precision floating point number with the following structure − 1 bit for the sign 8 bits for the exponent 23 bits for the mantissa (fractional part) Precision: 6-7 decimal digits Syntax float variable_name; Example: Float Declaration and Usage #include int main() { float x ...

Read More

PHP – How to compare two arbitrary precision numbers using bccomp() function?

Urmila Samariya
Urmila Samariya
Updated on 15-Mar-2026 1K+ Views

In PHP, the bccomp() function is used to compare two arbitrary precision numbers. It takes two numbers as strings and returns an integer indicating which number is larger, smaller, or if they are equal. Syntax int bccomp(string $left_operand, string $right_operand, int $scale = 0) Parameters The bccomp() function accepts three parameters − $left_operand − The left operand as a string representing the first number to compare. $right_operand − The right operand as a string representing the second number to compare. $scale − Optional. The number of decimal places to use in the ...

Read More

Difference between getc(), getchar(), getch() and getche()

Samual Sam
Samual Sam
Updated on 15-Mar-2026 6K+ Views

All these functions read characters from input and return an integer. They differ in their source, buffering behavior, and echo characteristics. Syntax int getc(FILE *stream); int getchar(void); int getch(void); /* Non-standard */ int getche(void); /* Non-standard */ getc() The getc() function reads a single character from a specified file stream and returns it as an integer. It waits for the Enter key and uses buffered input. Example #include int main() { char val; printf("Enter the character: ...

Read More

PHP – How to divide two arbitrary precision numbers using bcdiv() function?

Urmila Samariya
Urmila Samariya
Updated on 15-Mar-2026 864 Views

In PHP, bcdiv() math function is used to divide one arbitrary precision number from another number. The bcdiv() function takes two arbitrary precision numbers as strings and returns the result as a division of two numbers after scaling the result to a specified precision. Syntax string bcdiv($num_string1, $num_string2, $scaleVal) Parameters The bcdiv() function accepts three parameters: $num_string1 − The dividend (string type parameter) $num_string2 − The divisor (string type parameter) $scaleVal − Optional integer parameter that sets the number of digits after the decimal point in the result. Default is 0 ...

Read More
Showing 10041–10050 of 21,090 articles
Advertisements