Questions tagged [fmodf]

14 questions
2
votes
5 answers

Can I pass NULL to modf/modff?

The modf() family of functions all take a pointer parameter: float modff( float arg, float* iptr ); double modf( double arg, double* iptr ); long double modfl( long double arg, long double* iptr ); for returning the integral part of…
einpoklum
  • 118,144
  • 57
  • 340
  • 684
2
votes
1 answer

Java 1.6.0_45 on Solaris 9 returns relocation error "symbol __fmodf: referenced symbol not found"

I have a java application running in a Solaris 9 (brand zone inside a Solaris 10 global). root@server # cat /etc/release Solaris 9 4/03 s9s_u3wos_08 SPARC Copyright 2003 Sun Microsystems, Inc. All…
MariusPontmercy
  • 398
  • 1
  • 5
  • 20
2
votes
2 answers

Equivalent of fmodf in C#?

In C++ C: Output: "1610612736" #include #include int main(int argc, char** argv) { printf("%d\n", fmodf(5.6f, 6.4f)); getchar(); } In C#: Output: "5.6" using System; static class Program { public static void…
Lazlo
  • 8,518
  • 14
  • 77
  • 116
2
votes
1 answer

float fmodf(float_x, float_y) function, math.h, c++

hello I was hoping someone could help me with this. I am using the float fmodf(float_x, float_y) function from math.h. i am able to code with it properly but I was just wanted to know does anyone know the functions exact code is, so i can…
AlanF
  • 1,591
  • 3
  • 14
  • 20
1
vote
3 answers

Is this a correct way of doing this in C?

Should I change something in written code? Compiler says that everything is right — no errors or warnings. You are building a new home and you have calculated exactly how much cement you need for the foundation. Ideally you'd like to purchase this…
1
vote
2 answers

modf returns 1 as the fractional:

I have this static method, it receives a double and "cuts" its fractional tail leaving two digits after the dot. works almost all the time. I have noticed that when it receives 2.3 it turns it to 2.29. This does not happen for 0.3, 1.3, 3.3, 4.3 and…
Matti
  • 11
  • 2
1
vote
2 answers

fmod telling me fractional part of 1 is 1

I'm trying to check if a double variable p is approximately equal to an integer. At some point in my code I have double ip; cout << setprecision(15) << abs(p) << " " << modf(abs(p), &ip) << endl; And for a given run I get the printout 1 1 This…
jorgen
  • 3,425
  • 4
  • 31
  • 53
0
votes
1 answer

Where in the C++11 standard is std::fmodf stated?

According to the cppref page, std::fmodf was added to cmath in C++11. How is this possible though, because wouldn't this mean that cmath would break compatability with math.h previous to C++11? I'm unable to find any references that say std::fmodf…
VevsVire
  • 15
  • 1
  • 3
0
votes
2 answers

Does fmodf() cause a hardfault in stm32?

I am trying to create a modulated waveform out of 2 sine waves. To do this I need the modulo(fmodf) to know what amplitude a sine with a specific frequency(lo_frequency) has at that time(t). But I get a hardfault when the following line is…
le_lemon
  • 107
  • 1
  • 11
0
votes
1 answer

Best way to get the Fractional Part of a Number

Given const auto foo = 13.42 I would like to get the numbers fractional part, so .42 I'm leaning toward just using fmod like: fmod(foo, 1.0) But I could also just do foo / static_cast(foo) - 1.0 Or perhaps some other mystical method. Would…
Jonathan Mee
  • 37,899
  • 23
  • 129
  • 288
0
votes
4 answers

Objective C: Creating Long Double uses Decimal Method

How do I create the following method? I have tried to use modf(n, 1) or modf(n, 2) but those both return an error of "Passing argument 2 of modf makes pointer from integer without a cast. Heres the method: (BOOL) numberHasDecimal: (long double) n…
michaellindahl
  • 2,012
  • 5
  • 36
  • 64
0
votes
1 answer

Is modf() supported in OpenGL ES 2.0 Shader Language?

The OpenGL ES specification page about the GLSL function modf() indicates that it should be supported by version 3.0, and not by version 1.0. What about version 2.0? Does it support it?
wip
  • 2,313
  • 5
  • 31
  • 47
0
votes
1 answer

modf does not work properly

This code should display if first 3 digits of fractional part contains "9", but does not work. "mod" variable, surprisingly, is 0 for any number. int main( void ) { float number, dmod; int mod; double digit_1, digit_2, digit_3; …
mixaill
  • 57
  • 1
  • 1
  • 7
0
votes
1 answer

Issue with fmodf for getting the Modulo

I need to find the modulo for float numbers. For that, I am using NSLog(@"value >> %f",fmodf(2.0f, 0.1f)); The output for this should be 0.0f But I am getting the output value >> 0.1 How?
mayuur
  • 4,736
  • 4
  • 30
  • 65