473,440 Members | 1,746 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,440 software developers and data experts.

modf

Is there any VB function that can do what modf() does in Visual C/C++, like

Modf: Splits a floating-point value into fractional and integer parts. The
integer portion is stored in *intptr (address of the variable) and the
fraction is returned as the variable x.

double modf(
double x,
double *intptr
);

float modf(
float x,
float *intptr
); // C++ only

long double modf(
long double x,
long double * intptr
); // C++ only

float modff(
float x,
float *intptr
);

VB.Net's Mod requires two numbers, it seems, like and 8 and a 3 for inputs
and returns the modulus remainder. 8 mod 3 = 2

floor and ceiling do not give correct results, but it seems like I should be
able to use something like A = floor(angle) - ceiling(angle).
--

Patrick Sullivan, AA-BA, BA-IT
Nov 23 '05 #1
1 2485
nevermind, I found I can do it with
x = int(value)
y = value - x

--

Patrick Sullivan, AA-BA, BA-IT

"Patrick Sullivan" <ps****@eatel.net> wrote in message
news:lc********************@eatel.net...
Is there any VB function that can do what modf() does in Visual C/C++, like
Modf: Splits a floating-point value into fractional and integer parts. The
integer portion is stored in *intptr (address of the variable) and the
fraction is returned as the variable x.

double modf(
double x,
double *intptr
);

float modf(
float x,
float *intptr
); // C++ only

long double modf(
long double x,
long double * intptr
); // C++ only

float modff(
float x,
float *intptr
);

VB.Net's Mod requires two numbers, it seems, like and 8 and a 3 for inputs
and returns the modulus remainder. 8 mod 3 = 2

floor and ceiling do not give correct results, but it seems like I should be able to use something like A = floor(angle) - ceiling(angle).
--

Patrick Sullivan, AA-BA, BA-IT

Nov 23 '05 #2

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

3
by: MarkN | last post by:
modf() is a C Standard Library function double modf(double x, double* ip); returns fractional part and assigns to *ip integral part of x, both with same sign as x I have encountere a situation...
6
by: damian birchler | last post by:
I wrote a function that should test if a given number is a palindrom, but when I ran it in a little testprogram it behaves strange. #include <stdio.h> #include <math.h> ...
3
by: Christopher Benson-Manica | last post by:
Given that modf is prototyped as double modf( double x, double *iptr ); is the behavior of the function well-defined if the address of x is passed as the value of iptr? -- Christopher...
1
by: mcruz | last post by:
hi, I was using the following function in a C++ program. I am now "porting" it to C# and I can not find an equivalent to: modf function. As described below. double modf ( double x , double *...
9
by: Frank Potter | last post by:
I only want to remove the comments which begin with "//". I did like this, but it doesn't work. r=re.compile(ur"//+$", re.UNICODE|re.VERBOSE) f=file.open("mycpp.cpp","r") f=unicode(f,"utf8")...
1
by: Neal Becker | last post by:
from math import modf class nco (object): def __init__ (self, delta): self.delta = delta self.phase = 0.0 def __call__ (self): self.phase += self.delta f,i = modf (self.phase) print modf...
14
by: jason.cipriani | last post by:
Two questions: 1. On a modern 32-bit Intel machine, but not using SSE, what is the fastest way to compute the fractional part of a float? E.g., "fmodf(num, 1.0f)", or "num - (float)(int)num",...
2
by: Alejandro | last post by:
Hi: I need to find the multiples of a decimal number in a floating point list. For instance, if a have the list , I want the multiples of 0.2: . With integers this problem is easy, just test...
12
by: bsabiston | last post by:
Hi, I'm trying to get the fractional part of a floating point number. I've tried fmod() and modf(), and while both do work, they also occasionally return 1.0 for the fractional part of the number...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
1
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and...
0
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The...
0
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.