Maximum number in a Single precision floating number
Hi everyone,
I would like to know which is the maximum positive and negative number I can write in a SGL numeric control. I read the Numeric data types table in the LabVIEW help and I am not sure if the numbers in the column "approximate range on disk" are the maximun and minimum ones because I wrote in a DBL numeric control the number 6216825840 (which is less than the maximum on the table 3.40e+38) and I displayed it in a SGL numeric indicator, and the number changed.
The problem is that I am storing some data in the numeric format and I choose the SGL format because it uses less space in the disk, however I have the number 6216825840 which changes if it is storaged in this format. I know that I should change to DBL, but I am doing an array with all my data and if I change one by BDL the other ones change to DBL and will use more space in the disk when I store them.
I attach a picture of this problem.
Thanks in advance.
JC
Attachments:
DBLtoSGL.JPG 28 KB
In particular, you can create a simple test program that shows you that the highest good integer is 16777216 for SGL, because 16777216+1=16777216.
For deep reasons, this is the same as 2^24 as mentioned above.
Here's a quick code that stops the loop once i = i+1, then displays i (the fist integer that fails the test, thus is the largest good integer for SGL.
Message Edited by altenbach on 06-15-2007 01:33 PM
LabVIEW Champion . Do more with less code and in less time .
Attachments:
SGL-Limit.png 5 KB
Similar Messages
-
Single Precision Floating Point Numbers to Bytes
Ok here is some code that i have written w hile back with some help from the support staff. It is designed to take in precision floating point numbers that are stored as 4 bytes and convert then to a decimal value. It works off of a udp input string and then also reformats the string. I have the ability to look at up to 4000 parameters from this one udp string. But now what i want to do is do the opposite of what i have written, and also perhaps get rid of the matlab i used in it as well. What i would like to be able to do is input a decimal value and then have it converted in to the 4 byte groupings that make up this decimal nd then have it inputed back in to a single long string witht hat grouping of bytes in the right order. A better explanation of what was done can be found on this website
http://www.jefflewis.net/XPlaneUDP_8.html
as the original code followed the "Single Precision Floating Point Numbers and Bytes" example on that site but what i want to do is "Going from Single Precision Floating Point Numbers to Bytes". The site also explains the udp string that is being represented. Also attached is the original code that i am trying to simply reverse.
Attachments:
x-plane_udp_master.vi 34 KBPerhaps what you are doing is an exercise in the programming of the math conversion of the bytes.
But if you are just interested in getting the conversion done, why not use the typecast function?
If the bytes happen to be in the wrong order for wherever you need to send the string, then you can use string functions to rearrange them.
Message Edited by Ravens Fan on 10-02-2007 08:50 PM
Attachments:
Example_BD.png 3 KB -
How to transfer a float number to boolean
I want to transfer a float number to a boolean array? How can I achieve?
Solved!
Go to Solution.YoungHang wrote:
but actually "number to boolean array" can only transfer a integer or fixed-point number to boolean array , not float number
Just typecast the DBL to U64 first.
LabVIEW Champion . Do more with less code and in less time . -
Can someone explain why doing a floating point conversion compromises digit of precision accuracy? For example, if I wire the double precision number "16.0001000" to the "to Single Precision Float" vi input, the output is "16.0000991".
I have an application in which this level of accuracy is critical. I can think of several work arounds, but I still would like a good explanation for why this is the case.
pmacJust use array to spreadsheet string on the DBL and write as text file (and an analogous operation for reading, converting back to DBL). Alternatively, you could make DBL version of "read/write spreadheet file" by editing them slightly and saving them under a new name elsewhere. Make sure to change the icon too, e.g. give it a different color.
If precision is that important, you might want to use binary files. The don't have any formatting loss at all.
Of course if this is just measurement data, don't be fooled by fake precision. even SGL has a 22 bit mantissa, so if your DAQ hardware acqures in 16 bits, SGL is plenty.
LabVIEW Champion . Do more with less code and in less time . -
Convert double precision float string to a number
I am a newbie with Labview.
I have a GPIB link with a vector voltmeter and I receive the data as a double precision float string (IEEE standard 754-1985). I would like it to be recognized as a number, but I can't find the proper conversion function. The string to convert is 8 byte long. Does anyone have an idea how to do it? Thank you!Asumming your data is big-endian, you should be able to simply typecast it to a DBL (see attache LV 7.0 example).
(It is possible that your DBL string is little-endian, in this case it will be slightly more complicated. Let us know )Message Edited by altenbach on 05-27-2005 04:49 PM
LabVIEW Champion . Do more with less code and in less time .
Attachments:
StringToDBL.vi 23 KB -
How is it possible to precise a float number in java
Hello ,
It is my second post and i couldnt find an answer to it. The problem ii want to display a float number with only the last three decimal after the comma. For example, float x = 23.445566 and i need to display only 23.445
How can i do that ? here is the code:
int val1 = 1432;
int val2 = 13;
float result = 0.000F
(float) (valu1/valu2)
the result = 110.153846...
And what i want to display is 110.153
Please help.
ThanksYou're right - java.text.Decimal format uses round half even, java.util.Formatter uses round half up.
Float f = 0.5F;
System.out.printf("%.0f\n", f);
System.out.println(new java.text.DecimalFormat("0").format(f));
1
0In the ASNI C implementations I've worked with, printf also uses half-even.
Bizarre.
Pete -
How to convert timing to floating number
hi everyone, i want to do a time measurement of hall sensor and use this value to set a frequency and also to use as process value in a PID controller. the problem is that i get an dynamic data output and i'd like to have this in a floating number, is this possible? or another way is also good... hereby a jpeg to make it more clear.
i also get more problems with this, when i change the throttle (0-100%) is doesn't do anything and my while loop also doesn't end anymore. this is just a small part of the complete program, maybe it's to heavy for my comp? (single core 1,6Ghz, 1,5gig ram)
hope it's a little bit clear what i mean
thanks in advance !
P.S: i know that the divide by one is useless because you can directly measure the frequency, this has allready changed.
the program is meant to drive a PMSM motor
Solved!
Go to Solution.hi thanks for the reply, the answer you gave helped me out.
now i've noticed that when i ad the the pid loop (even when nothing of it is connected) the program doesn't respond anymore. is this because of my computer? the while loops (both the normal and pid loop) are stopped by a single switch...
i have uploaded my VI so maybe someone could check it out, be aware it's totally not finished ^^. if you delete the pid control you'll see what i mean.
thanks in advance
Attachments:
PMSM steering.vi 2527 KB -
MX Electronic accounting - Set multiple UUID for single MIRO Document number
Greetings everyone
In my company already implemented the neccesary changes required by the new laws in MX Electronic Accounting inside the MIRO transaction (note 2093189), as well as the related notes requested for electronic accounting. Everything's working fine so far since right now we save the UUID field from CFDI XML file into an Invoice Document number. But now in my company request to save multiple CFDI invoices into a single Invoice document number. My approach seems to be simple because we only need to generate a new window to save the multiple UUID numbers and link the Invoice Document Number (BELNR), company code and fiscal period/year and UUID document into a Z custom table. But I have some questions that I'm not sure how will affect:
How does affect the montly policies report that we need to send to the government (SAT).
How do we need to handle the policies XML file in this type of scenarios
Any of you have the same scenario?
how do you handle this kind of scenarios?
So far I read the following notes but I can't find a clue so far for this kind of scenario (Am I missing something?)
(MX) Contabilidad Electrónica - RME 2014 Anexo 24
Notes:
http://service.sap.com/sap/support/notes/2041490
http://service.sap.com/sap/support/notes/2093189
http://service.sap.com/sap/support/notes/2042663
Thanks in advance and best regards
Lorenzo Martín OlmosHi Shekhar
Thanks a lot for you comments and I apologize for the late reply. As you point this is the most common scenario. In my case when the creditor is the Mexican Social Security Institute (IMSS), and after the payment, either IMSS and INFONAVIT (the governments institute for workers housing) generates different CFDI invoices.
How do you currently handle this scenario?
Thanks for your comments. Warm regards
Lorenzo Martín Olmos -
How to club many sales orders in to one single invoice document number
Dear Team,
We are in to contract for 12 years with our client for a particular service,so we will raise a contract order for a particular item,with this we generate the order number,here we are generating some 150 orders numbers,this 150 order number I want to combine in to one single invoice document number,I have tried this in vf01 I am giving the all 150 document numbers,and excuting this but here for each sales order document number it is creating one billing document number,but I need one single invoice number for all this order numbers.
My copy controls are
In VTFA
Header data
Sales doc type- zabc
Target billing tye- zmv
Copy requirement- 001 header/order related
Determination export data- blank
Assignment number- b
Reference number- b
Copy item number- tick box was selected
Item category
Copy requirements- Item/order related
Data vbrk/vbrp- 003 single invoice
Billing quantity A
Pos/neg +
Pricing type c
Pricing type exchange rate blank
Price source blank
Can any one guide what to doHi
In VTFA, please do the following changes,and then test by creating the sales orders then do collective billing.
Keep Assignment number blank
Keep Reference number blank
Copy item number- Uncheck the box where tick box was selected
Also make sure that PO Number in sales order is same
Regards
Srinath -
Error in mapping for floating Number calculation
Hi All,
I have a small doubt in floating number calculation in Mapping.
Actually i am geting a floating point number and calculating the SUM and generating the output. The input is of 2 decimal places(Ex: 26.02 and 26.03 ), but when it is adding all the values it is generating a three digit decimal number (Ex: 52.050003)
I dont know from where it is geting one extra number "2" in the output.
Please find the code for the same and let me know if i need to do something else to get ride of this.
//write your code here
float sum=0;
if(a != null && a.length > 0.00)
for ( int j =0; j<a.length;j++)
sum = sum + Float.parseFloat(a[j]);
result.addValue(String.valueOf(sum));
else
result.addValue("0");
Thanks in Advance,
JAYJay,
Please use the below code and let us know, if it helps.
BigDecimal sum= new BigDecimal("0");
BigDecimal bd;
if(a != null && a.length > 0.00)
for ( int j =0; j<a.length;j++)
bd=new BigDecimal(a[j]);
sum=sum.add(bd);
result.addValue(""+sum+"");
else
result.addValue("0");
in import section - java.math.*;
raj.
Edited by: Raj on Feb 18, 2008 11:11 AM -
How to get the amplitude of a sound as a float number in Java
Hi, I would like to create a program which plays an audio file(it may be a midi, probably) and it returns
the amplitude of the sound in terms of float number.
I mean, is it possible to obtain this number, since every sound file is actually a sequence of float number like
110.010110101 etc.
Can you help me with suggestions and details about the way to take.
Regards
FrankFor sampled sound, the answer might be seen in [ this thread|http://forums.sun.com/thread.jspa?messageID=10636576#10636576]. For MIDI it is different in that you will only be able to get it as sampled sound once it has been synthesized, and as I recently found out, to get the audio coming through the regular sound lines will take nothing less than a physcical or software 'audio loopback' being installed, on most PCs.
Of course, if it is MIDI, you might just cheat by calculating a 'volume' from the note velocities in the MIDI score. -
Converting string to float number
Here's what I'm trying to do. The user types a number, such as 12.011, in an input box. I want to check to see if the number they typed is between two numbers, such as 12 and 12.1. Therefore, I want to convert the string in the input box to a float number, not an integer, so I can check to see if it's in the correct range. How do I convert a string into a float number?
thanks
MarkDid you try:
Number(textinput1.text);
if(Number(textinput1.text)>12 && Number(textinput1.text)<12.1) -
Hi!
Which Math function do I have to use to round up a float number ? I thought the correct one was the Math.ceil() function but I don't get what I need. I mean, which is the correct function to get the following result:
Math.function(2.75)=3
ThanksThis is what I get:
Math.ceil(2.75)=2I get 3.0 for that calculation. You must be doing something besides the raw calculation. Here's my code that tests it:public static void main(String[] args) {
System.out.println(Math.ceil(2.75));
}Let's see yours.
PC² -
how can I determine whether the number of digits after decimal point is greater than one? For e.g., the float number of 16.04(or more digits) should be rounded, but the number of 16.1 should not be rounded.
Is there any other convenience method except the split method in String class?
thanks in advance.Yes, the formula you mentioned is what I'm using to round the float number to the tenth place.
float f = ...;
f = Math.floor(f*10) / 10;
but the float number I'm choosing to be rounded should have the number of digit numbers after decimal point greater than one, for e.g.,
f = 16.045 need to be rounded to 16.0 using that formula
f = 16.01 ......
f = 16.0 need not to be rounded since it aready just have one digit number after decimal point
f = 15.9 ......
sorry about the confusion. thanks for your help. -
Precision of Number is 0?
I used the sample from from http://www.oracle.com/technology/sample_code/tech/java/codesnippet/jdbc/OracleResultSetMetaData.html) to fetch metadata of a table, and the result is:
Number of Columns in the table : 2
Column Name :SysIterID
Column Type :NUMBER
Column Scale :0
Column Precision :19
NULLABLE
Column Name :a
Column Type :NUMBER
Column Scale :0
Column Precision :0 (In SQL Developer it's NUMBER(10,0).)
NOT NULL
From docs, precision of NUMBER should be in range [1,38].
Is it normal to get a 0 precision?
On what condition a 0 presicion is expected?How to produce the issue.
Db: XE 11g
(1) create table test (a number(19), b number primary key)
(2) Run the following sample(from http://www.oracle.com/technology/sample_code/tech/java/codesnippet/jdbc/OracleResultSetMetaData.html):
package test.sql;
import java.sql.*;
import oracle.jdbc.OracleResultSetMetaData;
public class TableMeta {
static final String dbURI = "jdbc:oracle:thin:@localhost:1521:xe";
public static void main(String[] args) throws Exception{
// Connection reference
Connection conn = null;
try {
// Load database driver
DriverManager.registerDriver (new oracle.jdbc.OracleDriver());
// Make connection
conn = DriverManager.getConnection(dbURI,"test","test");
Statement stmt = conn.createStatement();
ResultSet rs = stmt.executeQuery("SELECT * from test where rownum <= 0");
// Get the ResultSet meta data
OracleResultSetMetaData rmd = (OracleResultSetMetaData)rs.getMetaData();
if (rmd == null) {
System.out.println("ResultSet meta data not available");
} else {
int columnCount = rmd.getColumnCount();
// Display number of Columns in the ResultSet
System.out.println("Number of Columns in the table : " + columnCount);
for(int i=1; i<=columnCount; i++) {
// Display number of Column name
System.out.println("Column Name :" + rmd.getColumnName(i));
// Display number of Column Type
System.out.println("Column Type :" + rmd.getColumnTypeName(i));
// Display number of Column Scale
System.out.println("Column Scale :" + rmd.getScale(i));
// Display number of Column Precision
System.out.println("Column Precision :" + rmd.getPrecision(i));
// Display if Column can be NOT NULL
switch (rmd.isNullable(i)) {
case OracleResultSetMetaData.columnNoNulls :
System.out.println("NOT NULL");
break;
case OracleResultSetMetaData.columnNullable :
System.out.println("NULLABLE");
break;
case OracleResultSetMetaData.columnNullableUnknown :
System.out.println("NULLABLE Unkown");
System.out.println();
} finally {
// Close connection
if (conn != null) {
try {
conn.close();
} catch (SQLException ex) {
System.out.println("Error in closing Conection");
(3) Result:
Number of Columns in the table : 2
Column Name :A
Column Type :NUMBER
Column Scale : 0
Column Precision :19
NULLABLE
Column Name :B
Column Type :NUMBER
Column Scale : 0
Column Precision : 0
NOT NULL
Edited by: Leon Zeng on Sep 28, 2008 4:58 PM
Maybe you are looking for
-
How do you get the maps app to speak turn by turn directions through a car audio system?
When using maps app in route in my car, I get a bluetooth icon at the bottom right of the screen. When I tap on it, there is a choice to either play sound either through the iPhone or through an audio device. If I select audio device it still plays
-
Hello team, i have one more question ... I have a siple SQL report. f.e. a list of all emp's [email protected]> select * from scott.emp; EMPNO ENAME JOB MGR HIREDATE SAL COMM DEPTNO 7369 SMITH CLERK 7902 1980-12-17 00:00:00 800 20 7499 ALLEN SALESMAN
-
I'm having a problem printing coupons
For some reason I cannot print coupons from redplum bc of Java and the coupon.com coupon installer isn't printing my coupons ever since I dowloaded Mountain Lion. Can anyone help, I NEED MY COUPONS!!!
-
Anlysis authorization implemented after Cascading is not working
Anysis authorization implemented after Cascading is not working. Example: i have 3 dropdownboxes in WAD . Frist dropdownbox State, second dropdownbox District, third dropdownbox Town.In the first dropdown box i selected state AP ,it should show only
-
Ordered new Internet service a month ago and still nothing!
At the end of August I placed an order to upgrade the speeds to my Internet (sounds good so far doesn't it verizon). Well it's now September 28 and I still haven't received anything from these people. I've called about 5 times in the past month, the