安卓log.e函数打印示例_log10()函数以及C ++中的示例

news/2024/7/19 14:17:27 标签: c++, python, java, javascript, js

安卓log.e函数打印示例

C ++ log10()函数 (C++ log10() function)

log10() function is a library function of cmath header, it is used to get the common logarithm (the base-10 logarithm) of the given value. It accepts a value (float, double, or long double) and returns the common logarithm.

log10()函数cmath标头的库函数,用于获取给定值的常用对数(以10为底的对数)。 它接受一个值( float , double或long double )并返回公共对数。

Syntax of log10() function:

log10()函数的语法:

C++11:

C ++ 11:

     double log10 (double x);
      float log10 (float x);
long double log10 (long double x);
     double log10 (T x);

Parameter(s):

参数:

  • x – represents the value whose common logarithm to be found.

    x –表示要找到其常用对数的值。

Return value:

返回值:

It returns the common logarithm of the given value x.

它返回给定值x的对数。

Note:

注意:

  • If the given value is negative, it causes a domain error.

    如果给定值为负,则将导致域错误。

  • If the given value is zero, it may cause a pole error.

    如果给定值为零,则可能导致极点错误。

Example:

例:

    Input:
    float x = 10.0f
    
    Function call:
    log(x);
    
    Output:
    1

C ++代码演示log10()函数的示例 (C++ code to demonstrate the example of log10() function)

// C++ code to demonstrate the example of
// log10() function

#include <iostream>
#include <cmath>
using namespace std;

int main()
{
    float x = 0.0f;

    x = 10.0f;
    cout << "log10(" << x << "): " << log10(x) << endl;

    x = 1.0f;
    cout << "log10(" << x << "): " << log10(x) << endl;

    x = 20.0f;
    cout << "log10(" << x << "): " << log10(x) << endl;

    x = -10.4f;
    cout << "log10(" << x << "): " << log10(x) << endl;

    x = 0.0f;
    cout << "log10(" << x << "): " << log10(x) << endl;

    x = 100.6f;
    cout << "log10(" << x << "): " << log10(x) << endl;

    return 0;
}

Output

输出量

log10(10): 1
log10(1): 0
log10(20): 1.30103
log10(-10.4): nan
log10(0): -inf
log10(100.6): 2.0026

Reference: C++ log10() function

参考: C ++ log10()函数

翻译自: https://www.includehelp.com/cpp-tutorial/log10-function-with-example.aspx

安卓log.e函数打印示例


http://www.niftyadmin.cn/n/1254173.html

相关文章

java 读取rtf_JAVA读取WORD,EXCEL,PDF,TXT,RTF,HTML文件文本内容的方法

以下是Java对几种文本文件内容读取代码。其中&#xff0c;OFFICE文档(WORD,EXCEL)使用了POI控件&#xff0c;PDF使用了PDFBOX控件。WORD Java代码package textReader;import java.io.*;import org.apache.poi.hwpf.extractor.WordExtractor;public class WordReader {pu…

isnan函数 c语言_isnan()函数以及C ++中的示例

isnan函数 c语言C isnan()函数 (C isnan() function) isnan() function is a library function of cmath header, it is used to check whether the given value is a NaN (Not-A-Number). It accepts a value (float, double or long double) and returns 1 if the given val…

gdb ldexp_ldexp()函数以及C ++中的示例

gdb ldexpC ldexp()函数 (C ldexp() function) ldexp() function is a library function of cmath header, it is used to calculate the value from significand and exponent, it returns the multiplication of significand and 2 raised to the power of the exponent. It…

python 示例_带有示例的Python文件名属性

python 示例文件名属性 (File name Property) name Property is an inbuilt property of File object (IO object) in Python, it is used to get the name of the file from the file object in Python. name属性是Python中File对象(IO对象)的内置属性&#xff0c;用于从Pytho…

python 示例_带有示例的Python Set remove()方法

python 示例设置remove()方法 (Set remove() Method) remove() method is used to remove a specified element from the set, the method accepts an element and removes from the set if it exists, if the element does not exist in the set, the method returns an error…

为什么苹果日历不能设置日程_苹果日历怎么用 苹果日历使用方法介绍

苹果日历使用方法介绍&#xff1a;1.通过邮件创建重要事件如果收到一封写有明确时间的邮件&#xff0c;简单几步就能轻松将其写入日历。点击邮件标题或文本中的预定时间&#xff0c;从底部弹出的菜单中选择“创建事件”即可。2.手动设定时区苹果iOS系统会自动根据所在地区固定时…

python 示例_带有示例的Python列表index()方法

python 示例列出index()方法 (List index() Method) index() method is used to get the index of the specified element, the method is called with this list and element can be supplied as an argument, it returns the index of the first occurrence of the element i…

python 二项分布模拟_Python | 二项式实验模拟

python 二项分布模拟A binomial experiment is described by the following characteristics: 二项式实验由以下特征描述&#xff1a; An experiment that involves repeated trials. 涉及重复试验的实验。 Each trial can only have two possible outcomes i.e. success or f…