math – 数学函数

math 模块提供了一些用于处理浮点数的基本数学函数。

在这些板上可用
  • 8086 Commander
  • @sarfata shIRtty
  • ARAMCON Badge 2019
  • ARAMCON2 Badge
  • ATMegaZero ESP32-S2
  • Adafruit BLM Badge
  • Adafruit CLUE nRF52840 Express
  • Adafruit Circuit Playground Bluefruit
  • Adafruit Circuit Playground Express 4-H
  • Adafruit CircuitPlayground Express
  • Adafruit CircuitPlayground Express with Crickit libraries
  • Adafruit CircuitPlayground Express with displayio
  • Adafruit EdgeBadge
  • Adafruit Feather Bluefruit Sense
  • Adafruit Feather M0 Adalogger
  • Adafruit Feather M0 Basic
  • Adafruit Feather M0 Express
  • Adafruit Feather M0 Express with Crickit libraries
  • Adafruit Feather M0 RFM69
  • Adafruit Feather M0 RFM9x
  • Adafruit Feather M4 CAN
  • Adafruit Feather M4 Express
  • Adafruit Feather MIMXRT1011
  • Adafruit Feather RP2040
  • Adafruit Feather STM32F405 Express
  • Adafruit Feather nRF52840 Express
  • Adafruit FunHouse
  • Adafruit Gemma M0
  • Adafruit Gemma M0 PyCon 2018
  • Adafruit Grand Central M4 Express
  • Adafruit Hallowing M4 Express
  • Adafruit ItsyBitsy M0 Express
  • Adafruit ItsyBitsy M4 Express
  • Adafruit ItsyBitsy RP2040
  • Adafruit ItsyBitsy nRF52840 Express
  • Adafruit LED Glasses Driver nRF52840
  • Adafruit Macropad RP2040
  • Adafruit MagTag
  • Adafruit Matrix Portal M4
  • Adafruit Metro ESP32S2
  • Adafruit Metro M0 Express
  • Adafruit Metro M4 Airlift Lite
  • Adafruit Metro M4 Express
  • Adafruit Metro nRF52840 Express
  • Adafruit Monster M4SK
  • Adafruit NeoKey Trinkey M0
  • Adafruit NeoPixel Trinkey M0
  • Adafruit ProxLight Trinkey M0
  • Adafruit PyGamer
  • Adafruit PyPortal
  • Adafruit PyPortal Pynt
  • Adafruit PyPortal Titano
  • Adafruit PyRuler
  • Adafruit Pybadge
  • Adafruit QT Py M0
  • Adafruit QT Py M0 Haxpress
  • Adafruit QT Py RP2040
  • Adafruit QT2040 Trinkey
  • Adafruit Rotary Trinkey M0
  • Adafruit Slide Trinkey M0
  • Adafruit Trellis M4 Express
  • Adafruit Trinket M0
  • AloriumTech Evo M51
  • Arduino MKR Zero
  • Arduino MKR1300
  • Arduino Nano 33 BLE
  • Arduino Nano 33 IoT
  • Arduino Nano RP2040 Connect
  • Arduino Zero
  • Artisense Reference Design RD00
  • AtelierDuMaker nRF52840 Breakout
  • BDMICRO VINA-D21
  • BDMICRO VINA-D51
  • BLE-SS dev board Multi Sensor
  • BastBLE
  • BastWiFi
  • BlueMicro840
  • CP Sapling M0
  • CP Sapling M0 w/ SPI Flash
  • CP32-M4
  • Capable Robot Programmable USB Hub
  • Cedar Grove StringCar M0 Express
  • Challenger RP2040 WiFi
  • Circuit Playground Express Digi-Key PyCon 2019
  • CircuitBrains Basic
  • CircuitBrains Deluxe
  • CrumpS2
  • Cytron Maker Pi RP2040
  • DynOSSAT-EDU-EPS
  • DynOSSAT-EDU-OBC
  • DynaLoRa_USB
  • ESP 12k NodeMCU
  • Electronic Cats Bast Pro Mini M0
  • Electronic Cats CatWAN USBStick
  • Electronic Cats Hunter Cat NFC
  • Electronic Cats NFC Copy Cat
  • Electronut Labs Blip
  • Electronut Labs Papyr
  • EncoderPad RP2040
  • Escornabot Makech
  • Espruino Pico
  • Espruino Wifi
  • Feather ESP32S2 without PSRAM
  • Feather MIMXRT1011
  • Feather MIMXRT1062
  • FeatherS2
  • FeatherS2 Neo
  • FeatherS2 PreRelease
  • Fluff M0
  • Fomu
  • Franzininho WIFI w/Wroom
  • Franzininho WIFI w/Wrover
  • Gravitech Cucumber M
  • Gravitech Cucumber MS
  • Gravitech Cucumber R
  • Gravitech Cucumber RS
  • HMI-DevKit-1.1
  • Hacked Feather M0 Express with 8Mbyte SPI flash
  • HalloWing M0 Express
  • HiiBot BlueFi
  • IMXRT1010-EVK
  • IkigaiSense Vita nRF52840
  • J&J Studios datum-Distance
  • J&J Studios datum-IMU
  • J&J Studios datum-Light
  • J&J Studios datum-Weather
  • Kaluga 1
  • LILYGO TTGO T8 ESP32-S2 w/Display
  • LoC BeR M4 base board
  • MDBT50Q-DB-40
  • MDBT50Q-RX Dongle
  • MEOWBIT
  • MORPHEANS MorphESP-240
  • MakerDiary nRF52840 MDK
  • MakerDiary nRF52840 MDK USB Dongle
  • Makerdiary M60 Keyboard
  • Makerdiary Pitaya Go
  • Makerdiary nRF52840 M.2 Developer Kit
  • Melopero Shake RP2040
  • Meow Meow
  • Metro MIMXRT1011
  • Mini SAM M4
  • NUCLEO STM32F746
  • NUCLEO STM32F767
  • NUCLEO STM32H743
  • OPENMV-H7 R1
  • Oak Dev Tech BREAD2040
  • Oak Dev Tech PixelWing ESP32S2
  • Open Hardware Summit 2020 Badge
  • PCA10056 nRF52840-DK
  • PCA10059 nRF52840 Dongle
  • PCA10100 nRF52833 Dongle
  • PYB LR Nano V2
  • Particle Argon
  • Particle Boron
  • Particle Xenon
  • PewPew 10.2
  • PewPew 13
  • PewPew M4
  • PicoPlanet
  • Pimoroni Interstate 75
  • Pimoroni Keybow 2040
  • Pimoroni PGA2040
  • Pimoroni Pico LiPo (16MB)
  • Pimoroni Pico LiPo (4MB)
  • Pimoroni PicoSystem
  • Pimoroni Plasma 2040
  • Pimoroni Tiny 2040
  • PyCubedv04
  • PyCubedv04-MRAM
  • PyCubedv05
  • PyCubedv05-MRAM
  • PyKey60
  • PyboardV1_1
  • Raspberry Pi Pico
  • Robo HAT MM1 M4
  • S2Mini
  • SAM E54 Xplained Pro
  • SAM32v26
  • SPRESENSE
  • ST STM32F746G Discovery
  • STM32F411E_DISCO
  • STM32F412G_DISCO
  • STM32F4_DISCO
  • Saola 1 w/Wroom
  • Saola 1 w/Wrover
  • Seeeduino Wio Terminal
  • Seeeduino XIAO
  • Serpente
  • Silicognition LLC M4-Shim
  • Simmel
  • SparkFun LUMIDrive
  • SparkFun MicroMod RP2040 Processor
  • SparkFun MicroMod SAMD51 Processor
  • SparkFun MicroMod nRF52840 Processor
  • SparkFun Pro Micro RP2040
  • SparkFun Pro nRF52840 Mini
  • SparkFun Qwiic Micro
  • SparkFun RedBoard Turbo
  • SparkFun SAMD21 Dev Breakout
  • SparkFun SAMD21 Mini Breakout
  • SparkFun STM32 MicroMod Processor
  • SparkFun Thing Plus - RP2040
  • SparkFun Thing Plus - SAMD51
  • Sprite_v2b
  • StackRduino M0 PRO
  • TG-Boards' Datalore IP M4
  • TG-Watch
  • THUNDERPACK_v11
  • THUNDERPACK_v12
  • Targett Module Clip w/Wroom
  • Targett Module Clip w/Wrover
  • Teensy 4.0
  • Teensy 4.1
  • Teknikio Bluebird
  • The Open Book Feather
  • TinkeringTech ScoutMakes Azul
  • TinyS2
  • Trinket M0 Haxpress
  • UARTLogger II
  • WarmBit BluePixel nRF52840
  • Winterbloom Big Honking Button
  • Winterbloom Sol
  • XinaBox CC03
  • XinaBox CS11
  • iMX RT 1020 EVK
  • iMX RT 1060 EVK
  • keithp.com snekboard
  • micro:bit v2
  • microS2
  • nanoESP32-S2 w/Wrover
  • nanoESP32-S2 w/Wroom
  • ndGarage[n°] Bit6: FeatherSnow-v2
  • ndGarage[n°]Bit6:FeatherSnow
  • nice!nano
  • senseBox MCU
  • stm32f411ce-blackpill
  • stm32f411ce-blackpill-with-flash
  • uChip
  • uGame10

math.e :float

自然对数的底

math.pi :float

圆的周长与其直径的比值

math.acos(x: float)float

返回 的反余弦值x

math.asin(x: float)float

返回 的反正弦 x

math.atan(x: float)float

返回 的反正切 x

math.atan2(y: float, x: float)float

返回 的反正切的主值y/x.

math.ceil(x: float)int

返回一个整数, x 朝正无穷大四舍五入。

math.copysign(x: float, y: float)float

x以 符号返回 y

math.cos(x: float)float

返回 的余弦 x

math.degrees(x: float)float

返回x 转换为度数的弧度。

math.exp(x: float)float

返回 的指数 x

math.fabs(x: float)float

返回 的绝对值 x

math.floor(x: float)int

返回一个整数, x朝负无穷大四舍五入。

math.fmod(x: float, y: float)int

返回 的余数 x/y.

math.frexp(x: float)Tuple[int, int]

将浮点数分解为其尾数和指数。返回的值是元组,从而 准确。如果然后函数返回,否则关系成立。(m, e) such that x == m * 2**e x == 0 (0.0, 0) 0.5 <= abs(m) < 1

math.isfinite(x: float)bool

True如果x 有限则返回。

math.isinf(x: float)bool

True如果x 是无限则返回。

math.isnan(x: float)bool

True 如果x不是数字则返回

math.ldexp(x: float, exp: float)float

返回。x * (2**exp).

math.modf(x: float)Tuple[float, float]

返回两个浮点数的元组,作为 的小数部分和整数部分 x。两个返回值与 具有相同的符号 x

math.pow(x: float, y: float)float

返回x 到的功率y

math.radians(x: float)float

返回x转换为弧度的度数。

math.sin(x: float)float

返回 的正弦x

math.sqrt(x: float)float

返回 的平方根x

math.tan(x: float)float

返回 的切线 x

math.trunc(x: float)int

返回一个整数, x 四舍五入到 0。

math.expm1(x: float)float

返回。 exp(x) - 1.

math.log2(x: float)float

返回以 2 为底的对数x

math.log10(x: float)float

返回以 10 为底的对数 x

math.cosh(x: float)float

返回 的双曲余弦值 x

math.sinh(x: float)float

返回 的双曲正弦值 x

math.tanh(x: float)float

返回 的双曲正切值 x

math.acosh(x: float)float

返回 的反双曲余弦值 x

math.asinh(x: float)float

返回 的反双曲正弦值x

math.atanh(x: float)float

返回 的反双曲正切值 x

math.erf(x: float)float

返回 的误差函数 x

math.erfc(x: float)float

返回 的互补误差函数 x

math.gamma(x: float)float

返回 的伽马函数x

math.lgamma(x: float)float

返回 的伽马函数的自然对数 x