473,508 Members | 3,688 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

C++ modf function

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 * ipart );
Split floating-point value into fractional and integer parts.
Breaks x in two parts: the integer (stored in location pointed by ipart)
and the fraction (return value).

So does any know of a function that i can use to find the fractional and
integer parts of a floating-point value?
thanks
--
Maria Cruz
MTC Technologies.com
Nov 17 '05 #1
1 11568
double orig, ipart, fractional = 0;
orig = 1.234;

fractional = orig - (ipart = Math.Floor(orig));
"mcruz" <mc***@discussions.microsoft.com> wrote in message
news:F7**********************************@microsof t.com...
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 * ipart );
Split floating-point value into fractional and integer parts.
Breaks x in two parts: the integer (stored in location pointed by ipart)
and the fraction (return value).

So does any know of a function that i can use to find the fractional and
integer parts of a floating-point value?
thanks
--
Maria Cruz
MTC Technologies.com

Nov 17 '05 #2

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

Similar topics

3
14908
by: domeceo | last post by:
can anyone tell me why I cannot pass values in a setTimeout function whenever I use this function it says "menu is undefined" after th alert. function imgOff(menu, num) { if (document.images) {...
5
2811
by: phil_gg04 | last post by:
Dear Javascript Experts, Opera seems to have different ideas about the visibility of Javascript functions than other browsers. For example, if I have this code: if (1==2) { function...
2
7661
by: laredotornado | last post by:
Hello, I am looking for a cross-browser way (Firefox 1+, IE 5.5+) to have my Javascript function execute from the BODY's "onload" method, but if there is already an onload method defined, I would...
2
12664
by: sushil | last post by:
+1 #include<stdio.h> +2 #include <stdlib.h> +3 typedef struct +4 { +5 unsigned int PID; +6 unsigned int CID; +7 } T_ID; +8 +9 typedef unsigned int (*T_HANDLER)(void); +10
3
2335
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...
3
1614
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
2489
by: Patrick Sullivan | last post by:
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...
8
5077
by: Olov Johansson | last post by:
I just found out that JavaScript 1.5 (I tested this with Firefox 1.0.7 and Konqueror 3.5) has support not only for standard function definitions, function expressions (lambdas) and Function...
12
4920
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...
0
7128
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
7332
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
7393
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
5057
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...
0
4715
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
3206
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
1565
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated ...
1
769
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
0
426
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence...

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.