Dear all,
Could you help me, is there an RSQRT (single precision) hardware or software function in ESP-IDF? I can't find information about it.
RSQRT on ESP32
-
nopnop2002
- Posts: 347
- Joined: Thu Oct 03, 2019 10:52 pm
- Contact:
Re: RSQRT on ESP32
You can use these in esp-idf.
Code: Select all
#include <stdio.h>
#include <math.h>
void app_main()
{
double dx = 2.0;
double da = sqrt(dx);
float fx = 2.0;
float fa = sqrt(fx);
fa = sqrtf(fx);
long double ldx = 2.0;
long double lda = sqrt(ldx);
lda = sqrtl(ldx);
}
-
alex000090
- Posts: 9
- Joined: Tue Dec 24, 2024 9:07 am
Re: RSQRT on ESP32
Thanks for your answer!
I mean is there a hardware or software implementation of "Fast inverse square root" algorithm on ESP32?
https://en.wikipedia.org/wiki/Fast_inverse_square_root
I mean is there a hardware or software implementation of "Fast inverse square root" algorithm on ESP32?
https://en.wikipedia.org/wiki/Fast_inverse_square_root
-
MicroController
- Posts: 2662
- Joined: Mon Oct 17, 2022 7:38 pm
- Location: Europe, Germany
Re: RSQRT on ESP32
What do you mean? - As soon as you copy the six lines of code into your application, there is a software implementation.is there a hardware or software implementation of "Fast inverse square root" algorithm on ESP32?
https://en.wikipedia.org/wiki/Fast_inverse_square_root
Another option is to take the assembler instruction sequences for reciprocal square root from the Xtensa Instruction Set Summary, which should be faster than using "1.0f/sqrtf(x)", i.e. a floating point sqrt PLUS a floating point division.
-
alex000090
- Posts: 9
- Joined: Tue Dec 24, 2024 9:07 am
Re: RSQRT on ESP32
You are absolutely right. I mean there is better software algorithm whish was incorporated into esp-idf maybe. As well as, if I'm correct, in the CPU may be hardware RSQRT command which is can be used and also incorporated into esp-idf.
Who is online
Users browsing this forum: ChatGPT-User, Qwantbot and 4 guests